[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b4f5ac150685456cf45a342e3bb1f28cdd557a53.camel@linux.intel.com>
Date: Mon, 22 Jan 2024 13:59:14 -0800
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: K Prateek Nayak <kprateek.nayak@....com>, linux-kernel@...r.kernel.org
Cc: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com, rostedt@...dmis.org,
bsegall@...gle.com, mgorman@...e.de, bristot@...hat.com,
vschneid@...hat.com, gautham.shenoy@....com
Subject: Re: [PATCH] sched/fair: Skip newidle_balance() when an idle CPU is
woken up to process an IPI
On Fri, 2024-01-19 at 14:15 +0530, K Prateek Nayak wrote:
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index b803030c3a03..1fedc7e29c98 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8499,6 +8499,16 @@ done: __maybe_unused;
> if (!rf)
> return NULL;
>
> + /*
> + * An idle CPU in TIF_POLLING mode might end up here after processing
> + * an IPI when the sender sets the TIF_NEED_RESCHED bit and avoids
> + * sending an actual IPI. In such cases, where an idle CPU was woken
> + * up only to process an interrupt, without necessarily queuing a task
> + * on it, skip newidle_balance() to facilitate faster idle re-entry.
> + */
> + if (prev == rq->idle)
> + return NULL;
> +
Should we check the call function queue directly to detect that there is
an IPI waiting to be processed? something like
if (!llist_empty(&per_cpu(call_single_queue, rq->cpu)))
return NULL;
Could there be cases where we want to do idle balance in this code path?
Say a cpu is idle and a scheduling tick came in, we may try
to look for something to run on the idle cpu. Seems like after
your change above, that would be skipped.
Tim
> new_tasks = newidle_balance(rq, rf);
>
> /*
Powered by blists - more mailing lists