On Mon, Dec 22, 2025 at 10:51:49AM +0800, Chen Ridong wrote:
On 2025/12/22 7:36, Bing Jiao wrote:
-void cpuset_node_filter_allowed(struct cgroup *cgroup, nodemask_t *mask) -{
- struct cgroup_subsys_state *css;
- struct cpuset *cs;
- if (!cpuset_v2())
return;- css = cgroup_get_e_css(cgroup, &cpuset_cgrp_subsys);
- if (!css)
return;- /* Follows the same assumption in cpuset_node_allowed() */
- cs = container_of(css, struct cpuset, css); nodes_and(*mask, *mask, cs->effective_mems); css_put(css);
}
Oh, I see you merged these two functions here.
However, I think cpuset_get_mem_allowed would be more versatile in general use.
You can then check whether the returned nodemask intersects with your target mask. In the future, there may be scenarios where users simply want to retrieve the effective masks directly.
Hi Ridong, thank you for the suggestions.
I agree that returning a nodemask would provide greater versatility.
I think cpuset_get_mem_allowed_relax() would be a better name, since we do not need the locking and online mem guarantees compared to an similar function cpuset_mems_allowed().
Best, Bing