
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ICA1GK -------------------------------- Add a kfunc to get the number of set bit within a cpumask. Signed-off-by: GONG Ruiqi <gongruiqi1@huawei.com> --- kernel/cgroup/cpuset.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 1c587e5e34c1..417827f2c043 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -5228,8 +5228,14 @@ __bpf_kfunc struct cpuset *bpf_cpuset_from_task(struct task_struct *task) return task_cs(task); } +__bpf_kfunc unsigned int bpf_cpumask_weight(struct cpumask *pmask) +{ + return cpumask_weight(pmask); +} + BTF_SET8_START(bpf_cpuset_kfunc_ids) BTF_ID_FLAGS(func, bpf_cpuset_from_task, KF_RET_NULL | KF_RCU) +BTF_ID_FLAGS(func, bpf_cpumask_weight) BTF_SET8_END(bpf_cpuset_kfunc_ids) static const struct btf_kfunc_id_set bpf_cpuset_kfunc_set = { -- 2.25.1