[Devel] [PATCH RHEL7 COMMIT] mm/slab: Fix deadlock on attempt to shrink slab.
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Oct 15 18:57:14 MSK 2019
The commit is pushed to "branch-rh7-3.10.0-1062.1.2.vz7.114.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.1.2.vz7.114.5
------>
commit 8bec805e4abf0d3c4548b36be5048c0200ff589c
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date: Tue Oct 15 18:57:13 2019 +0300
mm/slab: Fix deadlock on attempt to shrink slab.
echo 1 > /sys/kernel/slab/<name>/shrink deadlocks as kmem_cache_shrink()
attempts to lock slab_mutex which is already held by caller.
Replace slab_mutex locking with [get,put]_online_mems(). This is what
the sane kernel does.
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
mm/slab_common.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/slab_common.c b/mm/slab_common.c
index b08f48541f4a..b73b7547de36 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -600,10 +600,10 @@ int kmem_cache_shrink(struct kmem_cache *cachep)
int ret;
get_online_cpus();
- mutex_lock(&slab_mutex);
+ get_online_mems();
kasan_cache_shrink(cachep);
ret = __kmem_cache_shrink(cachep, false);
- mutex_unlock(&slab_mutex);
+ put_online_mems();
put_online_cpus();
return ret;
}
More information about the Devel
mailing list