[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yvv66EWygCwHUCqy@slm.duckdns.org>
Date: Tue, 16 Aug 2022 10:15:36 -1000
From: Tejun Heo <tj@...nel.org>
To: Waiman Long <longman@...hat.com>
Cc: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Valentin Schneider <vschneid@...hat.com>,
Zefan Li <lizefan.x@...edance.com>,
Johannes Weiner <hannes@...xchg.org>,
Will Deacon <will@...nel.org>, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [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
Powered by blists - more mailing lists