Re: [patch 1/2] nohz: only wakeup a single target cpu when kicking a task

From: Frederic Weisbecker
Date: Thu Oct 22 2020 - 08:54:00 EST


On Tue, Oct 20, 2020 at 03:52:45PM -0300, Marcelo Tosatti wrote:
> On Thu, Oct 15, 2020 at 01:40:53AM +0200, Frederic Weisbecker wrote:
> > Alternatively, we could rely on p->on_rq which is set to TASK_ON_RQ_QUEUED
> > at wake up time, prior to the schedule() full barrier. Of course that doesn't
> > mean that the task is actually the one running on the CPU but it's a good sign,
> > considering that we are running in nohz_full mode and it's usually optimized
> > for single task mode.
>
> Unfortunately that would require exporting p->on_rq which is internal to
> the scheduler, locklessly.
>
> (can surely do that if you prefer!)

May be:

bool task_on_rq(struct task_struct *p) ?

Thanks.