diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-10-16 10:09:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 13:01:50 -0400 |
commit | f20bf6125605acbbc7eb8c9420d7221c91aa83eb (patch) | |
tree | ce3dd753431dd32b346aa19f2f7b6bb84bb1f22e /kernel/time/timekeeping.c | |
parent | 8636225e8d23e6079d43f56faf415bd71b589dc0 (diff) |
time: introduce xtime_seconds
improve performance of sys_time(). sys_time() returns time in seconds,
but it does so by calling do_gettimeofday() and then returning the
tv_sec portion of the GTOD time. But the data structure "xtime", which
is updated by every timer/scheduler tick, already offers HZ granularity
time.
the patch improves the sysbench oltp macrobenchmark by 4-5% on an AMD
dual-core system:
v2.6.23:
#threads
1: transactions: 4073 (407.23 per sec.)
2: transactions: 8530 (852.81 per sec.)
3: transactions: 8321 (831.88 per sec.)
4: transactions: 8407 (840.58 per sec.)
5: transactions: 8070 (806.74 per sec.)
v2.6.23 + sys_time-speedup.patch:
1: transactions: 4281 (428.09 per sec.)
2: transactions: 8910 (890.85 per sec.)
3: transactions: 8659 (865.79 per sec.)
4: transactions: 8676 (867.34 per sec.)
5: transactions: 8532 (852.91 per sec.)
and by 4-5% on an Intel dual-core system too:
2.6.23:
1: transactions: 4560 (455.94 per sec.)
2: transactions: 10094 (1009.30 per sec.)
3: transactions: 9755 (975.36 per sec.)
4: transactions: 9859 (985.78 per sec.)
5: transactions: 9701 (969.72 per sec.)
2.6.23 + sys_time-speedup.patch:
1: transactions: 4779 (477.84 per sec.)
2: transactions: 10103 (1010.14 per sec.)
3: transactions: 10141 (1013.93 per sec.)
4: transactions: 10371 (1036.89 per sec.)
5: transactions: 10178 (1017.50 per sec.)
(the more CPUs the system has, the more speedup this patch gives for
this particular workload.)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r-- | kernel/time/timekeeping.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 4ad79f6bdec6..7e8983aecf83 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -49,19 +49,12 @@ struct timespec wall_to_monotonic __attribute__ ((aligned (16))); | |||
49 | static unsigned long total_sleep_time; /* seconds */ | 49 | static unsigned long total_sleep_time; /* seconds */ |
50 | EXPORT_SYMBOL(xtime); | 50 | EXPORT_SYMBOL(xtime); |
51 | 51 | ||
52 | |||
53 | #ifdef CONFIG_NO_HZ | ||
54 | static struct timespec xtime_cache __attribute__ ((aligned (16))); | 52 | static struct timespec xtime_cache __attribute__ ((aligned (16))); |
55 | static inline void update_xtime_cache(u64 nsec) | 53 | static inline void update_xtime_cache(u64 nsec) |
56 | { | 54 | { |
57 | xtime_cache = xtime; | 55 | xtime_cache = xtime; |
58 | timespec_add_ns(&xtime_cache, nsec); | 56 | timespec_add_ns(&xtime_cache, nsec); |
59 | } | 57 | } |
60 | #else | ||
61 | #define xtime_cache xtime | ||
62 | /* We do *not* want to evaluate the argument for this case */ | ||
63 | #define update_xtime_cache(n) do { } while (0) | ||
64 | #endif | ||
65 | 58 | ||
66 | static struct clocksource *clock; /* pointer to current clocksource */ | 59 | static struct clocksource *clock; /* pointer to current clocksource */ |
67 | 60 | ||