summaryrefslogtreecommitdiff
path: root/mm/zswap.c
diff options
context:
space:
mode:
authorJulia Cartwright <julia@ni.com>2018-02-26 11:22:02 -0600
committerJulia Cartwright <julia@ni.com>2018-02-26 11:22:02 -0600
commit184d107421c695782ae8cc976170e3cf83fbca9a (patch)
tree20d804c113e6fbc3a298b069b5a777fb81e194f4 /mm/zswap.c
parent90816cc1d4a1d23efe37b74866c6174dd5eab6b5 (diff)
parent19c04ca5b239e6e2277a5b381d1e79482ab9bbc5 (diff)
downloadlinux-rt-184d107421c695782ae8cc976170e3cf83fbca9a.tar.gz
Merge tag 'v4.9.84' into v4.9-rt
This is the 4.9.84 stable release
Diffstat (limited to 'mm/zswap.c')
-rw-r--r--mm/zswap.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/mm/zswap.c b/mm/zswap.c
index dbef27822a98..ded051e3433d 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -752,18 +752,22 @@ static int __zswap_param_set(const char *val, const struct kernel_param *kp,
pool = zswap_pool_find_get(type, compressor);
if (pool) {
zswap_pool_debug("using existing", pool);
+ WARN_ON(pool == zswap_pool_current());
list_del_rcu(&pool->list);
- } else {
- spin_unlock(&zswap_pools_lock);
- pool = zswap_pool_create(type, compressor);
- spin_lock(&zswap_pools_lock);
}
+ spin_unlock(&zswap_pools_lock);
+
+ if (!pool)
+ pool = zswap_pool_create(type, compressor);
+
if (pool)
ret = param_set_charp(s, kp);
else
ret = -EINVAL;
+ spin_lock(&zswap_pools_lock);
+
if (!ret) {
put_pool = zswap_pool_current();
list_add_rcu(&pool->list, &zswap_pools);