lkml.org 
[lkml]   [2022]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 3/3] cgroup/cpuset: Keep user set cpus affinity
On Tue, Aug 16, 2022 at 03:27:34PM -0400, Waiman Long wrote:
> +static int cpuset_set_cpus_allowed_ptr(struct task_struct *p,
> + const struct cpumask *mask)
> +{
> + cpumask_var_t new_mask;
> + int ret;
> +
> + if (!READ_ONCE(p->user_cpus_ptr)) {
> + ret = set_cpus_allowed_ptr(p, mask);
> + /*
> + * If user_cpus_ptr becomes set now, we are racing with
> + * a concurrent sched_setaffinity(). So use the newly
> + * set user_cpus_ptr and retry again.
> + *
> + * TODO: We cannot detect change in the cpumask pointed to
> + * by user_cpus_ptr. We will have to add a sequence number
> + * if such a race needs to be addressed.
> + */

This is too ugly and obviously broken. Let's please do it properly.

Thanks.

--
tejun

\
 
 \ /
  Last update: 2022-08-16 22:16    [W:0.141 / U:0.692 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site