]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/frontswap.c: use non-atomic '__set_bit()' when possible
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Fri, 14 Jan 2022 22:05:26 +0000 (14:05 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 15 Jan 2022 14:30:26 +0000 (16:30 +0200)
The 'a' and 'b' bitmaps are local to this function, so no concurrent
access can occur.  So the non-atomic '__set_bit()' can be used to save a
few cycles.

Link: https://lkml.kernel.org/r/e52476da5cee57151745c5c3c934a69798dc6fa4.1638132190.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/frontswap.c

index 130e301c5ac034a3749ce586665af1386e13258a..6bed12260dea745759f71f9c2b99fd9920331efe 100644 (file)
@@ -127,7 +127,7 @@ void frontswap_register_ops(struct frontswap_ops *ops)
        spin_lock(&swap_lock);
        plist_for_each_entry(si, &swap_active_head, list) {
                if (!WARN_ON(!si->frontswap_map))
-                       set_bit(si->type, a);
+                       __set_bit(si->type, a);
        }
        spin_unlock(&swap_lock);
 
@@ -149,7 +149,7 @@ void frontswap_register_ops(struct frontswap_ops *ops)
        spin_lock(&swap_lock);
        plist_for_each_entry(si, &swap_active_head, list) {
                if (si->frontswap_map)
-                       set_bit(si->type, b);
+                       __set_bit(si->type, b);
        }
        spin_unlock(&swap_lock);