mm: misc cleanups from __GFP_UNMAPPED series
Subsystems (7)
cover mm: misc cleanups from __GFP_UNMAPPED series
In v2 of the __GFP_UNMAPPED series [0], we realised that some of the patches could potentially be merged as independent cleanups.
These are all independent of one another, if you think some are useful cleanups and others are pointless churn, it should be fine to just pick whatever subset you prefer.
No functional change intended.
[0]: https://lore.kernel.org/all/[email protected]/
---
Brendan Jackman (4):
mm: introduce for_each_free_list()
mm/page_alloc: don't overload migratetype in find_suitable_fallback()
mm: rejig pageblock mask definitions
mm/page_alloc: remove ifdefs from pindex helpers
include/linux/mmzone.h | 9 +++-- include/linux/pageblock-flags.h | 6 +-- kernel/power/snapshot.c | 8 ++-- mm/compaction.c | 3 +- mm/internal.h | 14 +++++-- mm/mm_init.c | 11 ++++-- mm/page_alloc.c | 88 +++++++++++++++++++++-------------------- 7 files changed, 79 insertions(+), 60 deletions(-)
---
base-commit: 30424114b17dd65c098749cedcaef301c1dd2f86
change-id: 20260512-page_alloc-unmapped-prep-c3ae0381d58b
Best regards,
Signature · 1 line
Brendan Jackman <[email protected]>
PATCH 1/4 mm: introduce for_each_free_list()
There are a couple of places that iterate over the freelists with awareness of the data structures' layout.
It seems ideally, code outside of mm should not be aware of the page allocator's freelists at all. But, this patch just doesn't hide them completely, it's just a meek incremental step in that direction: provide a macro to iterate over it without needing to be aware of the actual struct fields.
--- include/linux/mmzone.h | 9 ++++++--- kernel/power/snapshot.c | 8 ++++---- mm/mm_init.c | 11 +++++++---- 3 files changed, 17 insertions(+), 11 deletions(-)
include/linux/mmzone.h +6 -3
@@ -177,9 +177,12 @@ static inline bool migratetype_is_mergeable(int mt)return mt <MIGRATE_PCPTYPES ; } -#define for_each_migratetype_order (order, type) \ - for (order = 0; order < NR_PAGE_ORDERS; order++) \ - for (type = 0; type < MIGRATE_TYPES; type++) +#define for_each_free_list (list, zone, order) \ + for (order = 0; order < NR_PAGE_ORDERS; order++) \ + for (unsigned int __type = 0; \ + __type < MIGRATE_TYPES && \ + (list = &(zone)->free_area[order].free_list[__type], 1); \ + __type++)extern int page_group_by_mobility_disabled;
kernel/power/snapshot.c +4 -4
@@ -1244,8 +1244,9 @@ unsigned int snapshot_additional_pages(struct zone *zone)static void mark_free_pages (struct zone *zone) {unsigned long pfn, max_zone_pfn, page_count =WD_PAGE_COUNT ; +struct list_head *free_list;unsigned long flags; -unsigned int order, t; +unsigned int order;struct page *page;if (zone_is_empty (zone))
@@ -1269,9 +1270,8 @@ static void mark_free_pages(struct zone *zone)swsusp_unset_page_free (page); } -for_each_migratetype_order (order, t) { -list_for_each_entry (page, - &zone->free_area[order].free_list[t], buddy_list) { +for_each_free_list (free_list, zone, order) { +list_for_each_entry (page, free_list, buddy_list) {unsigned long i; pfn =page_to_pfn (page);
mm/mm_init.c +7 -4
@@ -1429,11 +1429,14 @@ static void __meminit zone_init_internals(struct zone *zone, enum zone_type idx,static void __meminit zone_init_free_lists (struct zone *zone) { -unsigned int order, t; -for_each_migratetype_order (order, t) { -INIT_LIST_HEAD (&zone->free_area[order].free_list[t]); +struct list_head *list; +unsigned int order; + +for_each_free_list (list, zone, order) +INIT_LIST_HEAD (list); + +for (order =0 ; order <NR_PAGE_ORDERS ; order++) zone->free_area[order].nr_free =0 ; - }#ifdef CONFIG_UNACCEPTED_MEMORY INIT_LIST_HEAD (&zone->unaccepted_pages);
Signature · 1 line
2.51.2
Re: [PATCH 1/4] mm: introduce for_each_free_list()
Quoted 9 lines · Brendan Jackman
There are a couple of places that iterate over the freelists with awareness of the data structures' layout.
It seems ideally, code outside of mm should not be aware of the page allocator's freelists at all. But, this patch just doesn't hide them completely, it's just a meek incremental step in that direction: provide a macro to iterate over it without needing to be aware of the actual struct fields.
Quoted 4 lines
Signed-off-by Brendan Jackman <[email protected]>--- include/linux/mmzone.h | 9 ++++++--- kernel/power/snapshot.c | 8 ++++----
looks scary what it does with zones and pages :/
Quoted 1 line
mm/mm_init.c | 11 +++++++----
Quoted 1 line
3 files changed, 17 insertions(+), 11 deletions(-)
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH 1/4] mm: introduce for_each_free_list()
In reply to Brendan JackmanQuoted 10 lines · Brendan Jackman
There are a couple of places that iterate over the freelists with awareness of the data structures' layout.
It seems ideally, code outside of mm should not be aware of the page allocator's freelists at all. But, this patch just doesn't hide them completely, it's just a meek incremental step in that direction: provide a macro to iterate over it without needing to be aware of the actual struct fields.
Signed-off-by Brendan Jackman <[email protected]>
PATCH 2/4 mm/page_alloc: don't overload migratetype in find_suitable_fallback()
In reply to Brendan JackmanThis function currently returns a signed integer that encodes status in-band, as negative numbers, along with a migratetype. Switch to a more explicit/verbose style that encodes the status and migratetype separately.
In the spirit of making things more explicit, also create an enum to avoid using magic integer literals with special meanings. This enables documenting the values at their definition instead of in one of the callers.
--- mm/compaction.c | 3 ++- mm/internal.h | 14 +++++++++++--- mm/page_alloc.c | 40 +++++++++++++++++++++++----------------- 3 files changed, 36 insertions(+), 21 deletions(-)
mm/compaction.c +2 -1
@@ -2340,7 +2340,8 @@ static enum compact_result __compact_finished(struct compact_control *cc)* Job done if allocation would steal freepages from * other migratetype buddy lists. */ -if (find_suitable_fallback (area, order, migratetype, true) >=0 ) +if (find_suitable_fallback (area, order, migratetype, true,NULL ) + ==FALLBACK_FOUND )/* * Movable pages are OK in any pageblock. If we are * stealing for a non-movable allocation, make sure
mm/internal.h +11 -3
@@ -1104,9 +1104,17 @@ static inline void init_cma_pageblock(struct page *page) }#endif - -int find_suitable_fallback (struct free_area *area,unsigned int order, -int migratetype,bool claimable); +enum fallback_result { +/* Found suitable migratetype, *mt_out is valid. */ +FALLBACK_FOUND , +/* No fallback found in requested order. */ +FALLBACK_EMPTY , +/* Passed @claimable, but claiming whole block is a bad idea. */ +FALLBACK_NOCLAIM , +}; +enum fallback_result +find_suitable_fallback (struct free_area *area,unsigned int order, +int migratetype,bool claimable,int *mt_out);static inline bool free_area_empty (struct free_area *area,int migratetype) {
mm/page_alloc.c +23 -17
@@ -2249,25 +2249,29 @@ static bool should_try_claim_block(unsigned int order, int start_mt)* we would do this whole-block claiming. This would help to reduce * fragmentation due to mixed migratetype pages in one pageblock. */ -int find_suitable_fallback (struct free_area *area,unsigned int order, -int migratetype,bool claimable) +enum fallback_result +find_suitable_fallback (struct free_area *area,unsigned int order, +int migratetype,bool claimable,int *mt_out) {int i;if (claimable && !should_try_claim_block (order, migratetype)) -return -2 ; +return FALLBACK_NOCLAIM ;if (area->nr_free ==0 ) -return -1 ; +return FALLBACK_EMPTY ;for (i =0 ; i <MIGRATE_PCPTYPES -1 ; i++) {int fallback_mt = fallbacks[migratetype][i]; -if (!free_area_empty (area, fallback_mt)) -return fallback_mt; +if (!free_area_empty (area, fallback_mt)) { +if (mt_out) + *mt_out = fallback_mt; +return FALLBACK_FOUND ; + } } -return -1 ; +return FALLBACK_EMPTY ; }/*
@@ -2377,16 +2381,16 @@ __rmqueue_claim(struct zone *zone, int order, int start_migratetype,*/ for (current_order =MAX_PAGE_ORDER ; current_order >= min_order; --current_order) { - area = &(zone->free_area[current_order]); - fallback_mt =find_suitable_fallback (area, current_order, - start_migratetype, true); +enum fallback_result result; -/* No block in that order */ -if (fallback_mt ==-1 ) + area = &(zone->free_area[current_order]); + result =find_suitable_fallback (area, current_order, + start_migratetype, true, &fallback_mt); + +if (result ==FALLBACK_EMPTY )continue ; -/* Advanced into orders too low to claim, abort */ -if (fallback_mt ==-2 ) +if (result ==FALLBACK_NOCLAIM )break ; page =get_page_from_free_area (area, fallback_mt);
@@ -2416,10 +2420,12 @@ __rmqueue_steal(struct zone *zone, int order, int start_migratetype)int fallback_mt;for (current_order = order; current_order <NR_PAGE_ORDERS ; current_order++) { +enum fallback_result result; + area = &(zone->free_area[current_order]); - fallback_mt =find_suitable_fallback (area, current_order, - start_migratetype, false); -if (fallback_mt ==-1 ) + result =find_suitable_fallback (area, current_order, start_migratetype, + false, &fallback_mt); +if (result ==FALLBACK_EMPTY )continue ; page =get_page_from_free_area (area, fallback_mt);
Signature · 1 line
2.51.2
PATCH 3/4 mm: rejig pageblock mask definitions
In reply to Brendan Jackman- Add a PAGEBLOCK_ prefix to the names to avoid polluting the "global namespace" too much.
- This new prefix makes MIGRATETYPE_AND_ISO_MASK look pretty long. Well, that global mask only exists for quite a specific purpose, and is quite a weird thing to have a name for anyway. So drop it and take advantage of the newly-defined PAGEBLOCK_ISO_MASK.
--- include/linux/pageblock-flags.h | 6 +++--- mm/page_alloc.c | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-)
include/linux/pageblock-flags.h +3 -3
@@ -36,12 +36,12 @@ enum pageblock_bits {#define NR_PAGEBLOCK_BITS (roundup_pow_of_two(__NR_PAGEBLOCK_BITS)) -#define MIGRATETYPE_MASK (BIT(PB_migrate_0)|BIT(PB_migrate_1)|BIT(PB_migrate_2)) +#define PAGEBLOCK_MIGRATETYPE_MASK (BIT(PB_migrate_0)|BIT(PB_migrate_1)|BIT(PB_migrate_2))#ifdef CONFIG_MEMORY_ISOLATION -#define MIGRATETYPE_AND_ISO_MASK (MIGRATETYPE_MASK | BIT(PB_migrate_isolate)) +#define PAGEBLOCK_ISO_MASK BIT(PB_migrate_isolate)#else -#define MIGRATETYPE_AND_ISO_MASK MIGRATETYPE_MASK +#define PAGEBLOCK_ISO_MASK 0#endif #if defined(CONFIG_HUGETLB_PAGE )
mm/page_alloc.c +9 -9
@@ -364,7 +364,7 @@ get_pfnblock_bitmap_bitidx(const struct page *page, unsigned long pfn,#else BUILD_BUG_ON (NR_PAGEBLOCK_BITS !=4 );#endif -BUILD_BUG_ON (__MIGRATE_TYPE_END >MIGRATETYPE_MASK ); +BUILD_BUG_ON (__MIGRATE_TYPE_END >PAGEBLOCK_MIGRATETYPE_MASK );VM_BUG_ON_PAGE (!zone_spans_pfn (page_zone (page), pfn), page); bitmap =get_pageblock_bitmap (page, pfn);
@@ -437,7 +437,7 @@ bool get_pfnblock_bit(const struct page *page, unsigned long pfn, __always_inline enum migratetypeget_pfnblock_migratetype (const struct page *page,unsigned long pfn) { -unsigned long mask =MIGRATETYPE_AND_ISO_MASK ; +unsigned long mask =PAGEBLOCK_MIGRATETYPE_MASK |PAGEBLOCK_ISO_MASK ;unsigned long flags; flags =__get_pfnblock_flags_mask (page, pfn, mask);
@@ -446,7 +446,7 @@ get_pfnblock_migratetype(const struct page *page, unsigned long pfn)if (flags &BIT (PB_migrate_isolate))return MIGRATE_ISOLATE ;#endif -return flags &MIGRATETYPE_MASK ; +return flags &PAGEBLOCK_MIGRATETYPE_MASK ; }/**
@@ -534,11 +534,11 @@ static void set_pageblock_migratetype(struct page *page, }VM_WARN_ONCE (get_pageblock_isolate (page),"Use clear_pageblock_isolate() to unisolate pageblock" ); -/* MIGRATETYPE_AND_ISO_MASK clears PB_migrate_isolate if it is set */ +/* PAGEBLOCK_ISO_MASK clears PB_migrate_isolate if it is set */ #endif __set_pfnblock_flags_mask (page,page_to_pfn (page), (unsigned long )migratetype, -MIGRATETYPE_AND_ISO_MASK ); +PAGEBLOCK_MIGRATETYPE_MASK |PAGEBLOCK_ISO_MASK ); } void __meminit init_pageblock_migratetype(struct page *page,
@@ -564,7 +564,7 @@ void __meminit init_pageblock_migratetype(struct page *page, flags |=BIT (PB_migrate_isolate);#endif __set_pfnblock_flags_mask (page,page_to_pfn (page), flags, -MIGRATETYPE_AND_ISO_MASK ); +PAGEBLOCK_MIGRATETYPE_MASK |PAGEBLOCK_ISO_MASK ); }#ifdef CONFIG_DEBUG_VM
@@ -2130,15 +2130,15 @@ static bool __move_freepages_block_isolate(struct zone *zone, } move: -/* Use MIGRATETYPE_MASK to get non-isolate migratetype */ +/* Use PAGEBLOCK_MIGRATETYPE_MASK to get non-isolate migratetype */ if (isolate) { from_mt =__get_pfnblock_flags_mask (page,page_to_pfn (page), -MIGRATETYPE_MASK ); +PAGEBLOCK_MIGRATETYPE_MASK ); to_mt =MIGRATE_ISOLATE ; }else { from_mt =MIGRATE_ISOLATE ; to_mt =__get_pfnblock_flags_mask (page,page_to_pfn (page), -MIGRATETYPE_MASK ); +PAGEBLOCK_MIGRATETYPE_MASK ); }__move_freepages_block (zone, start_pfn, from_mt, to_mt);
Signature · 1 line
2.51.2
PATCH 4/4 mm/page_alloc: remove ifdefs from pindex helpers
In reply to Brendan JackmanThe ifdefs are not technically needed here, everything used here is always defined.
Switching to IS_ENABLED() makes the code a bit less tiresome to read.
--- mm/page_alloc.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
mm/page_alloc.c +14 -16
@@ -650,19 +650,17 @@ static void bad_page(struct page *page, const char *reason)static inline unsigned int order_to_pindex (int migratetype,int order) { +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) { +bool movable = migratetype ==MIGRATE_MOVABLE ; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -bool movable; -if (order >PAGE_ALLOC_COSTLY_ORDER ) { -VM_BUG_ON (!is_pmd_order (order)); +if (order >PAGE_ALLOC_COSTLY_ORDER ) { +VM_BUG_ON (!is_pmd_order (order)); - movable = migratetype ==MIGRATE_MOVABLE ; - -return NR_LOWORDER_PCP_LISTS + movable; +return NR_LOWORDER_PCP_LISTS + movable; + } + }else { +VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); } -#else -VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); -#endif return (MIGRATE_PCPTYPES * order) + migratetype; }
@@ -671,12 +669,12 @@ static inline int pindex_to_order(unsigned int pindex) {int order = pindex /MIGRATE_PCPTYPES ; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -if (pindex >=NR_LOWORDER_PCP_LISTS ) - order =HPAGE_PMD_ORDER ; -#else -VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); -#endif +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) { +if (pindex >=NR_LOWORDER_PCP_LISTS ) + order =HPAGE_PMD_ORDER ; + }else { +VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); + }return order; }
Signature · 1 line
2.51.2
Vlastimil Babka (SUSE)
maintainerRe: [PATCH 4/4] mm/page_alloc: remove ifdefs from pindex helpers
Quoted 30 lines · Brendan Jackman
The ifdefs are not technically needed here, everything used here is always defined.
Switching to
IS_ENABLED()makes the code a bit less tiresome to read.Reviewed-by Vlastimil Babka (SUSE) <[email protected]>Signed-off-by Brendan Jackman <[email protected]>--- mm/page_alloc.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)mm/page_alloc.c +4
-5@@ -650,19 +650,17 @@ static void bad_page(struct page *page, const char *reason)static inline unsigned int order_to_pindex (int migratetype,int order) { +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) { +bool movable = migratetype ==MIGRATE_MOVABLE ; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -bool movable; -if (order >PAGE_ALLOC_COSTLY_ORDER ) { -VM_BUG_ON (!is_pmd_order (order)); +if (order >PAGE_ALLOC_COSTLY_ORDER ) { +VM_BUG_ON (!is_pmd_order (order)); - movable = migratetype ==MIGRATE_MOVABLE ;
mm/page_alloc.c static void bad_page(struct page *page, const char *reason) · line 665
Quoted 10 lines
mm/page_alloc.c +4
-5- - return NR_LOWORDER_PCP_LISTS + movable; +return NR_LOWORDER_PCP_LISTS + movable; + } + }else { +VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); } -#else -VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); -#endif
Uh yeah, VM_BUG_ONs are frowned upon now. But doing a VM_WARN_ON_ONCE here makes little sense. There's no safe fallback if we end up here with a wrong value. And it's all internal to page alloc so I'd just drop those checks completely at this point.
Quoted 22 lines
mm/page_alloc.c +6
-6return (MIGRATE_PCPTYPES * order) + migratetype; }@@ -671,12 +669,12 @@ static inline int pindex_to_order(unsigned int pindex) {int order = pindex /MIGRATE_PCPTYPES ; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -if (pindex >=NR_LOWORDER_PCP_LISTS ) - order =HPAGE_PMD_ORDER ; -#else -VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); -#endif +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) { +if (pindex >=NR_LOWORDER_PCP_LISTS ) + order =HPAGE_PMD_ORDER ; + }else { +VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); + }return order; }
Re: [PATCH 4/4] mm/page_alloc: remove ifdefs from pindex helpers
Quoted 30 lines · Vlastimil Babka (SUSE)
Quoted 29 lines · Brendan Jackman
The ifdefs are not technically needed here, everything used here is always defined.
Switching to
IS_ENABLED()makes the code a bit less tiresome to read.Reviewed-by Vlastimil Babka (SUSE) <[email protected]>Signed-off-by Brendan Jackman <[email protected]>--- mm/page_alloc.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)mm/page_alloc.c +4
-4@@ -650,19 +650,17 @@ static void bad_page(struct page *page, const char *reason)static inline unsigned int order_to_pindex (int migratetype,int order) { +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) { +bool movable = migratetype ==MIGRATE_MOVABLE ; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -bool movable; -if (order >PAGE_ALLOC_COSTLY_ORDER ) { -VM_BUG_ON (!is_pmd_order (order)); +if (order >PAGE_ALLOC_COSTLY_ORDER ) { +VM_BUG_ON (!is_pmd_order (order));
Quoted 15 lines
mm/page_alloc.c static void bad_page(struct page *page, const char *reason) · line 665
Quoted 11 lines
mm/page_alloc.c +4
-6- movable = migratetype ==MIGRATE_MOVABLE ; - - return NR_LOWORDER_PCP_LISTS + movable; +return NR_LOWORDER_PCP_LISTS + movable; + } + }else { +VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); } -#else -VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); -#endif Uh yeah,
VM_BUG_ONsare frowned upon now. But doing aVM_WARN_ON_ONCEhere makes little sense. There's no safe fallback if we end up here with a wrong value.
Isn't that grounds for upgrading them to a real BUG then? My experience has been (I broke this code lots of times lol, I REALLY struggle with this arithmetic stuff) if something goes wrong here the machine quickly gets irrevocably and undebuggably borked. Crashing is the best case scenario.
Quoted 2 lines
And it's all internal to page alloc so I'd just drop those checks completely at this point.
But, I won't die on the above hill, if people really hate BUG that much happy to go with the flow.
In that case, I'd suggest we drop them as a separate patch.
Vlastimil Babka (SUSE)
maintainerRe: [PATCH 4/4] mm/page_alloc: remove ifdefs from pindex helpers
Quoted 8 lines · Brendan Jackman
Quoted 5 lines · Vlastimil Babka (SUSE)
On 5/13/26 14:35, Brendan Jackman wrote:
Uh yeah,
VM_BUG_ONsare frowned upon now. But doing aVM_WARN_ON_ONCEhere makes little sense. There's no safe fallback if we end up here with a wrong value.Isn't that grounds for upgrading them to a real BUG then? My experience
If Linus noticed, there would be yelling :)
Quoted 4 lines
has been (I broke this code lots of times lol, I REALLY struggle with this arithmetic stuff) if something goes wrong here the machine quickly gets irrevocably and undebuggably borked. Crashing is the best case scenario.
Yeah it will crash quickly anyway if you mess it up. I guess if the check would help you find more quickly what you messed up, a VM_WARN_ON_ONCE would still have some value even if it can't avoid the imminent disaster. So maybe just switch it to that.
Quoted 7 lines
Quoted 2 lines
And it's all internal to page alloc so I'd just drop those checks completely at this point.
But, I won't die on the above hill, if people really hate BUG that much happy to go with the flow.
In that case, I'd suggest we drop them as a separate patch.
PATCH v2 1/1 mm/page_alloc: tidy up pindex helpers
In reply to Vlastimil Babka (SUSE)The ifdefs are not technically needed here, everything used here is always defined, so switch to IS_ENABLED() to make things a little less tiresome to read.
Also, Vlastimil pointed out that the VM_BUG_ON()s have fallen out of favour, so remove them.
---
Quoted 7 lines
Quoted 2 lines
And it's all internal to page alloc so I'd just drop those checks completely at this point.
But, I won't die on the above hill, if people really hate BUG that much happy to go with the flow.
In that case, I'd suggest we drop them as a separate patch.
Oh, actually no, the VM_BUG_ONs were the main thing making the ifdefs awkward, it makes sense to drop them together. Here's a combined patch.
mm/page_alloc.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-)
mm/page_alloc.c +8 -17
@@ -650,19 +650,12 @@ static void bad_page(struct page *page, const char *reason)static inline unsigned int order_to_pindex (int migratetype,int order) { +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) { +bool movable = migratetype ==MIGRATE_MOVABLE ; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -bool movable; -if (order >PAGE_ALLOC_COSTLY_ORDER ) { -VM_BUG_ON (!is_pmd_order (order)); - - movable = migratetype ==MIGRATE_MOVABLE ; - -return NR_LOWORDER_PCP_LISTS + movable; +if (order >PAGE_ALLOC_COSTLY_ORDER ) +return NR_LOWORDER_PCP_LISTS + movable; } -#else -VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); -#endif return (MIGRATE_PCPTYPES * order) + migratetype; }
@@ -671,12 +664,10 @@ static inline int pindex_to_order(unsigned int pindex) {int order = pindex /MIGRATE_PCPTYPES ; -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -if (pindex >=NR_LOWORDER_PCP_LISTS ) - order =HPAGE_PMD_ORDER ; -#else -VM_BUG_ON (order >PAGE_ALLOC_COSTLY_ORDER ); -#endif +if (IS_ENABLED (CONFIG_TRANSPARENT_HUGEPAGE )) { +if (pindex >=NR_LOWORDER_PCP_LISTS ) + order =HPAGE_PMD_ORDER ; + }return order; }
Signature · 1 line
2.51.2
Andrew Morton
maintainerQuoted 8 lines · On Wed, 13 May 2026 12:35:12 +0000 Brendan Jackman <[email protected]> wrote:
In v2 of the
__GFP_UNMAPPEDseries [0], we realised that some of the patches could potentially be merged as independent cleanups.These are all independent of one another, if you think some are useful cleanups and others are pointless churn, it should be fine to just pick whatever subset you prefer.
No functional change intended.
Thanks, Brendan. I added this to mm.git's mm-new branch for testing, along with a note that [4/4] may be getting an update arising from Vlastimil's feedback.
Quoted 9 lines · Andrew Morton
Quoted 7 lines · On Wed, 13 May 2026 12:35:12 +0000 Brendan Jackman <[email protected]> wrote:
In v2 of the
__GFP_UNMAPPEDseries [0], we realised that some of the patches could potentially be merged as independent cleanups.These are all independent of one another, if you think some are useful cleanups and others are pointless churn, it should be fine to just pick whatever subset you prefer.
Quoted 5 lines
Quoted 1 line
No functional change intended.
Thanks, Brendan. I added this to mm.git's mm-new branch for testing, along with a note that [4/4] may be getting an update arising from Vlastimil's feedback.
Cool thanks, (also I got the "added to mm-new branch notification" and realised why I missed it last time, broken mail filter).
The 4/4 update is already up, in reply to the thread.
Andrew Morton
maintainerQuoted 12 lines · On Mon, 18 May 2026 20:20:50 +0000 Brendan Jackman <[email protected]> wrote:
Quoted 11 lines · Andrew Morton
Quoted 8 lines · On Wed, 13 May 2026 12:35:12 +0000 Brendan Jackman <[email protected]> wrote:
In v2 of the
__GFP_UNMAPPEDseries [0], we realised that some of the patches could potentially be merged as independent cleanups.These are all independent of one another, if you think some are useful cleanups and others are pointless churn, it should be fine to just pick whatever subset you prefer.
No functional change intended.
Quoted 8 lines
Quoted 3 lines
Thanks, Brendan. I added this to mm.git's mm-new branch for testing, along with a note that [4/4] may be getting an update arising from Vlastimil's feedback.
Cool thanks, (also I got the "added to mm-new branch notification" and realised why I missed it last time, broken mail filter).
The 4/4 update is already up, in reply to the thread.
Is that "mm/page_alloc: tidy up pindex helpers"?
For some reason I didn't receive that email, directly or via any mailing list. I do have the similar "mm/page_alloc: remove ifdefs from pindex helpers" from May 13.
Oh well, please check tomorrow's mm.git and send along whatever is needed?
Quoted 22 lines · Andrew Morton
Quoted 19 lines · On Mon, 18 May 2026 20:20:50 +0000 Brendan Jackman <[email protected]> wrote:
Quoted 9 lines · Andrew Morton
Quoted 7 lines · On Wed, 13 May 2026 12:35:12 +0000 Brendan Jackman <[email protected]> wrote:
In v2 of the
__GFP_UNMAPPEDseries [0], we realised that some of the patches could potentially be merged as independent cleanups.These are all independent of one another, if you think some are useful cleanups and others are pointless churn, it should be fine to just pick whatever subset you prefer.
Quoted 5 lines
Quoted 1 line
No functional change intended.
Thanks, Brendan. I added this to mm.git's mm-new branch for testing, along with a note that [4/4] may be getting an update arising from Vlastimil's feedback.
Cool thanks, (also I got the "added to mm-new branch notification" and realised why I missed it last time, broken mail filter).
Quoted 7 lines
Quoted 1 line
The 4/4 update is already up, in reply to the thread.
Is that "
mm/page_alloc: tidy up pindex helpers"?For some reason I didn't receive that email, directly or via any mailing list. I do have the similar "
mm/page_alloc: remove ifdefs from pindex helpers" from May 13.
Ooh, that's unfortunate... I used git-send-email directl to send that, which is not how I work most of the time, so I suspect something went wrong with that particular setup. Will keep an eye on that.
Quoted 2 lines
Oh well, please check tomorrow's mm.git and send along whatever is needed?
Ack, thanks again.
Vlastimil Babka (SUSE)
maintainerQuoted 23 lines · Brendan Jackman
Quoted 22 lines · Andrew Morton
Quoted 19 lines · On Mon, 18 May 2026 20:20:50 +0000 Brendan Jackman <[email protected]> wrote:
Quoted 9 lines · Andrew Morton
Quoted 7 lines · On Wed, 13 May 2026 12:35:12 +0000 Brendan Jackman <[email protected]> wrote:
In v2 of the
__GFP_UNMAPPEDseries [0], we realised that some of the patches could potentially be merged as independent cleanups.These are all independent of one another, if you think some are useful cleanups and others are pointless churn, it should be fine to just pick whatever subset you prefer.
Quoted 5 lines
Quoted 1 line
No functional change intended.
Thanks, Brendan. I added this to mm.git's mm-new branch for testing, along with a note that [4/4] may be getting an update arising from Vlastimil's feedback.
Cool thanks, (also I got the "added to mm-new branch notification" and realised why I missed it last time, broken mail filter).
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
The 4/4 update is already up, in reply to the thread.
Is that "
mm/page_alloc: tidy up pindex helpers"?For some reason I didn't receive that email, directly or via any mailing list. I do have the similar "
mm/page_alloc: remove ifdefs from pindex helpers" from May 13.
Found it, seems to be threaded well with In-reply-to: too, maybe it's the different subject?
https://lore.kernel.org/all/[email protected]/
Should be fine to replace the current "mm/page_alloc: remove ifdefs from pindex helpers" in mm.git with that.
Quoted 8 lines
Ooh, that's unfortunate... I used git-send-email directl to send that, which is not how I work most of the time, so I suspect something went wrong with that particular setup. Will keep an eye on that.
Quoted 2 lines
Oh well, please check tomorrow's mm.git and send along whatever is needed?
Ack, thanks again.
Andrew Morton
maintainerQuoted 11 lines · On Fri, 22 May 2026 09:59:49 +0200 "Vlastimil Babka (SUSE)"…
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Cool thanks, (also I got the "added to mm-new branch notification" and realised why I missed it last time, broken mail filter).
The 4/4 update is already up, in reply to the thread.
Is that "
mm/page_alloc: tidy up pindex helpers"?For some reason I didn't receive that email, directly or via any mailing list. I do have the similar "
mm/page_alloc: remove ifdefs from pindex helpers" from May 13.
Quoted 7 lines
Found it, seems to be threaded well with In-reply-to: too, maybe it's the different subject?
https://lore.kernel.org/all/[email protected]/
Should be fine to replace the current "
mm/page_alloc: remove ifdefs from pindex helpers" in mm.git with that.
I could attempt to do that by my confidence that I got it right would be low.
Brendan, please send us a v2 of the series "mm: misc cleanups from __GFP_UNMAPPED series", thanks.
Brendan Jackman
reviewerQuoted 18 lines · Andrew Morton
Quoted 16 lines · On Fri, 22 May 2026 09:59:49 +0200 "Vlastimil Babka (SUSE)"…
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
Cool thanks, (also I got the "added to mm-new branch notification" and realised why I missed it last time, broken mail filter).
The 4/4 update is already up, in reply to the thread.
Is that "
mm/page_alloc: tidy up pindex helpers"?For some reason I didn't receive that email, directly or via any mailing list. I do have the similar "
mm/page_alloc: remove ifdefs from pindex helpers" from May 13.Found it, seems to be threaded well with In-reply-to: too, maybe it's the different subject?
Quoted 8 lines
Quoted 2 lines
Should be fine to replace the current "
mm/page_alloc: remove ifdefs from pindex helpers" in mm.git with that.I could attempt to do that by my confidence that I got it right would be low.
Brendan, please send us a v2 of the series "mm: misc cleanups from
__GFP_UNMAPPEDseries", thanks.
Sorry for the delay, was travelling - it looks like you have already applied the current patches, I will send a separate patch to remove the VM_BUG_ONs.