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

Submitted by Kirill Tkhai on Jan. 27, 2020, 8:31 a.m.

Details

Message ID 158011387096.111527.17971275666613026979.stgit@localhost.localdomain
State New
Series "mm: Fix lost wakeup in put_shrinker()"
Headers show

Commit Message

Kirill Tkhai Jan. 27, 2020, 8:31 a.m.
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@virtuozzo.com>
---
 mm/vmscan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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))