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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250711132842.GG905792@noisy.programming.kicks-ass.net>
Date: Fri, 11 Jul 2025 15:28:42 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: John Stultz <jstultz@...gle.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
	K Prateek Nayak <kprateek.nayak@....com>,
	Joel Fernandes <joelagnelf@...dia.com>,
	Qais Yousef <qyousef@...alina.io>, Ingo Molnar <mingo@...hat.com>,
	Juri Lelli <juri.lelli@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Valentin Schneider <vschneid@...hat.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ben Segall <bsegall@...gle.com>,
	Zimuzo Ezeozue <zezeozue@...gle.com>, Mel Gorman <mgorman@...e.de>,
	Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>,
	Boqun Feng <boqun.feng@...il.com>,
	"Paul E. McKenney" <paulmck@...nel.org>,
	Metin Kaya <Metin.Kaya@....com>,
	Xuewen Yan <xuewen.yan94@...il.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Daniel Lezcano <daniel.lezcano@...aro.org>,
	Suleiman Souhlal <suleiman@...gle.com>,
	kuyo chang <kuyo.chang@...iatek.com>, hupu <hupu.gm@...il.com>,
	kernel-team@...roid.com
Subject: Re: [RESEND][PATCH v18 5/8] sched: Fix runtime accounting w/ split
 exec & sched contexts

On Thu, Jul 10, 2025 at 10:25:46AM -0700, John Stultz wrote:
> On Thu, Jul 10, 2025 at 2:45 AM Peter Zijlstra <peterz@...radead.org> wrote:
> > On Mon, Jul 07, 2025 at 08:43:52PM +0000, John Stultz wrote:
> > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > > index edcc7d59ecc3b..c34e0891193a7 100644
> > > --- a/kernel/sched/fair.c
> > > +++ b/kernel/sched/fair.c
> > > @@ -1143,30 +1143,40 @@ static void update_tg_load_avg(struct cfs_rq *cfs_rq)
> > >  }
> > >  #endif /* CONFIG_SMP */
> > >
> > > +static s64 update_se(struct rq *rq, struct sched_entity *se)
> > >  {
> > >       u64 now = rq_clock_task(rq);
> > >       s64 delta_exec;
> > >
> > > +     delta_exec = now - se->exec_start;
> > >       if (unlikely(delta_exec <= 0))
> > >               return delta_exec;
> > >
> > > +     se->exec_start = now;
> > > +     if (entity_is_task(se)) {
> > > +             struct task_struct *donor = task_of(se);
> > > +             struct task_struct *running = rq->curr;
> > > +             /*
> > > +              * If se is a task, we account the time against the running
> > > +              * task, as w/ proxy-exec they may not be the same.
> > > +              */
> > > +             running->se.exec_start = now;
> > > +             running->se.sum_exec_runtime += delta_exec;
> > >
> > > +             trace_sched_stat_runtime(running, delta_exec);
> > > +             account_group_exec_runtime(running, delta_exec);
> > >
> > > +             /* cgroup time is always accounted against the donor */
> > > +             cgroup_account_cputime(donor, delta_exec);
> > > +     } else {
> > > +             /* If not task, account the time against donor se  */
> > > +             se->sum_exec_runtime += delta_exec;
> > >       }
> >
> > Bah.. this is all terrible :-) But yeah, I suppose this wil do.
> 
> Yeah, :/ I'm happy to rework it further if you have ideas.

Not really; I stared at this for a bit yesterday. Its a confusing mess,
but I didn't come up with anything better.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ