lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z3-ljgeJM5_PR5b_@gpd3>
Date: Thu, 9 Jan 2025 11:31:42 +0100
From: Andrea Righi <arighi@...dia.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Tejun Heo <tj@...nel.org>, David Vernet <void@...ifault.com>,
	Changwoo Min <changwoo@...lia.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
Subject: Re: [PATCH v5] sched_ext: Refresh scx idle state during idle-to-idle
 transitions

On Thu, Jan 09, 2025 at 11:22:12AM +0100, Peter Zijlstra wrote:
> On Thu, Jan 09, 2025 at 11:19:52AM +0100, Andrea Righi wrote:
> 
> > diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> > index 621696269584..ffc636ccd54e 100644
> > --- a/kernel/sched/idle.c
> > +++ b/kernel/sched/idle.c
> > @@ -452,19 +452,33 @@ static void wakeup_preempt_idle(struct rq *rq, struct task_struct *p, int flags)
> >  static void put_prev_task_idle(struct rq *rq, struct task_struct *prev, struct task_struct *next)
> >  {
> >  	dl_server_update_idle_time(rq, prev);
> > -	scx_update_idle(rq, false);
> > +	scx_update_idle(rq, false, true);
> >  }
> >  
> >  static void set_next_task_idle(struct rq *rq, struct task_struct *next, bool first)
> >  {
> >  	update_idle_core(rq);
> > -	scx_update_idle(rq, true);
> > +	scx_update_idle(rq, true, true);
> >  	schedstat_inc(rq->sched_goidle);
> >  	next->se.exec_start = rq_clock_task(rq);
> >  }
> >  
> >  struct task_struct *pick_task_idle(struct rq *rq)
> >  {
> > +	/*
> > +	 * The scx idle state is updated only when the CPU transitions
> > +	 * in/out of SCHED_IDLE, see put_prev_task_idle() and
> 
> Idle thread != SCHED_IDLE

Ah good point, in this case it's probably better to say something like:
"when the current task transitions to/from the idle thread". I'll clarify
that.

Thanks,
-Andrea

> 
> > +	 * set_next_task_idle().
> > +	 *
> > +	 * However, the CPU may also exit/enter the idle state while
> > +	 * running the idle task, for example waking up the CPU via
> > +	 * scx_bpf_kick_cpu() without dispatching a task on it.
> > +	 *
> > +	 * In this case we still need to trigger scx_update_idle() to
> > +	 * ensure a proper management of the scx idle state.
> > +	 */
> > +	if (rq->curr == rq->idle)
> > +		scx_update_idle(rq, true, false);
> >  	return rq->idle;
> >  }
> >  
> > -- 
> > 2.47.1
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ