mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: slow nanosleep?
Date: Wed, 8 Sep 2010 16:30:07 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1009081626460.2477@localhost6.localdomain6> (raw)
In-Reply-To: <OF58F81314.CCA2DE14-ONC1257798.004E57E1-C1257798.004EA9E9@transmode.se>

On Wed, 8 Sep 2010, Joakim Tjernlund wrote:
> Thomas Gleixner <tglx@linutronix.de> wrote on 2010/09/08 15:52:23:
> > On Wed, 8 Sep 2010, Joakim Tjernlund wrote:
> > > 
> > > Actually, it takes 120 us. The 20 us was when I had Thomas
> > > timeout == 0 fast path patch applied(forgot to remove it).
> > > Without that patch it takes about 115 us. So it seems it takes
> > > 115-20=95 us to turn the timer wheel on my ppc.
> >
> > You might fire up the tracer to look where it spends that time.
> 
> This helps for short(1 ns) nanosleeps, sleeps for 25 us. No idea
> if this is any good, just tossing it out for you to tear apart :)
> 
> diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
> index 5c69e99..e612016 100644
> --- a/kernel/hrtimer.c
> +++ b/kernel/hrtimer.c
> @@ -1545,6 +1545,9 @@ long __sched hrtimer_nanosleep_restart(struct restart_block *restart)
>  				HRTIMER_MODE_ABS);
>  	hrtimer_set_expires_tv64(&t.timer, restart->nanosleep.expires);
> 
> +	if (!hrtimer_active(&t.timer))
> +		goto out;

That actually will return for any expiry time. The timer is armed in
do_nanosleep() not in hrtimer_set_expires_tv64() /
hrtimer_set_expires_range_ns()

Thanks,

	tglx

  reply	other threads:[~2010-09-08 14:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-08  7:45 Joakim Tjernlund
2010-09-08  7:56 ` Eric Dumazet
2010-09-08  8:04   ` Joakim Tjernlund
2010-09-08  8:24     ` Eric Dumazet
2010-09-08  9:12       ` Joakim Tjernlund
2010-09-08  9:51         ` Thomas Gleixner
2010-09-08 10:14           ` Eric Dumazet
2010-09-08 10:17             ` Thomas Gleixner
2010-09-08 12:11           ` Joakim Tjernlund
2010-09-08 12:43             ` Thomas Gleixner
2010-09-08 13:00               ` Peter Zijlstra
2010-09-08 13:44                 ` Joakim Tjernlund
2010-09-08 13:51                   ` Peter Zijlstra
2010-09-08 13:52                   ` Thomas Gleixner
2010-09-08 14:19                     ` Joakim Tjernlund
2010-09-08 14:30                       ` Thomas Gleixner [this message]
2010-09-08 14:33                         ` Joakim Tjernlund

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.LFD.2.00.1009081626460.2477@localhost6.localdomain6 \
    --to=tglx@linutronix.de \
    --cc=eric.dumazet@gmail.com \
    --cc=joakim.tjernlund@transmode.se \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®