From: Namhyung Kim <namhyung@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: [Question] sched: Is nsecs_to_cputime valid?
Date: Thu, 05 Jul 2012 12:05:01 +0900 [thread overview]
Message-ID: <87txxmlxgi.fsf@sejong.aot.lge.com> (raw)
The following message is a courtesy copy of an article
that has been posted to gmane.linux.kernel as well.
Hi,
When I look at kernel/sched/core.c, I found a dubious bit on the
nsecs_to_cputime macro. It's defined as:
#ifndef nsecs_to_cputime
# define nsecs_to_cputime(__nsecs) nsecs_to_jiffies(__nsecs)
#endif
While default implementation of jiffies_to_cputime (in
include/asm-generic/cputime.h) returns just the same vaule (w/
casting), some arch's (ia64, ppc and s390) define their own ones.
So nsecs_to_cputime on those arch's will end up returning time in
jiffies rather than cputime.
I see it depends on CONFIG_VIRT_CPU_ACCOUTING and ia64 and ppc use
the default j_to_ct when not defined. But it seems it's not obvious for
s390. Anyway I think converting the return value to cputime again is
need for self-containedness.
Am I missing something?
Thanks,
Namhyung
reply other threads:[~2012-07-05 3:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=87txxmlxgi.fsf@sejong.aot.lge.com \
--to=namhyung@kernel.org \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@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