move free page back to MIGRATE_MOVABLE?
Subsystems (2)
RFC 1/1 move free page back to MIGRATE_MOVABLE?
pages are MIGRATE_MOVABLE initially, and fallback to other types. If the pages are freed, I wonder why not move them back to MIGRATE_MOVABLE. This, for example, can help memory remove.
Thanks,
Shaohua
mm/page_alloc.c +14 -0
@@ -386,6 +386,9 @@ static inline int page_is_buddy(struct preturn 0 ; } +int move_freepages (struct zone *zone, +struct page *start_page,struct page *end_page, +int migratetype);/* * Freeing function for a buddy system allocator. *
@@ -446,6 +449,17 @@ static inline void __free_one_page(struclist_add (&page->lru, &zone->free_area[order].free_list[migratetype]); zone->free_area[order].nr_free++; + +if (order >= pageblock_order && migratetype !=MIGRATE_MOVABLE ) { +struct page *tmp = page; + +move_freepages (zone, page, page + (1 << order) -1 ,MIGRATE_MOVABLE ); + +while (tmp < page + (1 << order)) { +set_pageblock_migratetype (tmp,MIGRATE_MOVABLE ); + tmp += pageblock_nr_pages; + } + } }static inline int free_pages_check (struct page *page)
On (13/12/07 13:19), Shaohua Li didst pronounce:
Quoted 2 lines
pages are
MIGRATE_MOVABLEinitially, and fallback to other types. If the pages are freed, I wonder why not move them back toMIGRATE_MOVABLE.
Because there is no need, if a MIGRATE_MOVABLE allocation needs more pages, they will be acquired during fallback which always steals the largest block. Lets say that a MIGRATE_UNMOVABLE block is freed and it is larger than pageblock_order. The next MIGRATE_MOVABLE allocation will find it during fallback if necessary.
Quoted 2 lines
This, for example, can help memory remove.
I don't see how. When hot-removing, MIGRATE_MOVABLE blocks are considered possible to remove but they are also considered movable if the pages are free.
Quoted 18 lines
Thanks,
ShaohuaIndex:
linux/mm/page_alloc.c
===================================================================mm/page_alloc.c +3
-0@@ -386,6 +386,9 @@ static inline int page_is_buddy(struct preturn 0 ; } +int move_freepages (struct zone *zone, +struct page *start_page,struct page *end_page, +int migratetype);/* * Freeing function for a buddy system allocator. *
mm/page_alloc.c static inline void __free_one_page(struc · line 457
Quoted 9 lines
mm/page_alloc.c +6
-0@@ -446,6 +449,17 @@ static inline void __free_one_page(struclist_add (&page->lru, &zone->free_area[order].free_list[migratetype]); zone->free_area[order].nr_free++; + +if (order >= pageblock_order && migratetype !=MIGRATE_MOVABLE ) { +struct page *tmp = page; + +move_freepages (zone, page, page + (1 << order) -1 ,MIGRATE_MOVABLE ); +
This is unnecessary and affects a commonly used path. If a MOVABLE allocation needs more pages later, it will find the large free block during fallback.
Quoted 9 lines
mm/page_alloc.c +5
-0+while (tmp < page + (1 << order)) { +set_pageblock_migratetype (tmp,MIGRATE_MOVABLE ); + tmp += pageblock_nr_pages; + } + } }static inline int free_pages_check (struct page *page)
Signature · 3 lines
Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab