diff options
author | Andrew Morton <akpm@osdl.org> | 2004-05-14 05:40:57 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-05-14 05:40:57 -0700 |
commit | 5b59eadfbf215aa20885d06ce81f263df99cc009 (patch) | |
tree | c52dedc42d411a8e45b771b779c7f7a87164144c /kernel | |
parent | 1b104df13b1e99ebaa10df9b88b79276b28ea804 (diff) | |
download | history-5b59eadfbf215aa20885d06ce81f263df99cc009.tar.gz |
[PATCH] MSEC_TO_JIFFIES consolidation
From: Ingo Molnar <mingo@elte.hu>
We have various different implementations of MSEC[S]_TO_JIFFIES and
JIFFIES_TO_MSEC[S]. We recently had a compile-time clash in USB.
Fix all that up.
- The SCTP version was very inefficient. Hopefully this version is accurate
enough.
- Optimise for the HZ=100 and HZ=1000 cases
- This version does round-up, so sleep(9 milliseconds) works OK on 100HZ.
- We still have lots of jiffies_to_msec and msec_to_jiffies implementations.
From: William Lee Irwin III <wli@holomorphy.com>
Optimize the cases where HZ is a divisor of 1000 or vice-versa in
JIFFIES_TO_MSECS() and MSECS_TO_JIFFIES() by allowing the nonvanishing(!)
integral ratios to appear as a parenthesized expressions eligible for
constant folding optimizations.
From: me
Use typesafe inlines for the jiffies-to-millisecond conversion functions.
This means that milliseconds officially takes the type `unsigned int'.
All current callers seem to be OK with that.
Drivers need to be fixed up to use this instead of their private versions.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 25196140ec741a..d8147eb6a84368 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -75,13 +75,6 @@ #define NS_TO_JIFFIES(TIME) ((TIME) / (1000000000 / HZ)) #define JIFFIES_TO_NS(TIME) ((TIME) * (1000000000 / HZ)) -#ifndef JIFFIES_TO_MSEC -# define JIFFIES_TO_MSEC(x) ((x) * 1000 / HZ) -#endif -#ifndef MSEC_TO_JIFFIES -# define MSEC_TO_JIFFIES(x) ((x) * HZ / 1000) -#endif - /* * These are the 'tuning knobs' of the scheduler: * @@ -1880,7 +1873,7 @@ static void rebalance_tick(int this_cpu, runqueue_t *this_rq, interval *= sd->busy_factor; /* scale ms to jiffies */ - interval = MSEC_TO_JIFFIES(interval); + interval = MSECS_TO_JIFFIES(interval); if (unlikely(!interval)) interval = 1; |