History

Merge tag 'cgroup-for-6.4-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup

Pull cgroup fixes from Tejun Heo: - Fix css_set reference leaks on fork failures - Fix CPU hotplug locking in cgroup_transfer_tasks() which is used by cgroup1 cpuset - Doc update * tag 'cgroup-for-6.4-rc5-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup: Documentation: Clarify usage of memory limits cgroup: always put cset in cgroup_css_set_put_fork cgroup: fix missing cpus_read_{lock,unlock}() in cgroup_transfer_tasks()

Linus Torvalds committed 3 years ago

Commit 9cd63572 parents 8d15d5e 5647e533 files · +20 −23Browse files

Unified · Split

3 files
  1. Documentation/admin-guide/cgroup-v2.rst +10 −12
  2. kernel/cgroup/cgroup-v1.c +2 −2
  3. kernel/cgroup/cgroup.c +8 −9
Documentation/admin-guide/cgroup-v2.rst+10−12
@@ -1213,23 +1213,25 @@ PAGE_SIZE multiple when read back. · 1212 unmodified lines
12131213 A read-write single value file which exists on non-root
12141214 cgroups. The default is "max".
12151215
1216− Memory usage throttle limit. This is the main mechanism to
1217− control memory usage of a cgroup. If a cgroup's usage goes
1216+ Memory usage throttle limit. If a cgroup's usage goes
12181217 over the high boundary, the processes of the cgroup are
12191218 throttled and put under heavy reclaim pressure.
12201219
12211220 Going over the high limit never invokes the OOM killer and
1222− under extreme conditions the limit may be breached.
1221+ under extreme conditions the limit may be breached. The high
1222+ limit should be used in scenarios where an external process
1223+ monitors the limited cgroup to alleviate heavy reclaim
1224+ pressure.
12231225
12241226 memory.max
12251227 A read-write single value file which exists on non-root
12261228 cgroups. The default is "max".
12271229
1228− Memory usage hard limit. This is the final protection
1229− mechanism. If a cgroup's memory usage reaches this limit and
1230− can't be reduced, the OOM killer is invoked in the cgroup.
1231− Under certain circumstances, the usage may go over the limit
1232− temporarily.
1230+ Memory usage hard limit. This is the main mechanism to limit
1231+ memory usage of a cgroup. If a cgroup's memory usage reaches
1232+ this limit and can't be reduced, the OOM killer is invoked in
1233+ the cgroup. Under certain circumstances, the usage may go
1234+ over the limit temporarily.
12331235
12341236 In default configuration regular 0-order allocations always
12351237 succeed unless OOM killer chooses current task as a victim.
@@ -1238,10 +1240,6 @@ PAGE_SIZE multiple when read back. · 2 unmodified lines
12381240 Caller could retry them differently, return into userspace
12391241 as -ENOMEM or silently ignore in cases like disk readahead.
12401242
1241− This is the ultimate protection mechanism. As long as the
1242− high limit is used and monitored properly, this limit's
1243− utility is limited to providing the final safety net.
1244−
12451243 memory.reclaim
12461244 A write-only nested-keyed file which exists for all cgroups.
12471245
kernel/cgroup/cgroup-v1.c+2−2
@@ -108,7 +108,7 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from) · 107 unmodified lines
108108
109109 cgroup_lock();
110110
111− percpu_down_write(&cgroup_threadgroup_rwsem);
111+ cgroup_attach_lock(true);
112112
113113 /* all tasks in @from are being moved, all csets are source */
114114 spin_lock_irq(&css_set_lock);
@@ -144,7 +144,7 @@ int cgroup_transfer_tasks(struct cgroup *to, struct cgroup *from) · 29 unmodified lines
144144 } while (task && !ret);
145145 out_err:
146146 cgroup_migrate_finish(&mgctx);
147− percpu_up_write(&cgroup_threadgroup_rwsem);
147+ cgroup_attach_unlock(true);
148148 cgroup_unlock();
149149 return ret;
150150 }
kernel/cgroup/cgroup.c+8−9
@@ -6486,19 +6486,18 @@ err: · 6485 unmodified lines
64866486 static void cgroup_css_set_put_fork(struct kernel_clone_args *kargs)
64876487 __releases(&cgroup_threadgroup_rwsem) __releases(&cgroup_mutex)
64886488 {
6489+ struct cgroup *cgrp = kargs->cgrp;
6490+ struct css_set *cset = kargs->cset;
6491+
64896492 cgroup_threadgroup_change_end(current);
64906493
6491− if (kargs->flags & CLONE_INTO_CGROUP) {
6492− struct cgroup *cgrp = kargs->cgrp;
6493− struct css_set *cset = kargs->cset;
6494+ if (cset) {
6495+ put_css_set(cset);
6496+ kargs->cset = NULL;
6497+ }
64946498
6499+ if (kargs->flags & CLONE_INTO_CGROUP) {
64956500 cgroup_unlock();
6496−
6497− if (cset) {
6498− put_css_set(cset);
6499− kargs->cset = NULL;
6500− }
6501−
65026501 if (cgrp) {
65036502 cgroup_put(cgrp);
65046503 kargs->cgrp = NULL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t