bdi: use irqsave variant of refcount_dec_and_lock()
authorAnna-Maria Gleixner <[email protected]>
Wed, 22 Aug 2018 04:55:35 +0000 (21:55 -0700)
committerLinus Torvalds <[email protected]>
Wed, 22 Aug 2018 17:52:46 +0000 (10:52 -0700)
The irqsave variant of refcount_dec_and_lock handles irqsave/restore when
taking/releasing the spin lock.  With this variant the call of
local_irq_save/restore is no longer required.

[[email protected]: s@atomic_dec_and_lock@refcount_dec_and_lock@g]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Anna-Maria Gleixner <[email protected]>
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/backing-dev.c

index 55a233d75f399519e2308792a6ff930f038dfcbd..f5981e9d6ae2e73761879023584ff378ebfcb1b8 100644 (file)
@@ -473,11 +473,8 @@ void wb_congested_put(struct bdi_writeback_congested *congested)
 {
        unsigned long flags;
 
-       local_irq_save(flags);
-       if (!refcount_dec_and_lock(&congested->refcnt, &cgwb_lock)) {
-               local_irq_restore(flags);
+       if (!refcount_dec_and_lock_irqsave(&congested->refcnt, &cgwb_lock, &flags))
                return;
-       }
 
        /* bdi might already have been destroyed leaving @congested unlinked */
        if (congested->__bdi) {