mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hui Su <sh_def@163.com>
To: Tim Chen <tim.c.chen@linux.intel.com>
Cc: peterz@infradead.org, mingo@redhat.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, kprateek.nayak@amd.com, jstultz@google.com,
	metin.kaya@arm.com, connoro@google.com, yu.c.chen@intel.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] sched/cache: Use execution context for cache task tick
Date: Thu, 03 Sep 2026 10:53:29 +0800	[thread overview]
Message-ID: <de3928e26072ba22a6f7d8d293a3bd43.sh_def@163.com> (raw)
In-Reply-To: <c5a2d651a5d647fb29f13fe483301b3b6e292b4d.camel@linux.intel.com>

On Wed, 2026-09-02 at 13:12 -0700, Tim Chen wrote:
> Thanks for raising this issue.
> I agree that the execution context should be handed to task_tick_cache().
>
> However, the donor may be a deadline or real time task, in which case
> task_tick_fair() is not invoked at all -- and we still need
> task_tick_cache(). Note that account_mm_sched() does run in that case,
> via update_curr_common() -> update_se(), so rq->curr's mm keeps being
> accounted while mm->sc_stat.epoch, which only task_tick_cache()
> advances, goes stale. After llc_epoch_affinity_timeout epochs
> account_mm_sched() then resets mm->sc_stat.cpu to -1 and we lose the
> preferred LLC.
>
> So maybe the check belongs one level up, in sched_tick().
> There we can test whether rq->curr -- the task actually running -- is a
> fair task, and call task_tick_cache() and task_tick_numa().
> That test is the same p->sched_class != &fair_sched_class one
> account_mm_sched() already does.
>
> sched_tick_remote() would then need the same two calls added.
> Without them, nohz_full CPUs would stop getting them at all.
>
> Tim

Thanks for the review. I agree with your analysis.

The v1 cache change only passed rq->curr to task_tick_cache() from
task_tick_fair(), which still misses the case where a fair execution task
runs on behalf of an RT or deadline donor. In that case task_tick_fair()
is not invoked, although update_curr_common() still accounts execution
runtime to rq->curr.

I have reworked the series to move task_tick_numa() and task_tick_cache()
out of task_tick_fair() and invoke them from sched_tick() when rq->curr
is a fair task. The corresponding calls are also added to
sched_tick_remote() so full-dynticks CPUs continue to receive both ticks.
The calls remain after the donor scheduling-class tick to preserve the
existing runtime-accounting order.

I tested this with a QEMU topology providing two LLCs. With an RT donor and a
fair mutex owner, the unmodified kernel did not execute the cache tick during
the proxy execution episode. With the change, task_tick_cache() was observed
with p == rq->curr while rq->donor was a different RT task. The proxy test
completed three episodes without warnings or errors.

The default build passed, as did builds with NUMA balancing and cache
scheduling disabled independently and together. I also built the affected
objects with CONFIG_NO_HZ_FULL=y.

I will send v2 with these changes.

Thanks,
Hui


      reply	other threads:[~2026-09-03  2:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 16:33 [PATCH 1/2] sched/numa: Use execution context for NUMA " Hui Su
2026-09-02 16:33 ` [PATCH 2/2] sched/cache: Use execution context for cache " Hui Su
2026-09-02 20:12   ` Tim Chen
2026-09-03  2:53     ` Hui Su [this message]

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=de3928e26072ba22a6f7d8d293a3bd43.sh_def@163.com \
    --to=sh_def@163.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=metin.kaya@arm.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --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®