mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] vsprintf: Use non-atomic bitmap API when applicable
@ 2021-11-27 14:27 Christophe JAILLET
  2021-11-29  9:58 ` Petr Mladek
  2021-12-06 13:05 ` Petr Mladek
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2021-11-27 14:27 UTC (permalink / raw)
  To: pmladek, rostedt, senozhatsky, andriy.shevchenko, linux
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET

The 'set' bitmap is local to this function. No concurrent access to it is
possible.
So prefer the non-atomic '__[set|clear]_bit()' function to save a few
cycles.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 lib/vsprintf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 9a2bc00b5952..c130dcaca5e2 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -3566,7 +3566,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
 				++fmt;
 
 			for ( ; *fmt && *fmt != ']'; ++fmt, ++len)
-				set_bit((u8)*fmt, set);
+				__set_bit((u8)*fmt, set);
 
 			/* no ']' or no character set found */
 			if (!*fmt || !len)
@@ -3576,7 +3576,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
 			if (negate) {
 				bitmap_complement(set, set, 256);
 				/* exclude null '\0' byte */
-				clear_bit(0, set);
+				__clear_bit(0, set);
 			}
 
 			/* match must be non-empty */
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-06 13:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-27 14:27 [PATCH] vsprintf: Use non-atomic bitmap API when applicable Christophe JAILLET
2021-11-29  9:58 ` Petr Mladek
2021-12-06 13:05 ` Petr Mladek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®