Date: Wed, 29 Apr 2026 21:43:16 +0000 From: Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron <dumbbell@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: bffaea681802 - stable/15 - linuxkpi: Implement __GFP_THISNODE in alloc_pages() Message-ID: <69f27b74.18e06.1e37baea@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=bffaea68180296c827f77064fa1b023532f2004d commit bffaea68180296c827f77064fa1b023532f2004d Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> AuthorDate: 2026-04-22 16:27:32 +0000 Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org> CommitDate: 2026-04-29 21:04:30 +0000 linuxkpi: Implement __GFP_THISNODE in alloc_pages() It indicates to `alloc_pages()` to allocate the pages from the current NUMA domain. If it couldn't, it should not retry elsewhere and return failure. Reviewed by: bz Sponsored by: The FreeBSD Foundation (cherry picked from commit 06a51a510a60ca29193b2cdb8120b630ea9ef18c) --- sys/compat/linuxkpi/common/include/linux/gfp.h | 2 +- sys/compat/linuxkpi/common/src/linux_page.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/gfp.h b/sys/compat/linuxkpi/common/include/linux/gfp.h index b94cbada0435..5c638be92beb 100644 --- a/sys/compat/linuxkpi/common/include/linux/gfp.h +++ b/sys/compat/linuxkpi/common/include/linux/gfp.h @@ -59,7 +59,7 @@ #define __GFP_WAIT M_WAITOK #define __GFP_DMA32 (1U << 24) /* LinuxKPI only */ #define __GFP_NORETRY (1U << 25) /* LinuxKPI only */ -#define __GFP_THISNODE (1U << 26) /* Unimplemented */ +#define __GFP_THISNODE (1U << 26) #define __GFP_BITS_SHIFT 27 #define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) #define __GFP_NOFAIL M_WAITOK diff --git a/sys/compat/linuxkpi/common/src/linux_page.c b/sys/compat/linuxkpi/common/src/linux_page.c index 82f3a2a4639f..d8b65a12dc67 100644 --- a/sys/compat/linuxkpi/common/src/linux_page.c +++ b/sys/compat/linuxkpi/common/src/linux_page.c @@ -119,10 +119,19 @@ linux_alloc_pages(gfp_t flags, unsigned int order) req |= VM_ALLOC_NORECLAIM; retry: - page = vm_page_alloc_noobj_contig(req, npages, 0, pmax, - PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); + if ((flags & __GFP_THISNODE) != 0) { + int curdomain = PCPU_GET(domain); + page = vm_page_alloc_noobj_contig_domain( + curdomain, req, npages, 0, pmax, + PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); + } else { + page = vm_page_alloc_noobj_contig( + req, npages, 0, pmax, + PAGE_SIZE, 0, VM_MEMATTR_DEFAULT); + } + if (page == NULL) { - if ((flags & (M_WAITOK | __GFP_NORETRY)) == + if ((flags & (M_WAITOK | __GFP_NORETRY | __GFP_THISNODE)) == M_WAITOK) { int err = vm_page_reclaim_contig(req, npages, 0, pmax, PAGE_SIZE, 0);home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f27b74.18e06.1e37baea>
