* Re: [PATCH RFC 03/17] lib/crc: crc_kunit: add benchmark for crc32c_flip_range()
[not found] ` <20260508205415.8B843C2BCB0@smtp.kernel.org>
@ 2026-05-10 10:03 ` Baokun Li
0 siblings, 0 replies; only message in thread
From: Baokun Li @ 2026-05-10 10:03 UTC (permalink / raw)
To: sashiko; +Cc: tytso
在 2026/5/9 04:54, sashiko-bot@kernel.org 写道:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Native 64-bit division (`/ 10`) and modulo (`% 10`) on `u64` values will cause build failures on 32-bit architectures.
> --
>
> commit d1411c693c30ea46d5821fc2f72f158dd0cea8d2
> Author: Baokun Li <libaokun@linux.alibaba.com>
>
> lib/crc: crc_kunit: add benchmark for crc32c_flip_range()
>
> This commit adds a kunit benchmark to compare crc32c_flip_range() against
> full crc32c recomputation for various bitmap sizes.
>
>> diff --git a/lib/crc/tests/crc_kunit.c b/lib/crc/tests/crc_kunit.c
>> --- a/lib/crc/tests/crc_kunit.c
>> +++ b/lib/crc/tests/crc_kunit.c
> [ ... ]
>
>> +static void crc32c_flip_range_benchmark(struct kunit *test)
>> +{
> [ ... ]
>
>> + kunit_info(test,
>> + "bitmap=%zu: flip_range=%llu ns, full_crc=%llu ns, speedup=%llu.%01llux\n",
>> + buflen,
>> + div64_u64(t_flip, num_iters),
>> + div64_u64(t_full, num_iters),
>> + div64_u64(t_full * 10, t_flip ? t_flip : 1) / 10,
>> + div64_u64(t_full * 10, t_flip ? t_flip : 1) % 10);
> Since div64_u64() returns a u64, will applying the native division (/ 10)
> and modulo (% 10) operators directly to this return value cause build
> failures on 32-bit architectures?
>
> The kernel typically prevents native 64-bit division to catch performance
> issues, which results in linker errors for __udivdi3 and __umoddi3 on 32-bit
> builds.
>
> Should this use a helper like div_u64_rem() instead?
>
>
Yes, it should. I’ll update it to use the div_u64_rem() helper.
Thanks,
Baokun
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-10 10:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260508121539.4174601-4-libaokun@linux.alibaba.com>
[not found] ` <20260508205415.8B843C2BCB0@smtp.kernel.org>
2026-05-10 10:03 ` [PATCH RFC 03/17] lib/crc: crc_kunit: add benchmark for crc32c_flip_range() Baokun Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox