Merge "mm: vmscan: only write dirty pages that the scanner has seen twice"

This commit is contained in:
Linux Build Service Account
2018-06-06 23:37:12 -07:00
committed by Gerrit - the friendly Code Review server

View File

@@ -1154,14 +1154,18 @@ static unsigned long shrink_page_list(struct list_head *page_list,
if (PageDirty(page)) {
/*
* Only kswapd can writeback filesystem pages to
* avoid risk of stack overflow but only writeback
* if many dirty pages have been encountered.
* Only kswapd can writeback filesystem pages
* to avoid risk of stack overflow. But avoid
* injecting inefficient single-page IO into
* flusher writeback as much as possible: only
* write pages when we've encountered many
* dirty pages, and when we've already scanned
* the rest of the LRU for clean pages and see
* the same dirty pages again (PageReclaim).
*/
if (page_is_file_cache(page) &&
(!current_is_kswapd() ||
(pgdat &&
!test_bit(PGDAT_DIRTY, &pgdat->flags)))) {
(!current_is_kswapd() || !PageReclaim(page) ||
!test_bit(PGDAT_DIRTY, &pgdat->flags))) {
/*
* Immediately reclaim when written back.
* Similar in principal to deactivate_page()