mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: albin_yang@163.com
To: peterz@infradead.org
Cc: 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, chen.yu@linux.dev,
	kayracizmeci@gmail.com, mintaohuang@tencent.com,
	linux-kernel@vger.kernel.org, albin_yang@163.com,
	albinwyang@tencent.com
Subject: Re: [PATCH v3] sched/stats: Fix run_delay over-count for migrated sched_delayed tasks
Date: Wed, 23 Sep 2026 10:03:02 +0800	[thread overview]
Message-ID: <20260923020302.3581908-1-albin_yang@163.com> (raw)
In-Reply-To: <20260922105522.GO1837346@noisy.programming.kicks-ass.net>

Hi Peter,

On Tue, 22 Sep 2026 12:55:22 +0200, Peter Zijlstra wrote:
> Will we not have a similar problem with proxy exec? That is, would
> t->is_blocked be more appropriate?

Yes, there is a similar issue: proxy_migrate_task() re-attaches a blocked
donor via activate_task() without ENQUEUE_RESTORE -- a fake enqueue that
should not update last_queued. Thanks to Kayra for confirming this and for
the task_is_blocked() idea.

But t->is_blocked can't gate it. In ttwu_runnable(), the real wakeup of a
delayed task does its enqueue_task(ENQUEUE_DELAYED) inside the
if (p->is_blocked) branch, and is_blocked is only cleared afterwards in
ttwu_do_wakeup(). So !is_blocked would suppress exactly the re-arm this
patch relies on, and run_delay would never be accounted.

task_is_blocked() does look usable for the proxy case: every waker clears
blocked_on before waking the task (mutex handoff, ww_mutex die/wound,
proxy_needs_return), so it should not be set on a real wakeup enqueue. But
it cannot replace se.sched_delayed -- a delayed sleeper has no blocked_on at
all -- so it would have to be an additional condition rather than a
substitute.

Before adding that I would like to reproduce the proxy case and confirm what
the donor's run_delay should look like: whether the time it spent blocked on
the mutex ought to be dropped like a delayed sleep, or accounted somehow.

Please shed some light on how the proxy case could be dealt with, or should
this patch only focus on the delayed case?

Thanks,
Wei Yang


      parent reply	other threads:[~2026-09-23  2:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22  8:24 albin_yang
2026-09-22 10:55 ` Peter Zijlstra
2026-09-22 21:08   ` Kayra Cizmeci
2026-09-23  2:03   ` albin_yang [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=20260923020302.3581908-1-albin_yang@163.com \
    --to=albin_yang@163.com \
    --cc=albinwyang@tencent.com \
    --cc=bsegall@google.com \
    --cc=chen.yu@linux.dev \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kayracizmeci@gmail.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mintaohuang@tencent.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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®