linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vmscan.c: avoid scanning the whole targets[*] when scan_balance equals SCAN_FILE/SCAN_ANON
@ 2014-06-06  8:54 Chen Yucong
  2014-06-06 13:12 ` Johannes Weiner
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Yucong @ 2014-06-06  8:54 UTC (permalink / raw)
  To: mgorman; +Cc: mhocko, hannes, akpm, linux-mm, Chen Yucong

If (scan_balance == SCAN_FILE) is true for shrink_lruvec, then  the value of
targets[LRU_INACTIVE_ANON] and targets[LRU_ACTIVE_ANON] will be zero. As a result,
the value of 'percentage' will also be  zero, and the *whole* targets[LRU_INACTIVE_FILE]
and targets[LRU_ACTIVE_FILE] will be scanned.

For (scan_balance == SCAN_ANON), there is the same conditions stated above.

But via https://lkml.org/lkml/2013/4/10/334, we can find that the kernel does not prefer
reclaiming too many pages from the other LRU. So before recalculating the other LRU scan
count based on its original scan targets and the percentage scanning already complete, we
should need to check whether 'scan_balance' equals SCAN_FILE/SCAN_ANON.

Signed-off-by: Chen Yucong <slaoub@gmail.com>
---
 mm/vmscan.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index d51f7e0..ca3f5f1 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2120,6 +2120,9 @@ static void shrink_lruvec(struct lruvec *lruvec, struct scan_control *sc)
 			percentage = nr_file * 100 / scan_target;
 		}
 
+		if (targets[lru] == 0 && targets[lru + LRU_ACTIVE] == 0)
+			break;
+
 		/* Stop scanning the smaller of the LRU */
 		nr[lru] = 0;
 		nr[lru + LRU_ACTIVE] = 0;
-- 
1.7.10.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-06 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-06  8:54 [PATCH] mm/vmscan.c: avoid scanning the whole targets[*] when scan_balance equals SCAN_FILE/SCAN_ANON Chen Yucong
2014-06-06 13:12 ` Johannes Weiner
2014-06-06 13:47   ` Chen Yucong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).