This is the basic implementation improved by later patches. Later patches moves the new field to a dynamically allocated page_autonuma taking 2 bytes per page (only allocated if booted on NUMA hardware, unless "noautonuma" is passed as parameter to the kernel at boot). Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx> --- include/linux/mm_types.h | 11 +++++++++++ mm/page_alloc.c | 3 +++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index c80101c..9e8398a 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -152,6 +152,17 @@ struct page { struct page *first_page; /* Compound tail pages */ }; +#ifdef CONFIG_AUTONUMA + /* + * FIXME: move to pgdat section along with the memcg and allocate + * at runtime only in presence of a numa system. + */ +#if MAX_NUMNODES > 32767 +#error "too many nodes" +#endif + short autonuma_last_nid; +#endif + /* * On machines where all RAM is mapped into kernel address space, * we can simply calculate the virtual address. On machines with diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 77845f9..a9b18bc 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3793,6 +3793,9 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, set_pageblock_migratetype(page, MIGRATE_MOVABLE); INIT_LIST_HEAD(&page->lru); +#ifdef CONFIG_AUTONUMA + page->autonuma_last_nid = -1; +#endif #ifdef WANT_PAGE_VIRTUAL /* The shift won't overflow because ZONE_NORMAL is below 4G. */ if (!is_highmem_idx(zone)) -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>