mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: Zhan Xusheng <zhanxusheng@xiaomi.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Balbir Singh <bsingharora@gmail.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Valentin Schneider <vschneid@redhat.com>,
	Josh Snyder <joshs@netflix.com>,
	Kayra Cizmeci <kayracizmeci@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched: Account blkio delay independently of delayed dequeue
Date: Thu, 15 Oct 2026 11:40:12 +0100	[thread overview]
Message-ID: <a71b6375-f460-49fc-aee6-9f01d58163c2@arm.com> (raw)
In-Reply-To: <20261015025912.1541134-1-zhanxusheng@xiaomi.com>

On 10/15/26 03:59, Zhan Xusheng wrote:
> On 10/14/26 17:12, Christian Loehle wrote:
>> Start accounting in try_to_block_task(), when the current task commits
>> to blocking, before delayed dequeue or proxy execution can retain it on
>> the runqueue. End accounting when clearing is_blocked, including queued
>> wakeups and the proxy execution paths that let the current task continue.
> 
> This is the right place, and it subsumes my patch. Please drop mine
> rather than queue both.
> 
> try_to_block_task() has only one caller, __schedule(), which passes prev,
> and prev is rq->curr there. So @p is current, the argument-less
> delayacct_blkio_start() is correct once the call lives there, and the
> signature change I proposed is unnecessary.
> 
> The two also conflict: my patch rewrites the sched.h line yours deletes,
> so applying mine first makes your sched.h hunk fail, and the new call in
> try_to_block_task() would not compile against the changed prototype.
> 
> Reviewed-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
> 
> One question. rq->nr_iowait stays in __block_task(), so the two now
> measure different intervals: blkio delay from the commit to block,
> nr_iowait from the actual dequeue. A task woken while still delayed is
> accounted a blkio delay but was never counted in nr_iowait, so
> procs_blocked in /proc/stat and the iowait time derived from
> nr_iowait_cpu() still lose that window. The counter stays balanced,
> because such a wakeup returns through ttwu_runnable() and never reaches
> the atomic_dec() in ttwu_do_activate(), so this is not a leak. Is leaving
> nr_iowait behind deliberate, or a follow-up?

Your observation is correct.
First of all we're hoping that /proc/stat isn't observed at such granularity
to matter, but that's not really a good enough reason to leave it behind.
AFAICS we would need to start tracking iowait_cpu in task_struct then?
I'm fine with that and can send a follow-up, I guess Peter feel free to take
whatever you prefer.

(Given the update interval of /proc/stat and the expected delayed-dequeue time
 not 'fixing' it is also an option IMO. I don't see why we need to guarantee
that the blkio delay and nr_iowait need to track the exact same transitions.)

  reply	other threads:[~2026-10-15 10:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  8:17 [PATCH] delayacct: Account blkio start on the correct task Zhan Xusheng
2026-10-14 15:20 ` Christian Loehle
2026-10-14 16:12   ` [PATCH] sched: Account blkio delay independently of delayed dequeue Christian Loehle
2026-10-14 16:55     ` Kayra Cizmeci
2026-10-15  2:59     ` Zhan Xusheng
2026-10-15 10:40       ` Christian Loehle [this message]
2026-10-15 11:37         ` [PATCHv2] sched: Account I/O waits " Christian Loehle
2026-10-15 12:02           ` Zhan Xusheng
2026-10-15 12:16           ` Kayra Cizmeci

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=a71b6375-f460-49fc-aee6-9f01d58163c2@arm.com \
    --to=christian.loehle@arm.com \
    --cc=bsingharora@gmail.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joshs@netflix.com \
    --cc=juri.lelli@redhat.com \
    --cc=kayracizmeci@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=zhanxusheng1024@gmail.com \
    --cc=zhanxusheng@xiaomi.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®