[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090421063523.GA8020@elte.hu>
Date: Tue, 21 Apr 2009 08:35:23 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Jon Hunter <jon-hunter@...com>,
Thomas Gleixner <tglx@...utronix.de>,
John Stultz <johnstul@...ibm.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC][PATCH] Dynamic Tick: Allow 32-bit machines to sleep for
more than 2.15 seconds
* Jon Hunter <jon-hunter@...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@...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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists