aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/vdso
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-02-28 14:46:04 -0500
committerJohn Stultz <john.stultz@linaro.org>2012-03-15 21:17:58 -0400
commit2ab516575f2f273b19d95140d02c54612201e80a (patch)
tree26db92249e65754d99759af21fd207507a81cec8 /arch/x86/vdso
parent6c260d586343f7f78239d90aa9e2cfed02f74ff3 (diff)
x86: vdso: Use seqcount instead of seqlock
The update of the vdso data happens under xtime_lock, so adding a nested lock is pointless. Just use a seqcount to sync the readers. Reviewed-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'arch/x86/vdso')
-rw-r--r--arch/x86/vdso/vclock_gettime.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
index 7eeb1f6188e..944c5e5d6b6 100644
--- a/arch/x86/vdso/vclock_gettime.c
+++ b/arch/x86/vdso/vclock_gettime.c
@@ -100,12 +100,12 @@ notrace static noinline int do_realtime(struct timespec *ts)
100 int mode; 100 int mode;
101 101
102 do { 102 do {
103 seq = read_seqbegin(&gtod->lock); 103 seq = read_seqcount_begin(&gtod->seq);
104 mode = gtod->clock.vclock_mode; 104 mode = gtod->clock.vclock_mode;
105 ts->tv_sec = gtod->wall_time_sec; 105 ts->tv_sec = gtod->wall_time_sec;
106 ts->tv_nsec = gtod->wall_time_nsec; 106 ts->tv_nsec = gtod->wall_time_nsec;
107 ns = vgetns(); 107 ns = vgetns();
108 } while (unlikely(read_seqretry(&gtod->lock, seq))); 108 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
109 109
110 timespec_add_ns(ts, ns); 110 timespec_add_ns(ts, ns);
111 return mode; 111 return mode;
@@ -117,13 +117,13 @@ notrace static noinline int do_monotonic(struct timespec *ts)
117 int mode; 117 int mode;
118 118
119 do { 119 do {
120 seq = read_seqbegin(&gtod->lock); 120 seq = read_seqcount_begin(&gtod->seq);
121 mode = gtod->clock.vclock_mode; 121 mode = gtod->clock.vclock_mode;
122 secs = gtod->wall_time_sec; 122 secs = gtod->wall_time_sec;
123 ns = gtod->wall_time_nsec + vgetns(); 123 ns = gtod->wall_time_nsec + vgetns();
124 secs += gtod->wall_to_monotonic.tv_sec; 124 secs += gtod->wall_to_monotonic.tv_sec;
125 ns += gtod->wall_to_monotonic.tv_nsec; 125 ns += gtod->wall_to_monotonic.tv_nsec;
126 } while (unlikely(read_seqretry(&gtod->lock, seq))); 126 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
127 127
128 /* wall_time_nsec, vgetns(), and wall_to_monotonic.tv_nsec 128 /* wall_time_nsec, vgetns(), and wall_to_monotonic.tv_nsec
129 * are all guaranteed to be nonnegative. 129 * are all guaranteed to be nonnegative.
@@ -142,10 +142,10 @@ notrace static noinline int do_realtime_coarse(struct timespec *ts)
142{ 142{
143 unsigned long seq; 143 unsigned long seq;
144 do { 144 do {
145 seq = read_seqbegin(&gtod->lock); 145 seq = read_seqcount_begin(&gtod->seq);
146 ts->tv_sec = gtod->wall_time_coarse.tv_sec; 146 ts->tv_sec = gtod->wall_time_coarse.tv_sec;
147 ts->tv_nsec = gtod->wall_time_coarse.tv_nsec; 147 ts->tv_nsec = gtod->wall_time_coarse.tv_nsec;
148 } while (unlikely(read_seqretry(&gtod->lock, seq))); 148 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
149 return 0; 149 return 0;
150} 150}
151 151
@@ -153,12 +153,12 @@ notrace static noinline int do_monotonic_coarse(struct timespec *ts)
153{ 153{
154 unsigned long seq, ns, secs; 154 unsigned long seq, ns, secs;
155 do { 155 do {
156 seq = read_seqbegin(&gtod->lock); 156 seq = read_seqcount_begin(&gtod->seq);
157 secs = gtod->wall_time_coarse.tv_sec; 157 secs = gtod->wall_time_coarse.tv_sec;
158 ns = gtod->wall_time_coarse.tv_nsec; 158 ns = gtod->wall_time_coarse.tv_nsec;
159 secs += gtod->wall_to_monotonic.tv_sec; 159 secs += gtod->wall_to_monotonic.tv_sec;
160 ns += gtod->wall_to_monotonic.tv_nsec; 160 ns += gtod->wall_to_monotonic.tv_nsec;
161 } while (unlikely(read_seqretry(&gtod->lock, seq))); 161 } while (unlikely(read_seqcount_retry(&gtod->seq, seq)));
162 162
163 /* wall_time_nsec and wall_to_monotonic.tv_nsec are 163 /* wall_time_nsec and wall_to_monotonic.tv_nsec are
164 * guaranteed to be between 0 and NSEC_PER_SEC. 164 * guaranteed to be between 0 and NSEC_PER_SEC.