From: Thomas Gleixner <tglx@linutronix.de>
To: Aniroop Mathur <aniroop.mathur@gmail.com>
Cc: Clemens Ladisch <clemens@ladisch.de>,
John Stultz <john.stultz@linaro.org>,
a.mathur@samsung.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Ques: [kernel/time/*] Is there any disadvantage in using sleep_range for more than 20ms delay ?
Date: Mon, 14 Dec 2015 20:53:40 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.11.1512142042500.4336@nanos> (raw)
In-Reply-To: <CADYu30--EgROAeA_qo7itpBzrjG3yoKqA9rwJGWAqLA4RdPA6Q@mail.gmail.com>
On Tue, 15 Dec 2015, Aniroop Mathur wrote:
> On Sun, Dec 13, 2015 at 3:17 PM, Clemens Ladisch <clemens@ladisch.de> wrote:
> > Aniroop Mathur wrote:
> >>> 2. If we use msleep(40), is it possible that process could wake up after
> >>> 60 ms or 70 ms or 100 ms or more ?
> >
> > Yes, if lots of other processes compete for the CPU.
>
> You mean to say "yes" for process competing for changing state
> from "waiting" to "ready" or "ready" to "running" ?
There is no state ready. We change from [un]interruptible to running,
but that's just the wakeup by the timer callback. When the task gets
on the CPU is a different question.
> Regarding above, could you please help to confirm below things?
> 1. Using msleep(40) with HZ=1000 (1ms), process can still be in
> "waiting" state and will not move to "ready" state even after 42,45 or 50 ms.
> Right ?
kernel/time/timer.c:apply_slack()
> 2. Using usleep_range(40000, 41000), it is guaranteed that process will
> change its state from waiting to ready state before or at 41 ms.
> Right ?
1) It is supposed to be woken up by the timer in that range, but there
is no guarantee. Depends also on your kernel configuration and
hardware capabilities.
2) The state changes from [un]interruptible to running. And again
that does not tell you when it gets on the CPU.
> Regarding usleep_range disadvatage:
> 1. Usleep_range has a disadvantage that it does not allow the system to
> do optimal timer batching for power savings. Except that, Is there any
> other disadvantage?
Higher CPU usage.
> 2. Is the impact of optimal timer batching in systems like android or ubuntu
> with moderate cpu speed significant or it can be negligible also?
> To understand the impact better, it would be really appreciating if you could
> kindly explain in detail with some case and data input.
http://bfy.tw/3HaV
http://bfy.tw/3Han
....
Thanks,
tglx
next prev parent reply other threads:[~2015-12-14 19:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-07 17:50 Ques: [kernel/time/*] Is there any disadvantage in using sleep_range for more than 20ms delay ? Aniroop Mathur
2015-12-07 18:37 ` Thomas Gleixner
2015-12-08 2:45 ` Aniroop Mathur
2015-12-08 10:48 ` Thomas Gleixner
2015-12-08 15:35 ` Aniroop Mathur
2015-12-08 20:47 ` Thomas Gleixner
2015-12-09 16:14 ` Aniroop Mathur
[not found] ` <CADYu309kcmtmZTSbnZ-o7TXjVYReg-QqOE+5bgsGqvPASMa4Zg@mail.gmail.com>
[not found] ` <566D3EC0.50408@ladisch.de>
2015-12-14 19:06 ` Aniroop Mathur
2015-12-14 19:53 ` Thomas Gleixner [this message]
2015-12-21 17:22 ` Aniroop Mathur
-- strict thread matches above, loose matches on Subject: below --
2015-12-09 8:57 Aniroop Mathur
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=alpine.DEB.2.11.1512142042500.4336@nanos \
--to=tglx@linutronix.de \
--cc=a.mathur@samsung.com \
--cc=aniroop.mathur@gmail.com \
--cc=clemens@ladisch.de \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.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