[PATCH] mm: fix set pageblock migratetype when boot
From: Xishi Qiu
Date: Fri Jun 26 2015 - 06:09:42 EST
memmap_init_zone()
...
if ((z->zone_start_pfn <= pfn)
&& (pfn < zone_end_pfn(z))
&& !(pfn & (pageblock_nr_pages - 1)))
set_pageblock_migratetype(page, MIGRATE_MOVABLE);
...
If the pfn does not align to pageblock, it will not init the migratetype.
So call it for every page, it will takes more time, but it doesn't matter,
this function will be called only in boot or hotadd memory.
e.g.
[ 223.679446] node 0: [mem 0x00001000-0x00099fff]
[ 223.679449] node 0: [mem 0x00100000-0xbf78ffff]
[ 223.680486] node 0: [mem 0x100000000-0x27fffffff]
Signed-off-by: Xishi Qiu <qiuxishi@xxxxxxxxxx>
---
mm/page_alloc.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ebffa0e..a1df227 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4210,8 +4210,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
* pfn out of zone.
*/
if ((z->zone_start_pfn <= pfn)
- && (pfn < zone_end_pfn(z))
- && !(pfn & (pageblock_nr_pages - 1)))
+ && (pfn < zone_end_pfn(z)))
set_pageblock_migratetype(page, MIGRATE_MOVABLE);
INIT_LIST_HEAD(&page->lru);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/