diff options
-rw-r--r-- | include/linux/wait_bit.h | 17 | ||||
-rw-r--r-- | mm/backing-dev.c | 2 |
2 files changed, 18 insertions, 1 deletions
diff --git a/include/linux/wait_bit.h b/include/linux/wait_bit.h index 9318b2166439..2b0072fa5e92 100644 --- a/include/linux/wait_bit.h +++ b/include/linux/wait_bit.h | |||
@@ -305,4 +305,21 @@ do { \ | |||
305 | __ret; \ | 305 | __ret; \ |
306 | }) | 306 | }) |
307 | 307 | ||
308 | /** | ||
309 | * clear_and_wake_up_bit - clear a bit and wake up anyone waiting on that bit | ||
310 | * | ||
311 | * @bit: the bit of the word being waited on | ||
312 | * @word: the word being waited on, a kernel virtual address | ||
313 | * | ||
314 | * You can use this helper if bitflags are manipulated atomically rather than | ||
315 | * non-atomically under a lock. | ||
316 | */ | ||
317 | static inline void clear_and_wake_up_bit(int bit, void *word) | ||
318 | { | ||
319 | clear_bit_unlock(bit, word); | ||
320 | /* See wake_up_bit() for which memory barrier you need to use. */ | ||
321 | smp_mb__after_atomic(); | ||
322 | wake_up_bit(word, bit); | ||
323 | } | ||
324 | |||
308 | #endif /* _LINUX_WAIT_BIT_H */ | 325 | #endif /* _LINUX_WAIT_BIT_H */ |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 023190c69dce..fa5e6d7406d1 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -383,7 +383,7 @@ static void wb_shutdown(struct bdi_writeback *wb) | |||
383 | * the barrier provided by test_and_clear_bit() above. | 383 | * the barrier provided by test_and_clear_bit() above. |
384 | */ | 384 | */ |
385 | smp_wmb(); | 385 | smp_wmb(); |
386 | clear_bit(WB_shutting_down, &wb->state); | 386 | clear_and_wake_up_bit(WB_shutting_down, &wb->state); |
387 | } | 387 | } |
388 | 388 | ||
389 | static void wb_exit(struct bdi_writeback *wb) | 389 | static void wb_exit(struct bdi_writeback *wb) |