summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2026-05-05 03:51:17 +0300
committerTejun Heo <tj@kernel.org>2026-05-15 20:24:12 +0300
commit3360a5c16d87933fb74b530f5e016eb3dfffee5d (patch)
tree628022761d3abed0c63b7d4da0b64c7e2c5bde3e /include/linux
parent4376352f2c651ed5308a46caf21d2ccb53c240eb (diff)
downloadlinux-3360a5c16d87933fb74b530f5e016eb3dfffee5d.tar.xz
cgroup: Inline cgroup_has_tasks() in cgroup.h
cpuset reads cs->css.cgroup->nr_populated_csets directly in two places to test whether a cgroup has tasks. cgroup.c already has a matching helper, cgroup_has_tasks(). Move it to cgroup.h as static inline and use that instead. This is to prepare for relocation of cgroup->nr_populated_csets. No semantic change. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/cgroup.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index e52160e85af4..ceb87507667e 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -639,6 +639,11 @@ static inline bool task_under_cgroup_hierarchy(struct task_struct *task,
return cgroup_is_descendant(cset->dfl_cgrp, ancestor);
}
+static inline bool cgroup_has_tasks(struct cgroup *cgrp)
+{
+ return cgrp->nr_populated_csets;
+}
+
/* no synchronization, the result can only be used as a hint */
static inline bool cgroup_is_populated(struct cgroup *cgrp)
{