[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zw4r_YYU_2-ws98k@gpd3>
Date: Tue, 15 Oct 2024 10:46:53 +0200
From: Andrea Righi <andrea.righi@...ux.dev>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Tejun Heo <tj@...nel.org>, David Vernet <void@...ifault.com>,
Ingo Molnar <mingo@...hat.com>, 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>,
Valentin Schneider <vschneid@...hat.com>,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH v2] sched_ext: Trigger ops.update_idle() from
pick_task_idle()
On Tue, Oct 15, 2024 at 09:45:26AM +0200, Peter Zijlstra wrote:
> On Tue, Oct 15, 2024 at 12:06:03AM +0200, Andrea Righi wrote:
>
> > diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> > index d2f096bb274c..5a10cbc7e9df 100644
> > --- a/kernel/sched/idle.c
> > +++ b/kernel/sched/idle.c
> > @@ -459,13 +459,13 @@ static void put_prev_task_idle(struct rq *rq, struct task_struct *prev, struct t
> > static void set_next_task_idle(struct rq *rq, struct task_struct *next, bool first)
> > {
> > update_idle_core(rq);
> > - scx_update_idle(rq, true);
> > schedstat_inc(rq->sched_goidle);
> > next->se.exec_start = rq_clock_task(rq);
> > }
> >
> > struct task_struct *pick_task_idle(struct rq *rq)
> > {
> > + scx_update_idle(rq, true);
> > return rq->idle;
> > }
>
> Does this do the right thing in the case of core-scheduling doing
> pick_task() for force-idle on a remote cpu?
>
> The core-sched case is somewhat special in that the pick can be ignored
> -- in which case you're doing a spurious scx_update_idle() call.
Hm... that's right. So, what about keeping scx_update_idle() in
set_next_task_idle() and also call it from pick_task(), but only when
rq->curr == rq->idle?
In this way, we should still be able to handle the scx_bpf_kick_cpu()
call from ops.update_idle() properly and, while we might still encounter
spurious calls in the core scheduling case, the idle state provided by
ops.update_idle() will always be correct. So, scx schedulers that want
to implement their own cpu idle state can rely on ops.update_idle().
-Andrea
Powered by blists - more mailing lists