summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/admin-guide/cgroup-v2.rst5
-rw-r--r--mm/memcontrol.c6
2 files changed, 6 insertions, 5 deletions
diff --git a/Documentation/admin-guide/cgroup-v2.rst b/Documentation/admin-guide/cgroup-v2.rst
index e34d3c938729..8a2c52d5c53b 100644
--- a/Documentation/admin-guide/cgroup-v2.rst
+++ b/Documentation/admin-guide/cgroup-v2.rst
@@ -1245,6 +1245,11 @@ PAGE_SIZE multiple when read back.
because of running out of swap system-wide or max
limit.
+ When reduced under the current usage, the existing swap
+ entries are reclaimed gradually and the swap usage may stay
+ higher than the limit for an extended period of time. This
+ reduces the impact on the workload and memory management.
+
Usage Guidelines
~~~~~~~~~~~~~~~~
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e3d56927a724..c1e64d60ed02 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -6280,11 +6280,7 @@ static ssize_t swap_max_write(struct kernfs_open_file *of,
if (err)
return err;
- mutex_lock(&memcg_max_mutex);
- err = page_counter_set_max(&memcg->swap, max);
- mutex_unlock(&memcg_max_mutex);
- if (err)
- return err;
+ xchg(&memcg->swap.max, max);
return nbytes;
}