[folded-merged] mmslabvmscan-accumulate-gradual-pressure-on-small-slabs-fix-2.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: mm,vmscan: accumulated slab reclaim pressure fixes
has been removed from the -mm tree.  Its filename was
     mmslabvmscan-accumulate-gradual-pressure-on-small-slabs-fix-2.patch

This patch was dropped because it was folded into mmslabvmscan-accumulate-gradual-pressure-on-small-slabs.patch

------------------------------------------------------
From: Rik van Riel <riel@xxxxxxxxxxx>
Subject: mm,vmscan: accumulated slab reclaim pressure fixes

Jonathan asked about a divide by zero if a slab with shrinker->seeks==0
comes into the new code path, which appears to be possible because the
shrinker list is locked with a read-write semaphore, that allows multiple
parallel reclaimers.

This led me to take another closer look at the code, and find a
possibility for a small slab with a shrinker->seeks > 4 to not have any
items reclaimed from it at all.

This patch fixes both of these bugs.

Link: http://lkml.kernel.org/r/20190129142831.6a373403@xxxxxxxxxxxxxxxxxxxx
Signed-off-by: Rik van Riel <riel@xxxxxxxxxxx>
Suggested-by: Jonathan Lemon <bsd@xxxxxx>
Cc: Chris Mason <clm@xxxxxx>
Cc: Roman Gushchin <guro@xxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Dave Chinner <dchinner@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/vmscan.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- a/mm/vmscan.c~mmslabvmscan-accumulate-gradual-pressure-on-small-slabs-fix-2
+++ a/mm/vmscan.c
@@ -500,14 +500,17 @@ static unsigned long do_shrink_slab(stru
 	 * corresponding structures like per-cpu stats and kmem caches
 	 * can be really big, so it may lead to a significant waste of memory.
 	 */
-	if (!delta) {
-		shrinker->small_scan += freeable;
+	if (!delta && shrinker->seeks) {
+		unsigned long nr_considered;
 
-		delta = shrinker->small_scan >> priority;
-		shrinker->small_scan -= delta << priority;
+		shrinker->small_scan += freeable;
+		nr_considered = shrinker->small_scan >> priority;
 
-		delta *= 4;
+		delta = 4 * nr_considered;
 		do_div(delta, shrinker->seeks);
+
+		if (delta)
+			shrinker->small_scan -= nr_considered << priority;
 	}
 
 	total_scan += delta;
_

Patches currently in -mm which might be from riel@xxxxxxxxxxx are

mmslabvmscan-accumulate-gradual-pressure-on-small-slabs.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux