mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
mm: vmscan: reclaim order-0 and use compaction instead of lumpy reclaim
Lumpy reclaim is disruptive. It reclaims a large number of pages and ignores the age of the pages it reclaims. This can incur significant stalls and potentially increase the number of major faults. Compaction has reached the point where it is considered reasonably stable (meaning it has passed a lot of testing) and is a potential candidate for displacing lumpy reclaim. This patch introduces an alternative to lumpy reclaim whe compaction is available called reclaim/compaction. The basic operation is very simple - instead of selecting a contiguous range of pages to reclaim, a number of order-0 pages are reclaimed and then compaction is later by either kswapd (compact_zone_order()) or direct compaction (__alloc_pages_direct_compact()). [[email protected]: fix build] [[email protected]: use conventional task_struct naming] Signed-off-by: Mel Gorman <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Cc: Rik van Riel <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Andy Whitcroft <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
ee64fc9354
commit
3e7d344970
6 changed files with 196 additions and 49 deletions
17
mm/migrate.c
17
mm/migrate.c
|
|
@ -639,6 +639,23 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
|
|||
if (!trylock_page(page)) {
|
||||
if (!force)
|
||||
goto move_newpage;
|
||||
|
||||
/*
|
||||
* It's not safe for direct compaction to call lock_page.
|
||||
* For example, during page readahead pages are added locked
|
||||
* to the LRU. Later, when the IO completes the pages are
|
||||
* marked uptodate and unlocked. However, the queueing
|
||||
* could be merging multiple pages for one bio (e.g.
|
||||
* mpage_readpages). If an allocation happens for the
|
||||
* second or third page, the process can end up locking
|
||||
* the same page twice and deadlocking. Rather than
|
||||
* trying to be clever about what pages can be locked,
|
||||
* avoid the use of lock_page for direct compaction
|
||||
* altogether.
|
||||
*/
|
||||
if (current->flags & PF_MEMALLOC)
|
||||
goto move_newpage;
|
||||
|
||||
lock_page(page);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue