[Devel] [PATCH rh7] mm: Fix lost wakeup in put_shrinker()

Kirill Tkhai ktkhai at virtuozzo.com
Mon Jan 27 11:31:16 MSK 2020


We must wake unregister_shrinker() up on refcnt == 0.
Waking it up on non zero refcnt is useless.

https://pmc.acronis.com/browse/VSTOR-30477

Fixes: 311e5a449916 "mm: fix hanging shrinker management on long do_shrink_slab"
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 mm/vmscan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 52a3679115bd..bc54d3afa8bb 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -473,7 +473,7 @@ void put_shrinker(struct shrinker *shrinker)
 	 * not freed before wake_up.
 	 */
 	rcu_read_lock();
-	if (!refcount_dec_and_test(&shrinker->refcnt)) {
+	if (refcount_dec_and_test(&shrinker->refcnt)) {
 		/* Pairs with smp_mb in wait_event()->prepare_to_wait() */
 		smp_mb();
 		if (waitqueue_active(&shrinker->wq))




More information about the Devel mailing list