* [to-be-updated] vsprintf-rework-bitmap_list_string.patch removed from -mm tree
@ 2021-09-09 20:57 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2021-09-09 20:57 UTC (permalink / raw)
To: aklimov, alobakin, andriy.shevchenko, dennis, jolsa, mm-commits,
ulf.hansson, will, wsa+renesas, yury.norov
The patch titled
Subject: vsprintf: rework bitmap_list_string
has been removed from the -mm tree. Its filename was
vsprintf-rework-bitmap_list_string.patch
This patch was dropped because an updated version will be merged
------------------------------------------------------
From: Yury Norov <yury.norov@gmail.com>
Subject: vsprintf: rework bitmap_list_string
bitmap_list_string() is very ineffective when printing bitmaps with long
ranges of set bits because it calls find_next_bit for each bit in the
bitmap. We can do better by detecting ranges of set bits.
In my environment, before/after is 943008/31008 ns.
[yury.norov@gmail.com: don't increment buf in bitmap_list_string]
Link: https://lkml.kernel.org/r/20210817193735.269942-1-yury.norov@gmail.com
Link: https://lkml.kernel.org/r/20210814211713.180533-18-yury.norov@gmail.com
Signed-off-by: Yury Norov <yury.norov@gmail.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: Alexander Lobakin <alobakin@pm.me>
Cc: Alexey Klimov <aklimov@redhat.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
lib/vsprintf.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
--- a/lib/vsprintf.c~vsprintf-rework-bitmap_list_string
+++ a/lib/vsprintf.c
@@ -1241,20 +1241,13 @@ char *bitmap_list_string(char *buf, char
struct printf_spec spec, const char *fmt)
{
int nr_bits = max_t(int, spec.field_width, 0);
- /* current bit is 'cur', most recently seen range is [rbot, rtop] */
- int cur, rbot, rtop;
bool first = true;
+ int rbot, rtop;
if (check_pointer(&buf, end, bitmap, spec))
return buf;
- rbot = cur = find_first_bit(bitmap, nr_bits);
- while (cur < nr_bits) {
- rtop = cur;
- cur = find_next_bit(bitmap, nr_bits, cur + 1);
- if (cur < nr_bits && cur <= rtop + 1)
- continue;
-
+ for_each_set_bitrange(rbot, rtop, bitmap, nr_bits) {
if (!first) {
if (buf < end)
*buf = ',';
@@ -1263,15 +1256,12 @@ char *bitmap_list_string(char *buf, char
first = false;
buf = number(buf, end, rbot, default_dec_spec);
- if (rbot < rtop) {
- if (buf < end)
- *buf = '-';
- buf++;
-
- buf = number(buf, end, rtop, default_dec_spec);
- }
+ if (rtop == rbot + 1)
+ continue;
- rbot = cur;
+ if (buf < end)
+ *buf = '-';
+ buf = number(buf + 1, end, rtop - 1, default_dec_spec);
}
return buf;
}
_
Patches currently in -mm which might be from yury.norov@gmail.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-09 20:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-09 20:57 [to-be-updated] vsprintf-rework-bitmap_list_string.patch removed from -mm tree akpm
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).