From 9d1b0c59a13843a1fbede1dc85b06dc2a3c60ed2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Tigeot?= Date: Mon, 8 Jun 2020 07:42:44 +0200 Subject: [PATCH] drm/mm: Fix definitions of alloc_pages() and __free_pages() --- sys/dev/drm/include/linux/gfp.h | 29 +++++++++++++++++++++++++++++ sys/dev/drm/include/linux/mm.h | 30 +----------------------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/sys/dev/drm/include/linux/gfp.h b/sys/dev/drm/include/linux/gfp.h index 564facfc09..bfb8927036 100644 --- a/sys/dev/drm/include/linux/gfp.h +++ b/sys/dev/drm/include/linux/gfp.h @@ -43,6 +43,7 @@ #define GFP_HIGHUSER GFP_KERNEL #define __GFP_ZERO M_ZERO +#define __GFP_NORETRY M_NULLOK #define __GFP_HIGHMEM 0u /* No particular meaning on DragonFly */ #define __GFP_RECLAIMABLE 0u @@ -74,4 +75,32 @@ gfpflags_allow_blocking(const gfp_t flags) return (flags & M_WAITOK); } +/* + * Allocate multiple contiguous pages. The DragonFly code can only do + * multiple allocations via the free page reserve. Linux does not appear + * to restrict the address space, so neither do we. + */ +static inline struct page * +alloc_pages(gfp_t gfp_mask, unsigned int order) +{ + size_t bytes = PAGE_SIZE << order; + struct vm_page *pgs; + + pgs = vm_page_alloc_contig(0LLU, ~0LLU, bytes, bytes, bytes, + VM_MEMATTR_DEFAULT); + + return (struct page*)pgs; +} + +/* + * Free multiple contiguous pages + */ +static inline void +__free_pages(struct page *pgs, unsigned int order) +{ + size_t bytes = PAGE_SIZE << order; + + vm_page_free_contig((struct vm_page *)pgs, bytes); +} + #endif /* _LINUX_GFP_H_ */ diff --git a/sys/dev/drm/include/linux/mm.h b/sys/dev/drm/include/linux/mm.h index 6667ca8e2c..0ddf2e1f7a 100644 --- a/sys/dev/drm/include/linux/mm.h +++ b/sys/dev/drm/include/linux/mm.h @@ -4,7 +4,7 @@ * Copyright (c) 2010 Panasas, Inc. * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. * Copyright (c) 2015 Matthew Dillon - * Copyright (c) 2015-2019 François Tigeot + * Copyright (c) 2015-2020 François Tigeot * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -131,34 +131,6 @@ set_page_dirty(struct page *page) vm_page_dirty((struct vm_page *)page); } -/* - * Allocate multiple contiguous pages. The DragonFly code can only do - * multiple allocations via the free page reserve. Linux does not appear - * to restrict the address space, so neither do we. - */ -static inline struct vm_page * -alloc_pages(int flags, u_int order) -{ - size_t bytes = PAGE_SIZE << order; - struct vm_page *pgs; - - pgs = vm_page_alloc_contig(0LLU, ~0LLU, bytes, bytes, bytes, - VM_MEMATTR_DEFAULT); - kprintf("alloc_pages order %u vm_pages=%p\n", order, pgs); - return pgs; -} - -/* - * Free multiple contiguous pages - */ -static inline void -__free_pages(struct vm_page *pgs, u_int order) -{ - size_t bytes = PAGE_SIZE << order; - - vm_page_free_contig(pgs, bytes); -} - static inline void get_page(struct vm_page *page) { -- 2.41.0