Skip to content

Commit 7586d52

Browse files
committed
Merge tag 'cgroup-for-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo: - cpu.stat now also shows niced CPU time - Freezer and cpuset optimizations - Other misc changes * tag 'cgroup-for-6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup/cpuset: Disable cpuset_cpumask_can_shrink() test if not load balancing cgroup/cpuset: Further optimize code if CONFIG_CPUSETS_V1 not set cgroup/cpuset: Enforce at most one rebuild_sched_domains_locked() call per operation cgroup/cpuset: Revert "Allow suppression of sched domain rebuild in update_cpumasks_hier()" MAINTAINERS: remove Zefan Li cgroup/freezer: Add cgroup CGRP_FROZEN flag update helper cgroup/freezer: Reduce redundant traversal for cgroup_freeze cgroup/bpf: only cgroup v2 can be attached by bpf programs Revert "cgroup: Fix memory leak caused by missing cgroup_bpf_offline" selftests/cgroup: Fix compile error in test_cpu.c cgroup/rstat: Selftests for niced CPU statistics cgroup/rstat: Tracking cgroup-level niced CPU time cgroup/cpuset: Fix spelling errors in file kernel/cgroup/cpuset.c
2 parents d6b6d39 + fbfbf86 commit 7586d52

File tree

8 files changed

+239
-138
lines changed

8 files changed

+239
-138
lines changed

CREDITS

+3
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,9 @@ N: Zach Brown
579579
580580
D: maestro pci sound
581581

582+
N: Zefan Li
583+
D: Contribution to control group stuff
584+
582585
N: David Brownell
583586
D: Kernel engineer, mentor, and friend. Maintained USB EHCI and
584587
D: gadget layers, SPI subsystem, GPIO subsystem, and more than a few

MAINTAINERS

-2
Original file line numberDiff line numberDiff line change
@@ -5756,7 +5756,6 @@ F: kernel/context_tracking.c
57565756

57575757
CONTROL GROUP (CGROUP)
57585758
M: Tejun Heo <[email protected]>
5759-
M: Zefan Li <[email protected]>
57605759
M: Johannes Weiner <[email protected]>
57615760
M: Michal Koutný <[email protected]>
57625761
@@ -5785,7 +5784,6 @@ F: include/linux/blk-cgroup.h
57855784

57865785
CONTROL GROUP - CPUSET
57875786
M: Waiman Long <[email protected]>
5788-
M: Zefan Li <[email protected]>
57895787
57905788
S: Maintained
57915789
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git

include/linux/cgroup-defs.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ struct cgroup_base_stat {
327327
#ifdef CONFIG_SCHED_CORE
328328
u64 forceidle_sum;
329329
#endif
330+
u64 ntime;
330331
};
331332

332333
/*
@@ -397,7 +398,7 @@ struct cgroup_freezer_state {
397398
bool freeze;
398399

399400
/* Should the cgroup actually be frozen? */
400-
int e_freeze;
401+
bool e_freeze;
401402

402403
/* Fields below are protected by css_set_lock */
403404

kernel/cgroup/cgroup.c

+12-9
Original file line numberDiff line numberDiff line change
@@ -2140,8 +2140,10 @@ int cgroup_setup_root(struct cgroup_root *root, u16 ss_mask)
21402140
if (ret)
21412141
goto exit_stats;
21422142

2143-
ret = cgroup_bpf_inherit(root_cgrp);
2144-
WARN_ON_ONCE(ret);
2143+
if (root == &cgrp_dfl_root) {
2144+
ret = cgroup_bpf_inherit(root_cgrp);
2145+
WARN_ON_ONCE(ret);
2146+
}
21452147

21462148
trace_cgroup_setup_root(root);
21472149

@@ -2314,10 +2316,8 @@ static void cgroup_kill_sb(struct super_block *sb)
23142316
* And don't kill the default root.
23152317
*/
23162318
if (list_empty(&root->cgrp.self.children) && root != &cgrp_dfl_root &&
2317-
!percpu_ref_is_dying(&root->cgrp.self.refcnt)) {
2318-
cgroup_bpf_offline(&root->cgrp);
2319+
!percpu_ref_is_dying(&root->cgrp.self.refcnt))
23192320
percpu_ref_kill(&root->cgrp.self.refcnt);
2320-
}
23212321
cgroup_put(&root->cgrp);
23222322
kernfs_kill_sb(sb);
23232323
}
@@ -5710,9 +5710,11 @@ static struct cgroup *cgroup_create(struct cgroup *parent, const char *name,
57105710
if (ret)
57115711
goto out_kernfs_remove;
57125712

5713-
ret = cgroup_bpf_inherit(cgrp);
5714-
if (ret)
5715-
goto out_psi_free;
5713+
if (cgrp->root == &cgrp_dfl_root) {
5714+
ret = cgroup_bpf_inherit(cgrp);
5715+
if (ret)
5716+
goto out_psi_free;
5717+
}
57165718

57175719
/*
57185720
* New cgroup inherits effective freeze counter, and
@@ -6026,7 +6028,8 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
60266028

60276029
cgroup1_check_for_release(parent);
60286030

6029-
cgroup_bpf_offline(cgrp);
6031+
if (cgrp->root == &cgrp_dfl_root)
6032+
cgroup_bpf_offline(cgrp);
60306033

60316034
/* put the base reference */
60326035
percpu_ref_kill(&cgrp->self.refcnt);

0 commit comments

Comments
 (0)