mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: "brookxu.cn" <brookxu.cn@gmail.com>,
	corbet@lwn.net, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Daniel Bristot de Oliveira <bristot@redhat.com>
Subject: Re: [PATCH] docs/scheduler: Change unit of cpu_time and rq_time to nanoseconds
Date: Fri, 8 Apr 2022 15:43:28 +0200	[thread overview]
Message-ID: <YlA8AEfqK6eRnAPO@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YlAub2NXBPeNcyAS@casper.infradead.org>

On Fri, Apr 08, 2022 at 01:45:35PM +0100, Matthew Wilcox wrote:
> On Fri, Apr 08, 2022 at 05:31:06PM +0800, brookxu.cn wrote:
> > From: Chunguang Xu <brookxu@tencent.com>
> > 
> > In the current implementation, cpu_time and rq_time should be
> > in nanoseconds, so this document needs to be modified.
> 
> I agree that this is wrong, but we shouldn't be changing the units
> of measurement reported to userspace without changing the schedstats
> version.  I suspect this was an inadvertent change, and we should be
> converting from sched_clock() time (~= ns) to jiffies in show_schedstat().
> Adding scheduler experts.

Seems to have happend at 425e0968a25f ("sched: move code into
kernel/sched_stats.h").

Before that we have:

-static inline void
-rq_sched_info_depart(struct rq *rq, unsigned long delta_jiffies)
-{
-       if (rq)
-               rq->rq_sched_info.cpu_time += delta_jiffies;
-}

-static inline void sched_info_depart(struct task_struct *t)
-{
-       unsigned long delta_jiffies = jiffies - t->sched_info.last_arrival;
-
-       t->sched_info.cpu_time += delta_jiffies;
-       rq_sched_info_depart(task_rq(t), delta_jiffies);
-}

afterwards we have:

+static inline void sched_info_depart(struct task_struct *t)
+{
+       unsigned long long delta = sched_clock() - t->sched_info.last_arrival;
+
+       t->sched_info.cpu_time += delta;
+       rq_sched_info_depart(task_rq(t), delta);
+}

And that's 15 years and at least one SCHEDSTAT_VERSION ago (although
this change itself didn't bump the version).

So I'm thinking we can update the documentation and forget about this.

  reply	other threads:[~2022-04-08 13:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1649410266-32360-1-git-send-email-brookxu.cn@gmail.com>
2022-04-08 12:45 ` Matthew Wilcox
2022-04-08 13:43   ` Peter Zijlstra [this message]
2022-04-16  8:36     ` Jonathan Corbet

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=YlA8AEfqK6eRnAPO@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bristot@redhat.com \
    --cc=brookxu.cn@gmail.com \
    --cc=bsegall@google.com \
    --cc=corbet@lwn.net \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=willy@infradead.org \
    /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

Powered by JetHome