Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1340273

[PATCH] mm,vmscan: compact memory from kswapd when lots of memory free already

From Rik van Riel <riel@surriel.com>
Newsgroups linux.kernel
Subject [PATCH] mm,vmscan: compact memory from kswapd when lots of memory free already
Date 2016-02-23 05:20 +0100
Message-ID <r5cC6-8ka-21@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


If kswapd is woken up for a higher order allocation, for example
from alloc_skb, but the system already has lots of memory free,
kswapd_shrink_zone will rightfully decide kswapd should not free
any more memory.

However, at that point kswapd should proceed to compact memory, on
behalf of alloc_skb or others.

Currently kswapd will only compact memory if it first freed memory,
leading kswapd to never compact memory when there is already lots of
memory free.

On my home system, that lead to kswapd occasionally using up to 5%
CPU time, with many man wakeups from alloc_skb, and kswapd never
doing anything to relieve the situation that caused it to be woken
up.

Going ahead with compaction when kswapd did not attempt to reclaim
any memory, and as a consequence did not reclaim any memory, is the
right thing to do in this situation.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 mm/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 71b1c29948db..9566a04b9759 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3343,7 +3343,7 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
 		 * Compact if necessary and kswapd is reclaiming at least the
 		 * high watermark number of pages as requsted
 		 */
-		if (pgdat_needs_compaction && sc.nr_reclaimed > nr_attempted)
+		if (pgdat_needs_compaction && sc.nr_reclaimed >= nr_attempted)
 			compact_pgdat(pgdat, order);
 
 		/*
-- 
-- 
All rights reversed.

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mm,vmscan: compact memory from kswapd when lots of memory  free already Rik van Riel <riel@surriel.com> - 2016-02-23 05:20 +0100
  Re: [PATCH] mm,vmscan: compact memory from kswapd when lots of memory  free already Vlastimil Babka <vbabka@suse.cz> - 2016-02-23 10:20 +0100
    Re: [PATCH] mm,vmscan: compact memory from kswapd when lots of  memory free already Rik van Riel <riel@surriel.com> - 2016-02-23 16:50 +0100

csiph-web