summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mm/vmscan.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index e73274a..153e079 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -489,6 +489,15 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid,
sc.nid = 0;
freed += do_shrink_slab(&sc, shrinker, priority);
+ /*
+ * Bail out if someone want to register a new shrinker to
+ * prevent the regsitration from being stalled for long periods
+ * by parallel ongoing shrinking.
+ */
+ if (rwsem_is_contended(&shrinker_rwsem)) {
+ freed = freed ? : 1;
+ break;
+ }
}
up_read(&shrinker_rwsem);
OpenPOWER on IntegriCloud