diff options
| author | Ingo Molnar <mingo@kernel.org> | 2026-07-27 11:27:58 +0200 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2026-07-27 11:27:59 +0200 |
| commit | 4518ac8766d89b38e42f6cb70861870988a28af5 (patch) | |
| tree | 644e433fabc8b9ac3bde052da5f41f575fcb1585 /kernel/cgroup | |
| parent | 65c76bfe8ab6d3caa7906235ac7b60fe83eb7e51 (diff) | |
| parent | 04998aa54848f15332202d0bea008d2ca1ed1713 (diff) | |
| download | linux-next-4518ac8766d89b38e42f6cb70861870988a28af5.tar.gz linux-next-4518ac8766d89b38e42f6cb70861870988a28af5.zip | |
Merge branch into tip/master: 'sched/core'
# New commits in sched/core:
04998aa54848 ("sched/eevdf: Delayed dequeue task can't preempt")
19b7bdc3a155 ("sched/fair: Fix stale comments referring to removed CFS concepts")
b2463ebf2674 ("sched/debug: Remove unused schedstats")
b0bc1c75f304 ("sched/psi: skip irqtime accounting when no new irq time has elapsed")
296744614dd0 ("sched/fair: Reflow sched_balance_rq()")
f2267ad5777f ("sched/fair: Simplify balance_interval reset logic in sched_balance_rq()")
cdd9e37ed46a ("sched/fair: Don't trigger active lb if src_rq->curr is not on_rq")
0d1e7a2bab35 ("sched/eevdf: Speedup short slice task scheduling")
7cd2ef17de5e ("sched/eevdf: Always update slice protection")
ba0d3bf5f97b ("sched/eevdf: Cancel slice protection if short slice task is eligible")
7ad0ec7890b3 ("sched/eevdf: Update slice protection even when resched is already set")
49f87b4d0be8 ("sched/eevdf: Take into account current's lag when updating slice protection")
8f97b627ff1c ("sched/fair: Set next buddy for preempt short")
3cd1f657fae5 ("sched/fair: Remove unused arguments from set_preempt_buddy()")
85570f10a4c6 ("sched/eevdf: Move to a single runqueue")
fb1050ac8e40 ("sched/fair: Change the default cgroup_mode to concur")
507f910a4e1f ("sched/fair: Add cgroup_mode: tasks")
5c0b58bd1c9f ("sched/fair: Add cgroup_mode: concur")
90ac22ffef48 ("sched/fair: Add cgroup_mode: max")
80ad6d3338eb ("sched/fair: Add cgroup_mode: up")
4161cb2d867b ("sched/fair: Add cgroup_mode switch")
4f166adb5cb0 ("sched/fair: Fix overflow in update_tg_cfs_runnable()")
fa02b2868420 ("sched/core: Fix inter-class wakeup_preempt()")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/cgroup')
| -rw-r--r-- | kernel/cgroup/cpuset.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 45944b3e31ca..e42f81a61311 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -4129,6 +4129,28 @@ bool cpuset_cpus_allowed_fallback(struct task_struct *tsk) return changed; } +/* + * Returns the number of CPUs available for this cgroup. + * + * This only really works for cgroup-v2 where all the controllers are mounted + * in the same hierarchy. If not cgroup-v2 or no cpuset controller is + * configured it reverts to num_online_cpus(). + */ +int cpuset_num_cpus(struct cgroup *cgrp) +{ + int nr = num_online_cpus(); + struct cpuset *cs; + + if (is_in_v2_mode()) { + guard(rcu)(); + cs = css_cs(cgroup_e_css(cgrp, &cpuset_cgrp_subsys)); + if (cs) + nr = cpumask_weight(cs->effective_cpus); + } + + return nr; +} + void __init cpuset_init_current_mems_allowed(void) { nodes_setall(current->mems_allowed); |
