[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180528154516.c54b37ygekcn3p4g@pburton-laptop>
Date: Mon, 28 May 2018 08:45:16 -0700
From: Paul Burton <paul.burton@...s.com>
To: Peter Zijlstra <peterz@...radead.org>
CC: <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Paul McKenney <paulmck@...ux.vnet.ibm.com>,
Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH 1/2] sched: Make select_task_rq() require cpu_active()
for user tasks
Hi Peter,
On Mon, May 28, 2018 at 04:49:24PM +0200, Peter Zijlstra wrote:
> On Sat, May 26, 2018 at 08:46:47AM -0700, Paul Burton wrote:
>
> > --- a/kernel/sched/core.c
> > +++ b/kernel/sched/core.c
> > @@ -1565,7 +1565,8 @@ int select_task_rq(struct task_struct *p, int cpu, int sd_flags, int wake_flags)
> > * not worry about this generic constraint ]
> > */
> > if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) ||
> > - !cpu_online(cpu)))
> > + !cpu_online(cpu) ||
> > + (!cpu_active(cpu) && !(p->flags & PF_KTHREAD))))
> > cpu = select_fallback_rq(task_cpu(p), p);
>
> That is not quite right.. and I find that the wrong patch:
>
> 955dbdf4ce87 ("sched: Allow migrating kthreads into online but inactive CPUs")
>
> got merged over my suggested alternative :-(
>
> http://lkml.kernel.org/r/20170725165821.cejhb7v2s3kecems@hirez.programming.kicks-ass.net
>
> So, lets first fix that
Thanks for the link - just knowing that the intention is that only
per-CPU kthreads are allowed on !active CPUs is useful.
> , and then your patch becomes something like the below I think.
>
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1562,7 +1562,7 @@ int select_task_rq(struct task_struct *p
> * not worry about this generic constraint ]
> */
> if (unlikely(!cpumask_test_cpu(cpu, &p->cpus_allowed) ||
> - !cpu_online(cpu)))
> + (is_per_cpu_kthread(p) ? !cpu_online(cpu) : !cpu_active(cpu)))
> cpu = select_fallback_rq(task_cpu(p), p);
>
> return cpu;
Yes this looks good to me.
Are you planning to submit your change to introduce
is_per_cpu_kthread(), or shall I?
Thanks,
Paul
Powered by blists - more mailing lists