mm: yet more cleanups for page_alloc APIs
Subsystems (16)
cover mm: yet more cleanups for page_alloc APIs
Based on mm-new.
Align some APIs with recent cleanups [0][1], and hide more mm-internal APIs from public headers.
Part of this was also proposed by Vlastimil right as I was writing it:
https://lore.kernel.org/all/[email protected]/
And just like with my other recent patches, this has the ulterior motive of enabling later incoming patches to add alloc_flags arguments to these internal functions. (But, I do think these are justified as cleanups in their own right).
[0]: https://lore.kernel.org/all/[email protected]/
[1]: https://lore.kernel.org/all/[email protected]/
---
Brendan Jackman (3):
mm: move internal mempolicy APIs to new internal header mm, treewide: replace __folio_alloc_node() with folio_alloc_node()
mm: move __folio_alloc() to page_alloc.h
MAINTAINERS | 1 + drivers/iommu/iommu-pages.c | 9 +-------- drivers/irqchip/irq-loongarch-ir.c | 4 ++-- include/linux/gfp.h | 25 +++---------------------- mm/filemap.c | 4 +++- mm/mempolicy.c | 1 + mm/mempolicy.h | 31 +++++++++++++++++++++++++++++++ mm/migrate.c | 2 +- mm/page_alloc.c | 18 +++++++++++++++--- mm/page_alloc.h | 4 ++++ mm/shmem.c | 1 + mm/swap_state.c | 1 + net/sunrpc/svc.c | 2 +- 13 files changed, 65 insertions(+), 38 deletions(-)
---
base-commit: 512c82e906fe2c26023e307c7951d53e90910b57
change-id: 20260716-folio-alloc-cleanups-0fe319b881c2
Best regards,
Signature · 1 line
Brendan Jackman <[email protected]>
PATCH 1/3 mm: move internal mempolicy APIs to new internal header
There are no external users for this surface, reduce the scope.
Ulterior motive: a later patch will add an alloc_flags arg to some parts of this.
Note it might seem like this could just go in internal.h, since it's pretty small, but actually it will eventually need to import page_alloc.h, we don't want to import that from internal.h so best to proactively created this header now.
--- MAINTAINERS | 1 + include/linux/gfp.h | 9 --------- mm/filemap.c | 2 ++ mm/mempolicy.c | 1 + mm/mempolicy.h | 31 +++++++++++++++++++++++++++++++ mm/shmem.c | 1 + mm/swap_state.c | 1 + 7 files changed, 37 insertions(+), 9 deletions(-)
MAINTAINERS +1 -0
@@ -17068,6 +17068,7 @@ F: include/uapi/linux/mempolicy.h F: include/linux/migrate.h F: include/linux/migrate_mode.h F: mm/mempolicy.c +F: mm/mempolicy.h F: mm/migrate.c F: mm/migrate_device.c
include/linux/gfp.h +0 -9
@@ -11,7 +11,6 @@#include <linux/sched.h> struct vm_area_struct ; -struct mempolicy ;/* Helper macro to avoid gfp flags if they are the default one */ #define __default_gfp (a,b,...) b
@@ -274,8 +273,6 @@ struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order#ifdef CONFIG_NUMA struct page *alloc_pages_noprof (gfp_t gfp,unsigned int order);struct folio *folio_alloc_noprof (gfp_t gfp,unsigned int order); -struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid);struct folio *vma_alloc_folio_noprof (gfp_t gfp,int order,struct vm_area_struct *vma,unsigned long addr);#else
@@ -287,11 +284,6 @@ static inline struct folio *folio_alloc_noprof(gfp_t gfp, unsigned int order) {return __folio_alloc_node_noprof (gfp, order,numa_node_id ()); } -static inline struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid) -{ -return folio_alloc_noprof (gfp, order); -}static inline struct folio *vma_alloc_folio_noprof (gfp_t gfp,int order,struct vm_area_struct *vma,unsigned long addr) {
@@ -301,7 +293,6 @@ static inline struct folio *vma_alloc_folio_noprof(gfp_t gfp, int order,#define alloc_pages (...) alloc_hooks(alloc_pages_noprof(__VA_ARGS__))#define folio_alloc (...) alloc_hooks(folio_alloc_noprof(__VA_ARGS__)) -#define folio_alloc_mpol (...) alloc_hooks(folio_alloc_mpol_noprof(__VA_ARGS__))#define vma_alloc_folio (...) alloc_hooks(vma_alloc_folio_noprof(__VA_ARGS__))#define alloc_page (gfp_mask) alloc_pages(gfp_mask, 0)
mm/filemap.c +2 -0
@@ -52,6 +52,7 @@#include <asm/tlbflush.h> #include "internal.h" +#include "mempolicy.h" #define CREATE_TRACE_POINTS #include <trace/events/filemap.h>
@@ -63,6 +64,7 @@#include <asm/mman.h> +#include "mempolicy.h" #include "swap.h" /*
mm/mempolicy.c +1 -0
@@ -119,6 +119,7 @@#include <linux/memory.h> #include "internal.h" +#include "mempolicy.h" #include "page_alloc.h" /* Internal flags */
mm/mempolicy.h new file +31 -0
@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* mm-internal API for mempolicy.c. Public API lives in +* include/linux/mempolicy.h. +*/ +#ifndef __MM_MEMPOLICY_H +#define __MM_MEMPOLICY_H + +#include <linux/gfp.h> +#include <linux/mempolicy.h> + +#ifdef CONFIG_NUMA +struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, +struct mempolicy *mpol,pgoff_t ilx,int nid); +#else +static inline struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, +struct mempolicy *mpol,pgoff_t ilx,int nid) +{ +return folio_alloc_noprof (gfp, order); +} +#endif + +#define folio_alloc_mpol (...) alloc_hooks(folio_alloc_mpol_noprof(__VA_ARGS__)) + +unsigned long alloc_pages_bulk_mempolicy_noprof (gfp_t gfp, +unsigned long nr_pages, +struct page **page_array); +#define alloc_pages_bulk_mempolicy (...) \ + alloc_hooks(alloc_pages_bulk_mempolicy_noprof(__VA_ARGS__)) + +#endif /* __MM_MEMPOLICY_H */
mm/shmem.c +1 -0
@@ -41,6 +41,7 @@#include <linux/swapfile.h> #include <linux/iversion.h> #include <linux/unicode.h> +#include "mempolicy.h" #include "swap.h" static struct vfsmount *shm_mnt__ro_after_init ;
mm/swap_state.c +1 -0
@@ -24,6 +24,7 @@#include <linux/shmem_fs.h> #include <linux/sysctl.h> #include "internal.h" +#include "mempolicy.h" #include "swap_table.h" #include "swap.h"
Signature · 1 line
2.54.0
Vlastimil Babka (SUSE)
maintainerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
Quoted 9 lines · Brendan Jackman
There are no external users for this surface, reduce the scope.
Ulterior motive: a later patch will add an
alloc_flagsarg to some parts of this.Note it might seem like this could just go in
internal.h, since it's pretty small, but actually it will eventually need to importpage_alloc.h, we don't want to import that frominternal.hso best to proactively created this header now.
Hmm, maybe it could just go to page_alloc.h then? After all this is just bunch of internal page allocation functions, which just take the mempolicy pointer?
Quoted 158 lines
Signed-off-by Brendan Jackman <[email protected]>--- MAINTAINERS | 1 + include/linux/gfp.h | 9 --------- mm/filemap.c | 2 ++ mm/mempolicy.c | 1 + mm/mempolicy.h | 31 +++++++++++++++++++++++++++++++ mm/shmem.c | 1 + mm/swap_state.c | 1 + 7 files changed, 37 insertions(+), 9 deletions(-)MAINTAINERS +1
-0@@ -17068,6 +17068,7 @@ F: include/uapi/linux/mempolicy.h F: include/linux/migrate.h F: include/linux/migrate_mode.h F: mm/mempolicy.c +F: mm/mempolicy.h F: mm/migrate.c F: mm/migrate_device.cinclude/linux/gfp.h +0
-9@@ -11,7 +11,6 @@#include <linux/sched.h> struct vm_area_struct ; -struct mempolicy ;/* Helper macro to avoid gfp flags if they are the default one */ #define __default_gfp (a,b,...) b@@ -274,8 +273,6 @@ struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order#ifdef CONFIG_NUMA struct page *alloc_pages_noprof (gfp_t gfp,unsigned int order);struct folio *folio_alloc_noprof (gfp_t gfp,unsigned int order); -struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid);struct folio *vma_alloc_folio_noprof (gfp_t gfp,int order,struct vm_area_struct *vma,unsigned long addr);#else @@ -287,11 +284,6 @@ static inline struct folio *folio_alloc_noprof(gfp_t gfp, unsigned int order) {return __folio_alloc_node_noprof (gfp, order,numa_node_id ()); } -static inline struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid) -{ -return folio_alloc_noprof (gfp, order); -}static inline struct folio *vma_alloc_folio_noprof (gfp_t gfp,int order,struct vm_area_struct *vma,unsigned long addr) {@@ -301,7 +293,6 @@ static inline struct folio *vma_alloc_folio_noprof(gfp_t gfp, int order,#define alloc_pages (...) alloc_hooks(alloc_pages_noprof(__VA_ARGS__))#define folio_alloc (...) alloc_hooks(folio_alloc_noprof(__VA_ARGS__)) -#define folio_alloc_mpol (...) alloc_hooks(folio_alloc_mpol_noprof(__VA_ARGS__))#define vma_alloc_folio (...) alloc_hooks(vma_alloc_folio_noprof(__VA_ARGS__))#define alloc_page (gfp_mask) alloc_pages(gfp_mask, 0)mm/filemap.c +2
-0@@ -52,6 +52,7 @@#include <asm/tlbflush.h> #include "internal.h" +#include "mempolicy.h" #define CREATE_TRACE_POINTS #include <trace/events/filemap.h> @@ -63,6 +64,7 @@#include <asm/mman.h> +#include "mempolicy.h" #include "swap.h" /* mm/mempolicy.c +1
-0@@ -119,6 +119,7 @@#include <linux/memory.h> #include "internal.h" +#include "mempolicy.h" #include "page_alloc.h" /* Internal flags */ mm/mempolicy.h new file +31
-0@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* mm-internal API for mempolicy.c. Public API lives in +* include/linux/mempolicy.h. +*/ +#ifndef __MM_MEMPOLICY_H +#define __MM_MEMPOLICY_H + +#include <linux/gfp.h> +#include <linux/mempolicy.h> + +#ifdef CONFIG_NUMA +struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, +struct mempolicy *mpol,pgoff_t ilx,int nid); +#else +static inline struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, +struct mempolicy *mpol,pgoff_t ilx,int nid) +{ +return folio_alloc_noprof (gfp, order); +} +#endif + +#define folio_alloc_mpol (...) alloc_hooks(folio_alloc_mpol_noprof(__VA_ARGS__)) + +unsigned long alloc_pages_bulk_mempolicy_noprof (gfp_t gfp, +unsigned long nr_pages, +struct page **page_array); +#define alloc_pages_bulk_mempolicy (...) \ + alloc_hooks(alloc_pages_bulk_mempolicy_noprof(__VA_ARGS__)) + +#endif /* __MM_MEMPOLICY_H */ mm/shmem.c +1
-0@@ -41,6 +41,7 @@#include <linux/swapfile.h> #include <linux/iversion.h> #include <linux/unicode.h> +#include "mempolicy.h" #include "swap.h" static struct vfsmount *shm_mnt__ro_after_init ;mm/swap_state.c +1
-0@@ -24,6 +24,7 @@#include <linux/shmem_fs.h> #include <linux/sysctl.h> #include "internal.h" +#include "mempolicy.h" #include "swap_table.h" #include "swap.h"
Brendan Jackman
reviewerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
Quoted 6 lines · Vlastimil Babka (SUSE)
Quoted 5 lines · Brendan Jackman
There are no external users for this surface, reduce the scope.
Ulterior motive: a later patch will add an
alloc_flagsarg to some parts of this.
Quoted 8 lines
Quoted 4 lines
Note it might seem like this could just go in
internal.h, since it's pretty small, but actually it will eventually need to importpage_alloc.h, we don't want to import that frominternal.hso best to proactively created this header now.Hmm, maybe it could just go to
page_alloc.hthen? After all this is just bunch of internal page allocation functions, which just take the mempolicy pointer?
That would work AFAICS, but I think it's quite tidy that, currently, all functions declared in page_alloc.h are defined in page_alloc.c. This would break that.
If you're certain you don't care about that then I could live with using page_alloc.h.
Matthew Wilcox
maintainerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
In reply to Brendan Jackmaninclude/linux/gfp.h struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order · line 278
Quoted 3 lines · Brendan Jackman
There are no external users for this surface, reduce the scope.
include/linux/gfp.h +0
-2-struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid);
Hm. So what we're saying is that allocations which respect mempolicy are only for core mm and not for, eg, device drivers to do. Is that really what we want to say? I don't think so, because that's inconsistent with having just widened __filemap_get_folio_mpol to allow guest_memfd to specify a mempolicy.
Brendan Jackman
reviewerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
Quoted 10 lines · Matthew Wilcox
include/linux/gfp.h struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order · line 278
Quoted 3 lines · Brendan Jackman
There are no external users for this surface, reduce the scope.
include/linux/gfp.h +0
-2-struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid);Hm. So what we're saying is that allocations which respect mempolicy are only for core mm and not for, eg, device drivers to do. Is that really what we want to say? I don't think so, because that's inconsistent with having just widened
__filemap_get_folio_mpolto allowguest_memfdto specify a mempolicy.
Yeah I agree, mempolicy definitely seems like a "public concept". All I'm saying here is this specific function doesn't have any external users so it doesn't need to be an external header.
... With the ulterior motive that I want to add a new parameter to it that actually _is_ mm-internal. Namely, alloc_flags, so I can add ALLOC_UNMAPPED to implement AS_NO_DIRECT_MAP, i.e. the next iteration of [0]. So basically this is
about trying to extend the allocator without creating a GFP flag.
So I'm envisaging if an external user arises for it later, we'd slap two underscores on the beginning of the internal one, (with the alloc_flags arg), and then bring back the public one as a wrapper.
Does that make sense?
Gregory Price
maintainerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
Quoted 22 lines · Brendan Jackman
Quoted 10 lines · Matthew Wilcox
include/linux/gfp.h struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order · line 278
Quoted 3 lines · Brendan Jackman
There are no external users for this surface, reduce the scope.
include/linux/gfp.h +0
-2-struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid);Hm. So what we're saying is that allocations which respect mempolicy are only for core mm and not for, eg, device drivers to do. Is that really what we want to say? I don't think so, because that's inconsistent with having just widened
__filemap_get_folio_mpolto allowguest_memfdto specify a mempolicy.Yeah I agree, mempolicy definitely seems like a "public concept". All I'm saying here is this specific function doesn't have any external users so it doesn't need to be an external header.
... With the ulterior motive that I want to add a new parameter to it that actually _is_ mm-internal. Namely,
alloc_flags, so I can addALLOC_UNMAPPEDto implementAS_NO_DIRECT_MAP, i.e. the next iteration of [0]. So basically this is
about trying to extend the allocator without creating a GFP flag.
Quoted 8 lines
So I'm envisaging if an external user arises for it later, we'd slap two underscores on the beginning of the internal one, (with the
alloc_flagsarg), and then bring back the public one as a wrapper.Does that make sense?
fwiw i've been fiddling with a module side mempolicy interface for a bit to allow a clean guest_memfd() + mempolicy() interaction [0][1].
I saw this and thought "maybe, maybe not entirely".
there is definitely some oddities in the mempolicy uapi (internal-only flags that are exposed to the uapi is odd) that some of the interface is worth internalizing.
(fyi i've converted my private node work on top of the alloc_flags
addition + new zonelists, new rfc is being posted today, your recent merges were timely).
~Gregory
[0] https://github.com/gourryinverse/linux/commit/b25bb27602fe512733450a97ac31ef4387b7e727
[1] https://github.com/gourryinverse/linux/commit/670f7dd81ef33a9385985a54b8ad6bc070b2d581
Matthew Wilcox
maintainerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
In reply to Brendan JackmanQuoted 12 lines · Brendan Jackman
Quoted 10 lines · Matthew Wilcox
include/linux/gfp.h struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order · line 278
Quoted 3 lines · Brendan Jackman
There are no external users for this surface, reduce the scope.
include/linux/gfp.h +0
-2-struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid);Hm. So what we're saying is that allocations which respect mempolicy are only for core mm and not for, eg, device drivers to do. Is that really what we want to say? I don't think so, because that's inconsistent with having just widened
__filemap_get_folio_mpolto allowguest_memfdto specify a mempolicy.
Quoted 3 lines
Yeah I agree, mempolicy definitely seems like a "public concept". All I'm saying here is this specific function doesn't have any external users so it doesn't need to be an external header.
I don't think that should be the metric for moving things to internal.h. To me, internal.h is a signifier that these interfaces should only be used by the MM. Not that "all current users are within the MM".
Quoted 5 lines
... With the ulterior motive that I want to add a new parameter to it that actually _is_ mm-internal. Namely,
alloc_flags, so I can addALLOC_UNMAPPEDto implementAS_NO_DIRECT_MAP, i.e. the next iteration of [0]. So basically this is
about trying to extend the allocator without creating a GFP flag.
Yeah. I'm not sold on the whole alloc_flags thing, but I'm too busy to sit down and think it through properly to get involved in a proper argument about how it should work.
My entirely unresearched and ill-considered opinion is that the __GFP flags should _be_ the ALLOC flags. We shoudn't be translating GFP flags into ALLOC flags that are what the allocator actually uses, the translation should be done at compile time. So if GFP_KERNEL and GFP_ATOMIC need to be composed of different flags with different semantics, then we should do that, not invent a different set of flags that special people can use for special purposes.
Quoted 5 lines
So I'm envisaging if an external user arises for it later, we'd slap two underscores on the beginning of the internal one, (with the
alloc_flagsarg), and then bring back the public one as a wrapper.Does that make sense?
We have a long history of people just moving stuff around in patches without knowing what the intent was if it should be moved.
Gregory Price
maintainerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
Quoted 11 lines · Matthew Wilcox
Quoted 6 lines
... With the ulterior motive that I want to add a new parameter to it that actually _is_ mm-internal. Namely,
alloc_flags, so I can addALLOC_UNMAPPEDto implementAS_NO_DIRECT_MAP, i.e. the next iteration of [0]. So basically this is
about trying to extend the allocator without creating a GFP flag.Yeah. I'm not sold on the whole
alloc_flagsthing, but I'm too busy to sit down and think it through properly to get involved in a proper argument about how it should work.
Quoted 8 lines
My entirely unresearched and ill-considered opinion is that the
__GFPflags should _be_ the ALLOC flags. We shoudn't be translating GFP flags into ALLOC flags that are what the allocator actually uses, the translation should be done at compile time. So ifGFP_KERNELandGFP_ATOMICneed to be composed of different flags with different semantics, then we should do that, not invent a different set of flags that special people can use for special purposes.
alloc_flags is putting me between a rock and a hard place.
I figured out a clean isolation mechanism with zonelists (new rfc is posting today, i'm doing one last proofread), but it required me to extend some of the mm/ internal interfaces with a zonelist selector.
Since Brendan's base work made it in mm-new, i decided to replace the zonelist selector with ALLOC_ZONELIST_PRIVATE as the selector to avoid *yet more* arguments.
I'll be posting with ALLOC_ZONELIST_PRIVATE on top of mm-new, but the churn is getting painful.
It really seems like we just want an mm/ internal interface that exposes struct alloc_context for specific *mm/* callers (see: compaction_context, migration_context, etc), and interfaces that keep this nonsense transparent for everyone else.
Then if you want access to alloc_context interface, you need to get export approval for that component (similar to EXPORT_FOR_MODULES).
Just spitballing here, but the churn is killing me.
~Gregory
Vlastimil Babka (SUSE)
maintainerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
In reply to Matthew WilcoxQuoted 12 lines · Matthew Wilcox
Quoted 11 lines · Brendan Jackman
Quoted 10 lines · Matthew Wilcox
include/linux/gfp.h struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order · line 278
Quoted 3 lines · Brendan Jackman
There are no external users for this surface, reduce the scope.
include/linux/gfp.h +0
-2-struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid);Hm. So what we're saying is that allocations which respect mempolicy are only for core mm and not for, eg, device drivers to do. Is that really what we want to say? I don't think so, because that's inconsistent with having just widened
__filemap_get_folio_mpolto allowguest_memfdto specify a mempolicy.
guest_memfd is practically mm internal though, IMHO.
Quoted 7 lines
Quoted 3 lines
Yeah I agree, mempolicy definitely seems like a "public concept". All I'm saying here is this specific function doesn't have any external users so it doesn't need to be an external header.
I don't think that should be the metric for moving things to
internal.h. To me,internal.his a signifier that these interfaces should only be used by the MM. Not that "all current users are within the MM".
Perhaps. It can be also useful to move them outside only when someone asks.
Quoted 9 lines
Quoted 5 lines
... With the ulterior motive that I want to add a new parameter to it that actually _is_ mm-internal. Namely,
alloc_flags, so I can addALLOC_UNMAPPEDto implementAS_NO_DIRECT_MAP, i.e. the next iteration of [0]. So basically this is
about trying to extend the allocator without creating a GFP flag.Yeah. I'm not sold on the whole
alloc_flagsthing, but I'm too busy to sit down and think it through properly to get involved in a proper argument about how it should work.
Well it's basically a workaround for limited gfp flags space. So we can extend it without making that a cost for everybody, as long as those that need the new functionality are limited.
Quoted 3 lines
My entirely unresearched and ill-considered opinion is that the
__GFPflags should _be_ the ALLOC flags. We shoudn't be translating GFP flags into ALLOC flags that are what the allocator actually uses, the
It uses both.
Quoted 1 line
translation should be done at compile time. So if
GFP_KERNELand
That would assume the gfp flags are also known at compile time, which is not always the case.
Quoted 1 line
GFP_ATOMICneed to be composed of different flags with different
The flags we are adding/considering to add are not about GFP_KERNEL vs GFP_ATOMIC context, however.
Quoted 2 lines
semantics, then we should do that, not invent a different set of flags that special people can use for special purposes.
Yep it's ugly and pragmatic, as usual. At least it's not immortalized as an UAPI, so we can deal with exploring in a wrong direction and fixing it later.
Quoted 8 lines
Quoted 5 lines
So I'm envisaging if an external user arises for it later, we'd slap two underscores on the beginning of the internal one, (with the
alloc_flagsarg), and then bring back the public one as a wrapper.Does that make sense?
We have a long history of people just moving stuff around in patches without knowing what the intent was if it should be moved.
I guess this patch is not critical to the rest, if that's an issue.
Brendan Jackman
reviewerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
Quoted 20 lines · Vlastimil Babka (SUSE)
Quoted 12 lines · Matthew Wilcox
Quoted 11 lines · Brendan Jackman
Quoted 10 lines · Matthew Wilcox
include/linux/gfp.h struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order · line 278
Quoted 3 lines · Brendan Jackman
There are no external users for this surface, reduce the scope.
include/linux/gfp.h +0
-2-struct folio *folio_alloc_mpol_noprof (gfp_t gfp,unsigned int order, -struct mempolicy *mpol,pgoff_t ilx,int nid);Hm. So what we're saying is that allocations which respect mempolicy are only for core mm and not for, eg, device drivers to do. Is that really what we want to say? I don't think so, because that's inconsistent with having just widened
__filemap_get_folio_mpolto allowguest_memfdto specify a mempolicy.
guest_memfdis practically mm internal though, IMHO.Quoted 4 lines
Quoted 3 lines
Yeah I agree, mempolicy definitely seems like a "public concept". All I'm saying here is this specific function doesn't have any external users so it doesn't need to be an external header.
Quoted 5 lines
Quoted 3 lines
I don't think that should be the metric for moving things to
internal.h. To me,internal.his a signifier that these interfaces should only be used by the MM. Not that "all current users are within the MM".Perhaps. It can be also useful to move them outside only when someone asks.
Yeah I can see this both ways. It makes sense to only expose functions to the scope that currently needs them, but I think Matthew's right that moving it to internal.h does kinda signal "this is private, don't touch this" which isn't intended.
Quoted 27 lines
Quoted 9 lines
Quoted 5 lines
... With the ulterior motive that I want to add a new parameter to it that actually _is_ mm-internal. Namely,
alloc_flags, so I can addALLOC_UNMAPPEDto implementAS_NO_DIRECT_MAP, i.e. the next iteration of [0]. So basically this is
about trying to extend the allocator without creating a GFP flag.Yeah. I'm not sold on the whole
alloc_flagsthing, but I'm too busy to sit down and think it through properly to get involved in a proper argument about how it should work.Well it's basically a workaround for limited gfp flags space. So we can extend it without making that a cost for everybody, as long as those that need the new functionality are limited.
Quoted 3 lines
My entirely unresearched and ill-considered opinion is that the
__GFPflags should _be_ the ALLOC flags. We shoudn't be translating GFP flags into ALLOC flags that are what the allocator actually uses, theIt uses both.
Quoted 1 line
translation should be done at compile time. So if
GFP_KERNELandThat would assume the gfp flags are also known at compile time, which is not always the case.
Quoted 1 line
GFP_ATOMICneed to be composed of different flags with different
Quoted 8 lines
The flags we are adding/considering to add are not about
GFP_KERNELvsGFP_ATOMICcontext, however.Quoted 2 lines
semantics, then we should do that, not invent a different set of flags that special people can use for special purposes.
Yep it's ugly and pragmatic, as usual. At least it's not immortalized as an UAPI, so we can deal with exploring in a wrong direction and fixing it later.
FWIW I suspect the "proper" design requirements are something like:
1. We want some flags that we can happily squeeze into places like struct xa_node, and other flags that we can add bits to relatively freely.
2. We want some flags that are "public" and some that are "private", although this is intentionally vaguely defined.
The current ALLOC_/GFP_ flags split is something that kinda inelegantly attempts to solve both at once even though they are actually probably orthogonal requirements. Do we care about this inelegance? I think it's pretty harmless.
Another thing that's pretty inelegant about it is that both sets of flags percolate into the allocator at once. This is quite confusing/tiresome when you are reading page_alloc.c (I tried to ameliorate that with [0]) but I don't think it has much of an architectural impact?
[0]: https://lore.kernel.org/all/[email protected]/
In the back of my mind I suspect the "neat and tidy" solution would be something like: a single flags namespace that is split into two separate enums, one "public" and one "private", and then a separate mechanism to "compress" these flags into a small number of bits. But yeah I'm just not sure working on that nice elegant cleanup would really unlock anything of practical value. Boring little cleanups like "split out this API from internal.h into its own header" seem like more useful ways to spend refactoring energy in this space.
Quite likely I'm missing potential unlocks though. E.g. maybe there's some place we currently put a gfp_t that could benefit from a "separate compression mechanism" that could usefully shrink it to 8 bits or whatever.
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines
So I'm envisaging if an external user arises for it later, we'd slap two underscores on the beginning of the internal one, (with the
alloc_flagsarg), and then bring back the public one as a wrapper.Does that make sense?
We have a long history of people just moving stuff around in patches without knowing what the intent was if it should be moved.
I guess this patch is not critical to the rest, if that's an issue.
Well, for ALLOC_UNMAPPED we really do need an alloc_flags arg for this function, but we can always just go straight to what I described above. I.e. I can create the __ variant + wrapper from the start. It's just a question of whether we prefer:
- "Yuck, there's a public wrapper here that we don't actually need", or
- "We hid this mempolicy API and people might think we'd NACK a patch to un-hide it".0
Brendan Jackman
reviewerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
On Wed Jul 22, 2026 at 3:15 PM UTC, Brendan Jackman wrote:
...
Quoted 10 lines
Quoted 4 lines
Quoted 2 lines
We have a long history of people just moving stuff around in patches without knowing what the intent was if it should be moved.
I guess this patch is not critical to the rest, if that's an issue.
Well, for
ALLOC_UNMAPPEDwe really do need analloc_flagsarg for this function, but we can always just go straight to what I described above. I.e. I can create the __ variant + wrapper from the start. It's just a question of whether we prefer:
Quoted 6 lines
- "Yuck, there's a public wrapper here that we don't actually need", or
- "We hid this mempolicy API and people might think we'd NACK a patch to un-hide it".0
Uh yeah so in v3 I did not depend on this patch, I just went straight to creating __folio_alloc_mpol_noprof() here:
https://lore.kernel.org/all/[email protected]/
So yeah I'd say we can just drop this controversial patch and move forwards with the other two?
Vlastimil Babka (SUSE)
maintainerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
Quoted 19 lines · Brendan Jackman
On Wed Jul 22, 2026 at 3:15 PM UTC, Brendan Jackman wrote:
...Quoted 10 lines
Quoted 4 lines
Quoted 2 lines
We have a long history of people just moving stuff around in patches without knowing what the intent was if it should be moved.
I guess this patch is not critical to the rest, if that's an issue.
Well, for
ALLOC_UNMAPPEDwe really do need analloc_flagsarg for this function, but we can always just go straight to what I described above. I.e. I can create the __ variant + wrapper from the start. It's just a question of whether we prefer:Quoted 6 lines
- "Yuck, there's a public wrapper here that we don't actually need", or
- "We hid this mempolicy API and people might think we'd NACK a patch to un-hide it".0
Quoted 7 lines
Uh yeah so in v3 I did not depend on this patch, I just went straight to creating
__folio_alloc_mpol_noprof()here:https://lore.kernel.org/all/[email protected]/
So yeah I'd say we can just drop this controversial patch and move forwards with the other two?
Ack.
Vlastimil Babka (SUSE)
maintainerRe: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header
In reply to Brendan JackmanQuoted 21 lines · Brendan Jackman
+++
b/mm/mempolicy.hmm/mempolicy.h new file +19
-0@@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* mm-internal API for mempolicy.c. Public API lives in +* include/linux/mempolicy.h. +*/ +#ifndef __MM_MEMPOLICY_H +#define __MM_MEMPOLICY_H + +#include <linux/gfp.h> +#include <linux/mempolicy.h> + +#ifdef CONFIG_NUMA +struct folio *folio_alloc_mpol_noprof(gfp_t gfp, unsigned int order, + struct mempolicy *mpol, pgoff_t ilx, int nid); +#else +static inline struct folio *folio_alloc_mpol_noprof(gfp_t gfp, unsigned int order, + struct mempolicy *mpol, pgoff_t ilx, int nid) +{ + return folio_alloc_noprof(gfp, order);
mm/mempolicy.h line 29
Quoted 10 lines
mm/mempolicy.h new file +10
-0+} +#endif + +#define folio_alloc_mpol (...) alloc_hooks(folio_alloc_mpol_noprof(__VA_ARGS__)) + +unsigned long alloc_pages_bulk_mempolicy_noprof (gfp_t gfp, +unsigned long nr_pages, +struct page **page_array); +#define alloc_pages_bulk_mempolicy (...) \ + alloc_hooks(alloc_pages_bulk_mempolicy_noprof(__VA_ARGS__))
BTW, seems you forgot to delete this bulk stuff from gfp.h?
Quoted 27 lines
(quoted diff) +2
-0+ +#endif /* __MM_MEMPOLICY_H */mm/shmem.c +1
-0@@ -41,6 +41,7 @@#include <linux/swapfile.h> #include <linux/iversion.h> #include <linux/unicode.h> +#include "mempolicy.h" #include "swap.h" static struct vfsmount *shm_mnt__ro_after_init ;mm/swap_state.c +1
-0@@ -24,6 +24,7 @@#include <linux/shmem_fs.h> #include <linux/sysctl.h> #include "internal.h" +#include "mempolicy.h" #include "swap_table.h" #include "swap.h"
PATCH 2/3 mm, treewide: replace __folio_alloc_node() with folio_alloc_node()
In reply to Brendan JackmanCommit 5b584d2d22dca ("mm: remove __alloc_pages_node()") removed the __ variant of alloc_pages_node(), after users had been migrated off it, since it just complicates the API (requiring users to handle NUMA_NO_NODE, or risking hotplug bugs) for no real benefit.
This patch brings __folio_alloc_node() into line too for exactly the same reasons (including the ulterior motive of freeing up the __ variant for use as an internal API).
This time, it's done as a single patch because A) the users are fewer and B) folio_alloc_node() does not already exist like alloc_pages_node() did.
No functional change intended.
--- drivers/iommu/iommu-pages.c | 9 +-------- drivers/irqchip/irq-loongarch-ir.c | 4 ++-- include/linux/gfp.h | 12 +++--------- mm/filemap.c | 2 +- mm/migrate.c | 2 +- mm/page_alloc.c | 17 +++++++++++++++-- net/sunrpc/svc.c | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-)
drivers/iommu/iommu-pages.c +1 -8
@@ -56,14 +56,7 @@ void *iommu_alloc_pages_node_sz(int nid, gfp_t gfp, size_t size)*/ order =get_order (size); -/* -* __folio_alloc_node() does not handle NUMA_NO_NODE like -* alloc_pages_node() did. -*/ -if (nid ==NUMA_NO_NODE ) - nid =numa_mem_id (); - - folio =__folio_alloc_node (gfp | __GFP_ZERO, order, nid); + folio =folio_alloc_node (gfp | __GFP_ZERO, order, nid);if (unlikely (!folio))return NULL ;
drivers/irqchip/irq-loongarch-ir.c +2 -2
@@ -384,7 +384,7 @@ static int redirect_table_init(struct redirect_desc *irde)unsigned long *bitmap;struct folio *folio; - folio =__folio_alloc_node (GFP_KERNEL | __GFP_ZERO,IRD_TABLE_PAGE_ORDER , irde->node); + folio =folio_alloc_node (GFP_KERNEL | __GFP_ZERO,IRD_TABLE_PAGE_ORDER , irde->node);if (!folio) {pr_err ("Node [%d] redirect table alloc pages failed!\n" , irde->node);return -ENOMEM ;
@@ -410,7 +410,7 @@ static int redirect_queue_init(struct redirect_desc *irde)struct redirect_queue *inv_queue = &irde->inv_queue;struct folio *folio; - folio =__folio_alloc_node (GFP_KERNEL | __GFP_ZERO,INV_QUEUE_PAGE_ORDER , irde->node); + folio =folio_alloc_node (GFP_KERNEL | __GFP_ZERO,INV_QUEUE_PAGE_ORDER , irde->node);if (!folio) {pr_err ("Node [%d] invalid queue alloc pages failed!\n" , irde->node);return -ENOMEM ;
include/linux/gfp.h +3 -9
@@ -251,15 +251,9 @@ static inline void warn_if_node_offline(int this_node, gfp_t gfp_mask)dump_stack (); } -static inline -struct folio *__folio_alloc_node_noprof (gfp_t gfp,unsigned int order,int nid) -{ -warn_if_node_offline (nid, gfp); +struct folio *folio_alloc_node_noprof (gfp_t gfp,unsigned int order,int nid); -return __folio_alloc_noprof (gfp, order, nid,NULL ); -} - -#define __folio_alloc_node (...) alloc_hooks(__folio_alloc_node_noprof(__VA_ARGS__)) +#define folio_alloc_node (...) alloc_hooks(folio_alloc_node_noprof(__VA_ARGS__))/* * Allocate pages, preferring the node given as nid. When nid == NUMA_NO_NODE,
@@ -282,7 +276,7 @@ static inline struct page *alloc_pages_noprof(gfp_t gfp_mask, unsigned int order }static inline struct folio *folio_alloc_noprof (gfp_t gfp,unsigned int order) { -return __folio_alloc_node_noprof (gfp, order,numa_node_id ()); +return folio_alloc_node_noprof (gfp, order,numa_node_id ()); }static inline struct folio *vma_alloc_folio_noprof (gfp_t gfp,int order,struct vm_area_struct *vma,unsigned long addr)
mm/filemap.c +1 -1
@@ -1007,7 +1007,7 @@ struct folio *filemap_alloc_folio_noprof(gfp_t gfp, unsigned int order,do { cpuset_mems_cookie =read_mems_allowed_begin (); n =cpuset_mem_spread_node (); - folio =__folio_alloc_node_noprof (gfp, order, n); + folio =folio_alloc_node_noprof (gfp, order, n); }while (!folio &&read_mems_allowed_retry (cpuset_mems_cookie));return folio;
mm/migrate.c +1 -1
@@ -2682,7 +2682,7 @@ static struct folio *alloc_misplaced_dst_folio(struct folio *src, __GFP_NOWARN; gfp &= ~__GFP_RECLAIM; } -return __folio_alloc_node (gfp, order, nid); +return folio_alloc_node (gfp, order, nid); }/*
mm/page_alloc.c +15 -2
@@ -5435,12 +5435,25 @@ EXPORT_SYMBOL(alloc_pages_node_noprof);struct folio *__folio_alloc_noprof (gfp_t gfp,unsigned int order,int preferred_nid,nodemask_t *nodemask) { -struct page *page =__alloc_pages_noprof (gfp | __GFP_COMP, order, - preferred_nid, nodemask,ALLOC_DEFAULT ); +struct page *page; + +if (preferred_nid ==NUMA_NO_NODE ) + preferred_nid =numa_mem_id (); + +warn_if_node_offline (preferred_nid, gfp); + + page =__alloc_pages_noprof (gfp | __GFP_COMP, order, + preferred_nid, nodemask,ALLOC_DEFAULT );return page_rmappable_folio (page); }EXPORT_SYMBOL (__folio_alloc_noprof); +struct folio *folio_alloc_node_noprof (gfp_t gfp,unsigned int order,int nid) +{ +return __folio_alloc_noprof (gfp, order, nid,NULL ); +} +EXPORT_SYMBOL (folio_alloc_node_noprof); +/* * Common helper functions. Never use with __GFP_HIGHMEM because the returned * address cannot represent highmem pages. Use alloc_pages and then kmap if
net/sunrpc/svc.c +1 -1
@@ -711,7 +711,7 @@ svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node) rqstp->rq_server = serv; rqstp->rq_pool = pool; - rqstp->rq_scratch_folio =__folio_alloc_node (GFP_KERNEL ,0 , node); + rqstp->rq_scratch_folio =folio_alloc_node (GFP_KERNEL ,0 , node);if (!rqstp->rq_scratch_folio) goto out_enomem;
Signature · 1 line
2.54.0
Brendan Jackman
reviewerRe: [PATCH 2/3] mm, treewide: replace __folio_alloc_node() with folio_alloc_node()
Quoted 1 line · Brendan Jackman
Commit
5b584d2d22dca("mm: remove__alloc_pages_node()") removed the __
Oh, I just remembered this commit hash is unstable. In fact it's already wrong.
Quoted 3 lines
variant of
alloc_pages_node(), after users had been migrated off it, since it just complicates the API (requiring users to handleNUMA_NO_NODE, or risking hotplug bugs) for no real benefit.
Re: [PATCH 2/3] mm, treewide: replace __folio_alloc_node() with folio_alloc_node()
In reply to Brendan JackmanQuoted 13 lines · Brendan Jackman
Commit
5b584d2d22dca("mm: remove__alloc_pages_node()") removed the __ variant ofalloc_pages_node(), after users had been migrated off it, since it just complicates the API (requiring users to handleNUMA_NO_NODE, or risking hotplug bugs) for no real benefit.This patch brings
__folio_alloc_node()into line too for exactly the same reasons (including the ulterior motive of freeing up the __ variant for use as an internal API).This time, it's done as a single patch because A) the users are fewer and B)
folio_alloc_node()does not already exist likealloc_pages_node()did.
Quoted 5 lines
No functional change intended.
Quoted 159 lines
--- drivers/iommu/iommu-pages.c | 9 +-------- drivers/irqchip/irq-loongarch-ir.c | 4 ++-- include/linux/gfp.h | 12 +++--------- mm/filemap.c | 2 +- mm/migrate.c | 2 +- mm/page_alloc.c | 17 +++++++++++++++-- net/sunrpc/svc.c | 2 +- 7 files changed, 24 insertions(+), 24 deletions(-)drivers/iommu/iommu-pages.c +1
-8@@ -56,14 +56,7 @@ void *iommu_alloc_pages_node_sz(int nid, gfp_t gfp, size_t size)*/ order =get_order (size); -/* -* __folio_alloc_node() does not handle NUMA_NO_NODE like -* alloc_pages_node() did. -*/ -if (nid ==NUMA_NO_NODE ) - nid =numa_mem_id (); - - folio =__folio_alloc_node (gfp | __GFP_ZERO, order, nid); + folio =folio_alloc_node (gfp | __GFP_ZERO, order, nid);if (unlikely (!folio))return NULL ;drivers/irqchip/irq-loongarch-ir.c +2
-2@@ -384,7 +384,7 @@ static int redirect_table_init(struct redirect_desc *irde)unsigned long *bitmap;struct folio *folio; - folio =__folio_alloc_node (GFP_KERNEL | __GFP_ZERO,IRD_TABLE_PAGE_ORDER , irde->node); + folio =folio_alloc_node (GFP_KERNEL | __GFP_ZERO,IRD_TABLE_PAGE_ORDER , irde->node);if (!folio) {pr_err ("Node [%d] redirect table alloc pages failed!\n" , irde->node);return -ENOMEM ;@@ -410,7 +410,7 @@ static int redirect_queue_init(struct redirect_desc *irde)struct redirect_queue *inv_queue = &irde->inv_queue;struct folio *folio; - folio =__folio_alloc_node (GFP_KERNEL | __GFP_ZERO,INV_QUEUE_PAGE_ORDER , irde->node); + folio =folio_alloc_node (GFP_KERNEL | __GFP_ZERO,INV_QUEUE_PAGE_ORDER , irde->node);if (!folio) {pr_err ("Node [%d] invalid queue alloc pages failed!\n" , irde->node);return -ENOMEM ;include/linux/gfp.h +3
-9@@ -251,15 +251,9 @@ static inline void warn_if_node_offline(int this_node, gfp_t gfp_mask)dump_stack (); } -static inline -struct folio *__folio_alloc_node_noprof (gfp_t gfp,unsigned int order,int nid) -{ -warn_if_node_offline (nid, gfp); +struct folio *folio_alloc_node_noprof (gfp_t gfp,unsigned int order,int nid); -return __folio_alloc_noprof (gfp, order, nid,NULL ); -} - -#define __folio_alloc_node (...) alloc_hooks(__folio_alloc_node_noprof(__VA_ARGS__)) +#define folio_alloc_node (...) alloc_hooks(folio_alloc_node_noprof(__VA_ARGS__))/* * Allocate pages, preferring the node given as nid. When nid == NUMA_NO_NODE, @@ -282,7 +276,7 @@ static inline struct page *alloc_pages_noprof(gfp_t gfp_mask, unsigned int order }static inline struct folio *folio_alloc_noprof (gfp_t gfp,unsigned int order) { -return __folio_alloc_node_noprof (gfp, order,numa_node_id ()); +return folio_alloc_node_noprof (gfp, order,numa_node_id ()); }static inline struct folio *vma_alloc_folio_noprof (gfp_t gfp,int order,struct vm_area_struct *vma,unsigned long addr)mm/filemap.c +1
-1@@ -1007,7 +1007,7 @@ struct folio *filemap_alloc_folio_noprof(gfp_t gfp, unsigned int order,do { cpuset_mems_cookie =read_mems_allowed_begin (); n =cpuset_mem_spread_node (); - folio =__folio_alloc_node_noprof (gfp, order, n); + folio =folio_alloc_node_noprof (gfp, order, n); }while (!folio &&read_mems_allowed_retry (cpuset_mems_cookie));return folio;mm/migrate.c +1
-1@@ -2682,7 +2682,7 @@ static struct folio *alloc_misplaced_dst_folio(struct folio *src, __GFP_NOWARN; gfp &= ~__GFP_RECLAIM; } -return __folio_alloc_node (gfp, order, nid); +return folio_alloc_node (gfp, order, nid); }/* mm/page_alloc.c +15
-2@@ -5435,12 +5435,25 @@ EXPORT_SYMBOL(alloc_pages_node_noprof);struct folio *__folio_alloc_noprof (gfp_t gfp,unsigned int order,int preferred_nid,nodemask_t *nodemask) { -struct page *page =__alloc_pages_noprof (gfp | __GFP_COMP, order, - preferred_nid, nodemask,ALLOC_DEFAULT ); +struct page *page; + +if (preferred_nid ==NUMA_NO_NODE ) + preferred_nid =numa_mem_id (); + +warn_if_node_offline (preferred_nid, gfp); + + page =__alloc_pages_noprof (gfp | __GFP_COMP, order, + preferred_nid, nodemask,ALLOC_DEFAULT );return page_rmappable_folio (page); }EXPORT_SYMBOL (__folio_alloc_noprof); +struct folio *folio_alloc_node_noprof (gfp_t gfp,unsigned int order,int nid) +{ +return __folio_alloc_noprof (gfp, order, nid,NULL ); +} +EXPORT_SYMBOL (folio_alloc_node_noprof); +/* * Common helper functions. Never use with __GFP_HIGHMEM because the returned * address cannot represent highmem pages. Use alloc_pages and then kmap if net/sunrpc/svc.c +1
-1@@ -711,7 +711,7 @@ svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node) rqstp->rq_server = serv; rqstp->rq_pool = pool; - rqstp->rq_scratch_folio =__folio_alloc_node (GFP_KERNEL ,0 , node); + rqstp->rq_scratch_folio =folio_alloc_node (GFP_KERNEL ,0 , node);if (!rqstp->rq_scratch_folio) goto out_enomem;Signature · 2 lines
-- 2.54.0
PATCH 3/3 mm: move __folio_alloc() to page_alloc.h
In reply to Brendan JackmanThis is no longer used outside of mm so reduce the scope.
Ulterior motive for the move to mm/: A later patch will add an alloc_flags arg here.
--- include/linux/gfp.h | 4 ---- mm/page_alloc.c | 1 - mm/page_alloc.h | 4 ++++ 3 files changed, 4 insertions(+), 5 deletions(-)
include/linux/gfp.h +0 -4
@@ -203,10 +203,6 @@ static inline void arch_free_page(struct page *page, int order) { }static inline void arch_alloc_page (struct page *page,int order) { }#endif -struct folio *__folio_alloc_noprof (gfp_t gfp,unsigned int order,int preferred_nid, -nodemask_t *nodemask); -#define __folio_alloc (...) alloc_hooks(__folio_alloc_noprof(__VA_ARGS__)) -unsigned long alloc_pages_bulk_noprof (gfp_t gfp,int preferred_nid,nodemask_t *nodemask,int nr_pages,struct page **page_array);
mm/page_alloc.c +0 -1
@@ -5446,7 +5446,6 @@ struct folio *__folio_alloc_noprof(gfp_t gfp, unsigned int order, int preferred_ preferred_nid, nodemask, ALLOC_DEFAULT);return page_rmappable_folio (page); } -EXPORT_SYMBOL (__folio_alloc_noprof);struct folio *folio_alloc_node_noprof (gfp_t gfp,unsigned int order,int nid) {
mm/page_alloc.h +4 -0
@@ -258,6 +258,10 @@ struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order, int preferred_n nodemask_t *nodemask, unsigned int alloc_flags);#define __alloc_pages (...) alloc_hooks(__alloc_pages_noprof(__VA_ARGS__)) +struct folio *__folio_alloc_noprof (gfp_t gfp,unsigned int order,int preferred_nid, +nodemask_t *nodemask); +#define __folio_alloc (...) alloc_hooks(__folio_alloc_noprof(__VA_ARGS__)) +extern void zone_pcp_reset (struct zone *zone);extern void zone_pcp_disable (struct zone *zone);extern void zone_pcp_enable (struct zone *zone);
Signature · 1 line
2.54.0
Re: [PATCH 3/3] mm: move __folio_alloc() to page_alloc.h
Quoted 5 lines · Brendan Jackman
This is no longer used outside of mm so reduce the scope.
Ulterior motive for the move to
mm/: A later patch will add analloc_flagsarg here.
I have a similar commit that is coming in on my next private node rfc, i'll reference this, but i wanted to make sure i hit a solid mm-new base so sashiko picks it up and people can actually apply it.
Quoted 1 line
Signed-off-by Brendan Jackman <[email protected]>