Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/page_alloc: use xxx_pageblock_isolate() for better reading

Patch series "mm/pageblock: improve readability of some pageblock
handling", v3.

During code reading, found two possible points to improve the readability
of pageblock handling.

Patch 1: isolate bit is standalone and there are dedicated helpers.
Instead of check the bit directly, we could use the helper to do it.

Patch 2: remove PB_migratetype_bits and PB_migrate_end to reduce magical
computation.


This patch (of 2):

Since commit e904bce2d9d4 ("mm/page_isolation: make page isolation a
standalone bit"), it provides dedicated helper to handle isolation.

Change to use these helpers to be better reading.

No functional change intended.

Link: https://lkml.kernel.org/r/20250827070105.16864-1-richard.weiyang@gmail.com
Link: https://lkml.kernel.org/r/20250827070105.16864-2-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Zi Yan <ziy@nvidia.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: David Hildenbrand <david@redhat.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Wei Yang and committed by
Andrew Morton
dd3b304b b5510282

+3 -4
+3 -4
mm/page_alloc.c
··· 538 538 "Use set_pageblock_isolate() for pageblock isolation"); 539 539 return; 540 540 } 541 - VM_WARN_ONCE(get_pfnblock_bit(page, page_to_pfn(page), 542 - PB_migrate_isolate), 541 + VM_WARN_ONCE(get_pageblock_isolate(page), 543 542 "Use clear_pageblock_isolate() to unisolate pageblock"); 544 543 /* MIGRATETYPE_AND_ISO_MASK clears PB_migrate_isolate if it is set */ 545 544 #endif ··· 2057 2058 static inline void toggle_pageblock_isolate(struct page *page, bool isolate) 2058 2059 { 2059 2060 if (isolate) 2060 - set_pfnblock_bit(page, page_to_pfn(page), PB_migrate_isolate); 2061 + set_pageblock_isolate(page); 2061 2062 else 2062 - clear_pfnblock_bit(page, page_to_pfn(page), PB_migrate_isolate); 2063 + clear_pageblock_isolate(page); 2063 2064 } 2064 2065 2065 2066 /**