mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Hui Su <sh_def@163.com>
Cc: "Chen, Yu C" <yu.c.chen@intel.com>,
	tim.c.chen@linux.intel.com, mingo@redhat.com,
	kprateek.nayak@amd.com, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	vschneid@redhat.com, connoro@google.com, jstultz@google.com,
	linux-kernel@vger.kernel.org, arighi@nvidia.com
Subject: Re: [PATCH v3 1/2] sched/numa: Drive NUMA task tick from execution context
Date: Wed, 9 Sep 2026 10:37:35 +0200	[thread overview]
Message-ID: <20260909083735.GK776954@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260908121021.53837-1-sh_def@163.com>

On Tue, Sep 08, 2026 at 09:10:21PM +0900, Hui Su wrote:
> On Tue, Sep 08, 2026 at 12:44:07PM +0200, Peter Zijlstra wrote:
> > I also wondered if we should have task_tick() do curr_class->task_tick()
> > last, rather than first. But I couldn't immediately find a compelling
> > argument either way around.
> >
> > Updated...
> >
> > @@ -910,6 +910,16 @@ static void __used hrtick_clear(struct rq *rq)
> >  		hrtimer_cancel(&rq->hrtick_timer);
> >  }
> >
> > +static inline void task_tick(struct rq *rq, int queued)
> > +{
> > +	const struct sched_class *curr_class = rq->curr->sched_class,
> > +				*donor_class = rq->donor->sched_class;
> > +
> > +	curr_class->task_tick(rq, queued);
> > +	if (sched_proxy_exec() && donor_class != curr_class)
> > +		donor_class->task_tick(rq, queued);
> > +}
> 
> The per-class split looks good to me. I noticed a couple of details while
> going through the updated version.
> 
> First, I think there is a reason to call curr_class->task_tick() last.
> 
> For example, with an RT/DL donor and a FAIR execution context, the donor
> class tick calls update_curr_*(), which goes through
> update_curr_common()/update_se() and accounts the elapsed task runtime
> to rq->curr->se.sum_exec_runtime. If the FAIR callback runs first,
> task_tick_numa() observes sum_exec_runtime before the current tick's runtime
> has been accounted.
> 
> Calling the donor class first preserves the accounting-before-consumer
> ordering:
> 
> 	donor_class->task_tick(rq, queued);
> 	if (sched_proxy_exec() && curr_class != donor_class)
> 		curr_class->task_tick(rq, queued);
> 
> This also matches the ordering in v3, where the donor tick ran before
> sched_tick_exec_ctx().

Indeed!

> Second, task_tick() is added after hrtick_clear(), which puts it inside
> CONFIG_SCHED_HRTICK. Since sched_tick() calls task_tick() unconditionally,
> CONFIG_SCHED_HRTICK=n would leave task_tick() undefined. The helper needs
> to be outside the CONFIG_SCHED_HRTICK block.

Whoopsie ;-)

> With those changes, the split and the queued handling look good to me so far.
> I'll test the cross-class and hrtick cases, rework the series accordingly,
> and send a v4.

Thanks!

  reply	other threads:[~2026-09-09  8:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  8:52 [PATCH v3 0/2] sched: Fix execution-context tick handling under proxy execution Hui Su
2026-09-04  8:52 ` [PATCH v3 1/2] sched/numa: Drive NUMA task tick from execution context Hui Su
2026-09-04 15:52   ` Chen Yu
2026-09-04 17:17   ` Tim Chen
2026-09-08  7:40   ` Chen, Yu C
2026-09-08  8:35   ` Peter Zijlstra
2026-09-08 10:02     ` Chen, Yu C
2026-09-08 10:44       ` Peter Zijlstra
2026-09-08 12:10         ` Hui Su
2026-09-09  8:37           ` Peter Zijlstra [this message]
2026-09-04  8:52 ` [PATCH v3 2/2] sched/cache: Drive cache " Hui Su
2026-09-08  7:45   ` Chen, Yu C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260909083735.GK776954@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=arighi@nvidia.com \
    --cc=bsegall@google.com \
    --cc=connoro@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jstultz@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=sh_def@163.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yu.c.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®