[RHEL7,COMMIT] mm: Fix lost wakeup in put_shrinker()

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

Details

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

Commit Message

Kirill Tkhai Jan. 27, 2020, 8:47 a.m.
The commit is pushed to "branch-rh7-3.10.0-1062.7.1.vz7.130.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.7.1.vz7.130.11
------>
commit afa788f30454886f7c1fe261b7c94fdf96846533
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Mon Jan 27 08:47:18 2020 +0000

    mm: Fix lost wakeup in put_shrinker()
    
    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 52a3679..bc54d3a 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))