diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-10-20 06:25:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-10-20 06:25:12 -0400 |
commit | 188768f3c0727d4cb95eaad6c67799449aebcc03 (patch) | |
tree | 95737da57f72083fad834b3573935475407b17bb /kernel | |
parent | 589f1222e043ab1f5cbce558cfaed0c0fa76e7bb (diff) | |
parent | ff229eee3d897f52bd001c841f2d3cce8853ecdc (diff) |
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull hrtimer fixlet from Thomas Gleixner:
"A single commit annotating the lockcless access to timer->base with
READ_ONCE() and adding the WRITE_ONCE() counterparts for completeness"
* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
hrtimer: Annotate lockless access to timer->base
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time/hrtimer.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 0d4dc241c0fb..65605530ee34 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c | |||
@@ -164,7 +164,7 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, | |||
164 | struct hrtimer_clock_base *base; | 164 | struct hrtimer_clock_base *base; |
165 | 165 | ||
166 | for (;;) { | 166 | for (;;) { |
167 | base = timer->base; | 167 | base = READ_ONCE(timer->base); |
168 | if (likely(base != &migration_base)) { | 168 | if (likely(base != &migration_base)) { |
169 | raw_spin_lock_irqsave(&base->cpu_base->lock, *flags); | 169 | raw_spin_lock_irqsave(&base->cpu_base->lock, *flags); |
170 | if (likely(base == timer->base)) | 170 | if (likely(base == timer->base)) |
@@ -244,7 +244,7 @@ again: | |||
244 | return base; | 244 | return base; |
245 | 245 | ||
246 | /* See the comment in lock_hrtimer_base() */ | 246 | /* See the comment in lock_hrtimer_base() */ |
247 | timer->base = &migration_base; | 247 | WRITE_ONCE(timer->base, &migration_base); |
248 | raw_spin_unlock(&base->cpu_base->lock); | 248 | raw_spin_unlock(&base->cpu_base->lock); |
249 | raw_spin_lock(&new_base->cpu_base->lock); | 249 | raw_spin_lock(&new_base->cpu_base->lock); |
250 | 250 | ||
@@ -253,10 +253,10 @@ again: | |||
253 | raw_spin_unlock(&new_base->cpu_base->lock); | 253 | raw_spin_unlock(&new_base->cpu_base->lock); |
254 | raw_spin_lock(&base->cpu_base->lock); | 254 | raw_spin_lock(&base->cpu_base->lock); |
255 | new_cpu_base = this_cpu_base; | 255 | new_cpu_base = this_cpu_base; |
256 | timer->base = base; | 256 | WRITE_ONCE(timer->base, base); |
257 | goto again; | 257 | goto again; |
258 | } | 258 | } |
259 | timer->base = new_base; | 259 | WRITE_ONCE(timer->base, new_base); |
260 | } else { | 260 | } else { |
261 | if (new_cpu_base != this_cpu_base && | 261 | if (new_cpu_base != this_cpu_base && |
262 | hrtimer_check_target(timer, new_base)) { | 262 | hrtimer_check_target(timer, new_base)) { |