[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200320170902.ilwugh33co3poqm3@linux-p48b>
Date: Fri, 20 Mar 2020 10:09:02 -0700
From: Davidlohr Bueso <dave@...olabs.net>
To: dhowells@...hat.com
Cc: linux-security-module@...r.kernel.org,
linux-kernel@...r.kernel.org, Davidlohr Bueso <dbueso@...e.de>
Subject: Re: [PATCH] security, keys: Optimize barrier usage for Rmw atomic
bitops
ping?
On Wed, 29 Jan 2020, Davidlohr Bueso wrote:
>For both set and clear_bit, we can avoid the unnecessary barriers
>on non LL/SC architectures, such as x86. Instead, use the
>smp_mb__{before,after}_atomic() calls.
>
>Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
>---
> security/keys/gc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/security/keys/gc.c b/security/keys/gc.c
>index 671dd730ecfc..ce7b4c22e3c4 100644
>--- a/security/keys/gc.c
>+++ b/security/keys/gc.c
>@@ -102,7 +102,7 @@ void key_gc_keytype(struct key_type *ktype)
>
> key_gc_dead_keytype = ktype;
> set_bit(KEY_GC_REAPING_KEYTYPE, &key_gc_flags);
>- smp_mb();
>+ smp_mb__after_atomic();
> set_bit(KEY_GC_REAP_KEYTYPE, &key_gc_flags);
>
> kdebug("schedule");
>@@ -308,7 +308,7 @@ static void key_garbage_collector(struct work_struct *work)
>
> if (unlikely(gc_state & KEY_GC_REAPING_DEAD_3)) {
> kdebug("dead wake");
>- smp_mb();
>+ smp_mb__before_atomic();
> clear_bit(KEY_GC_REAPING_KEYTYPE, &key_gc_flags);
> wake_up_bit(&key_gc_flags, KEY_GC_REAPING_KEYTYPE);
> }
>--
>2.16.4
>
Powered by blists - more mailing lists