* [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 related [flat|nested] 3+ messages in thread
* Re: [PATCH] vsprintf: Use non-atomic bitmap API when applicable
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
1 sibling, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2021-11-29 9:58 UTC (permalink / raw)
To: Christophe JAILLET
Cc: rostedt, senozhatsky, andriy.shevchenko, linux, linux-kernel,
kernel-janitors
On Sat 2021-11-27 15:27:35, Christophe JAILLET wrote:
> 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>
Makes sense:
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vsprintf: Use non-atomic bitmap API when applicable
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
1 sibling, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2021-12-06 13:05 UTC (permalink / raw)
To: Christophe JAILLET
Cc: rostedt, senozhatsky, andriy.shevchenko, linux, linux-kernel,
kernel-janitors
On Sat 2021-11-27 15:27:35, Christophe JAILLET wrote:
> 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>
The patch has been committed into printk/linux.git, branch for-5.17.
Best Regards,
Petr
^ 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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.