All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jon Hunter <jon-hunter@ti.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	John Stultz <johnstul@us.ibm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleep for more than 2.15 seconds
Date: Tue, 21 Apr 2009 08:35:23 +0200	[thread overview]
Message-ID: <20090421063523.GA8020@elte.hu> (raw)
In-Reply-To: <49ECE615.2010800@ti.com>


* Jon Hunter <jon-hunter@ti.com> wrote:

> Hello,
>
> From reviewing the dynamic tick code, I noticed that the 
> "max_delta_ns" member of the "clock_event_device" structure, 
> represents the upper limit between timer events in nanoseconds. 
> The variable, "max_delta_ns", is defined as an unsigned long. An 
> unsigned long is a 32-bit integer for 32-bit machines and is a 
> 64-bit integer for 64-bit machines (if -m64 option is used for 
> gcc). Also see [1].
>
> The variable, "max_delta_ns", is configured by calling function 
> "clockevent_delta2ns()". The maximum value that "max_delta_ns" can 
> be set to by calling clockevent_delta2ns(), is LONG_MAX. For a 
> 32-bit machine LONG_MAX is equal to 0x7fffffff and in nanoseconds 
> this equates to ~2.15 seconds. Hence, the maximum sleep time for a 
> 32-bit machine is ~2.15 seconds, where as for a 64-bit machine it 
> will be many years.
>
> Therefore, I wanted to propose changing the type of max_delta_ns 
> to be "unsigned long long" instead of "unsigned long". My 
> understanding is that a variable of type "unsigned long long" is 
> 64-bits for both 32-bit and 64-bit machines and hence this would 
> allow a 32-bit machine to sleep for longer than ~2.15 seconds. 
> Please note that I also ended up making "min_delta_ns" of type 
> "unsigned long long" too and although this is probably very 
> unnecessary, it made the patch simpler. See below.
>
> Anyway, making this change has allowed my 32-bit machine to sleep 
> for longer than ~2.15 seconds and thought this could be of 
> interest to others. Your comments/feedback would be appreciated.
>
> [1] http://en.wikipedia.org/wiki/64-bit#64-bit_data_models
>
> Cheers
> Jon
>
>
> Signed-off-by: Jon Hunter <jon-hunter@ti.com>
> ---
>  include/linux/clockchips.h |    6 +++---
>  kernel/hrtimer.c           |    2 +-
>  kernel/time/clockevents.c  |   10 +++++-----
>  kernel/time/tick-oneshot.c |    2 +-
>  kernel/time/timer_list.c   |    4 ++--
>  5 files changed, 12 insertions(+), 12 deletions(-)

Looks like a good thing at first sight. Thomas, John, what do you 
think?

	Ingo

  reply	other threads:[~2009-04-21  6:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-20 21:16 [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleep for more than 2.15 seconds Jon Hunter
2009-04-21  6:35 ` Ingo Molnar [this message]
2009-04-21 20:32   ` john stultz
2009-04-21 23:20     ` Jon Hunter
2009-04-22  0:02       ` john stultz
2009-05-07 14:52         ` Jon Hunter
2009-05-08  0:54           ` [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleep formore " john stultz
2009-05-08 16:05             ` Jon Hunter
2009-05-09  0:51               ` [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleep formorethan " john stultz
2009-05-12 23:35                 ` Jon Hunter
2009-05-12 23:58                   ` [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleep formorethan2.15 seconds john stultz
2009-05-13 15:14                     ` Jon Hunter
2009-05-13 16:41                       ` John Stultz
2009-05-13 17:54                         ` Jon Hunter
2009-05-13 19:21                           ` John Stultz
2009-05-15 16:35                             ` Jon Hunter
2009-05-15 18:55                               ` Jon Hunter
2009-05-16  1:29                                 ` John Stultz
2009-05-16  1:18                               ` John Stultz
2009-05-22 18:21                                 ` Jon Hunter
2009-05-22 19:23                                   ` john stultz
2009-05-22 19:54                                     ` Thomas Gleixner
2009-05-26 15:12                                       ` Jon Hunter
2009-05-26 20:26                                         ` john stultz
2009-05-22 19:59                                   ` Thomas Gleixner
2009-04-22  0:05       ` [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleep for more than 2.15 seconds john stultz
2009-04-22  3:07         ` Jon Hunter
2009-04-22 15:30           ` Chris Friesen
2009-04-22 17:04             ` Jon Hunter
2009-04-22 18:53               ` Geert Uytterhoeven

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=20090421063523.GA8020@elte.hu \
    --to=mingo@elte.hu \
    --cc=johnstul@us.ibm.com \
    --cc=jon-hunter@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.