mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
mm: more aggressive page stealing for UNMOVABLE allocations
When allocation falls back to stealing free pages of another migratetype, it can decide to steal extra pages, or even the whole pageblock in order to reduce fragmentation, which could happen if further allocation fallbacks pick a different pageblock. In try_to_steal_freepages(), one of the situations where extra pages are stolen happens when we are trying to allocate a MIGRATE_RECLAIMABLE page. However, MIGRATE_UNMOVABLE allocations are not treated the same way, although spreading such allocation over multiple fallback pageblocks is arguably even worse than it is for RECLAIMABLE allocations. To minimize fragmentation, we should minimize the number of such fallbacks, and thus steal as much as is possible from each fallback pageblock. Note that in theory this might put more pressure on movable pageblocks and cause movable allocations to steal back from unmovable pageblocks. However, movable allocations are not as aggressive with stealing, and do not cause permanent fragmentation, so the tradeoff is reasonable, and evaluation seems to support the change. This patch thus adds a check for MIGRATE_UNMOVABLE to the decision to steal extra free pages. When evaluating with stress-highalloc from mmtests, this has reduced the number of MIGRATE_UNMOVABLE fallbacks to roughly 1/6. The number of these fallbacks stealing from MIGRATE_MOVABLE block is reduced to 1/3. There was no observation of growing number of unmovable pageblocks over time, and also not of increased movable allocation fallbacks. Signed-off-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Mel Gorman <mgorman@suse.de> Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Cc: Minchan Kim <minchan@kernel.org> Cc: David Rientjes <rientjes@google.com> Cc: Rik van Riel <riel@redhat.com> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Michal Hocko <mhocko@suse.cz> Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b67f636eef
commit
d8c37712a8
1 changed files with 14 additions and 4 deletions
|
@ -1095,10 +1095,19 @@ static void change_pageblock_range(struct page *pageblock_page,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If breaking a large block of pages, move all free pages to the preferred
|
* When we are falling back to another migratetype during allocation, try to
|
||||||
* allocation list. If falling back for a reclaimable kernel allocation, be
|
* steal extra free pages from the same pageblocks to satisfy further
|
||||||
* more aggressive about taking ownership of free pages. If we claim more than
|
* allocations, instead of polluting multiple pageblocks.
|
||||||
* half of the pageblock, change pageblock's migratetype as well.
|
*
|
||||||
|
* If we are stealing a relatively large buddy page, it is likely there will
|
||||||
|
* be more free pages in the pageblock, so try to steal them all. For
|
||||||
|
* reclaimable and unmovable allocations, we steal regardless of page size,
|
||||||
|
* as fragmentation caused by those allocations polluting movable pageblocks
|
||||||
|
* is worse than movable allocations stealing from unmovable and reclaimable
|
||||||
|
* pageblocks.
|
||||||
|
*
|
||||||
|
* If we claim more than half of the pageblock, change pageblock's migratetype
|
||||||
|
* as well.
|
||||||
*/
|
*/
|
||||||
static void try_to_steal_freepages(struct zone *zone, struct page *page,
|
static void try_to_steal_freepages(struct zone *zone, struct page *page,
|
||||||
int start_type, int fallback_type)
|
int start_type, int fallback_type)
|
||||||
|
@ -1113,6 +1122,7 @@ static void try_to_steal_freepages(struct zone *zone, struct page *page,
|
||||||
|
|
||||||
if (current_order >= pageblock_order / 2 ||
|
if (current_order >= pageblock_order / 2 ||
|
||||||
start_type == MIGRATE_RECLAIMABLE ||
|
start_type == MIGRATE_RECLAIMABLE ||
|
||||||
|
start_type == MIGRATE_UNMOVABLE ||
|
||||||
page_group_by_mobility_disabled) {
|
page_group_by_mobility_disabled) {
|
||||||
int pages;
|
int pages;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue