From: Davidlohr Bueso <dave@stgolabs.net>
To: dhowells@redhat.com
Cc: linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, dave@stgolabs.net,
Davidlohr Bueso <dbueso@suse.de>
Subject: [PATCH] security, keys: Optimize barrier usage for Rmw atomic bitops
Date: Wed, 29 Jan 2020 10:06:25 -0800 [thread overview]
Message-ID: <20200129180625.24486-1-dave@stgolabs.net> (raw)
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@suse.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
next reply other threads:[~2020-01-29 18:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-29 18:06 Davidlohr Bueso [this message]
2020-03-20 17:09 ` [PATCH] security, keys: Optimize barrier usage for Rmw atomic bitops Davidlohr Bueso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200129180625.24486-1-dave@stgolabs.net \
--to=dave@stgolabs.net \
--cc=dbueso@suse.de \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).