diff options
author | Peter Zijlstra <peterz@infradead.org> | 2017-05-02 14:22:07 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-05-15 11:15:15 +0300 |
commit | 59eaef78bfea88fcbbd7b9b48ccf513aae1522c3 (patch) | |
tree | eb668f47caa16eab8c3ac280654a28d25890ddee /arch/x86/events | |
parent | 8309f86cd41e8714526867177facf7a316d9be53 (diff) | |
download | linux-59eaef78bfea88fcbbd7b9b48ccf513aae1522c3.tar.xz |
x86/tsc: Remodel cyc2ns to use seqcount_latch()
Replace the custom multi-value scheme with the more regular
seqcount_latch() scheme. Along with scrapping a lot of lines, the latch
scheme is better documented and used in more places.
The immediate benefit however is not being limited on the update side.
The current code has a limit where the writers block which is hit by
future changes.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/events')
-rw-r--r-- | arch/x86/events/core.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 580b60f5ac83..d3990462582c 100644 --- a/arch/x86/events/core.c +++ b/arch/x86/events/core.c @@ -2255,7 +2255,7 @@ static struct pmu pmu = { void arch_perf_update_userpage(struct perf_event *event, struct perf_event_mmap_page *userpg, u64 now) { - struct cyc2ns_data *data; + struct cyc2ns_data data; u64 offset; userpg->cap_user_time = 0; @@ -2267,17 +2267,17 @@ void arch_perf_update_userpage(struct perf_event *event, if (!using_native_sched_clock() || !sched_clock_stable()) return; - data = cyc2ns_read_begin(); + cyc2ns_read_begin(&data); - offset = data->cyc2ns_offset + __sched_clock_offset; + offset = data.cyc2ns_offset + __sched_clock_offset; /* * Internal timekeeping for enabled/running/stopped times * is always in the local_clock domain. */ userpg->cap_user_time = 1; - userpg->time_mult = data->cyc2ns_mul; - userpg->time_shift = data->cyc2ns_shift; + userpg->time_mult = data.cyc2ns_mul; + userpg->time_shift = data.cyc2ns_shift; userpg->time_offset = offset - now; /* @@ -2289,7 +2289,7 @@ void arch_perf_update_userpage(struct perf_event *event, userpg->time_zero = offset; } - cyc2ns_read_end(data); + cyc2ns_read_end(); } void |