Sashiko discussions
 help / color / mirror / Atom feed
From: Baokun Li <libaokun@linux.alibaba.com>
To: sashiko@lists.linux.dev
Cc: tytso@mit.edu
Subject: Re: [PATCH RFC 03/17] lib/crc: crc_kunit: add benchmark for crc32c_flip_range()
Date: Sun, 10 May 2026 18:03:05 +0800	[thread overview]
Message-ID: <ab455ad7-0f4f-404a-a774-da4b32da1b7b@linux.alibaba.com> (raw)
In-Reply-To: <20260508205415.8B843C2BCB0@smtp.kernel.org>

在 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


           reply	other threads:[~2026-05-10 10:03 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20260508205415.8B843C2BCB0@smtp.kernel.org>]

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=ab455ad7-0f4f-404a-a774-da4b32da1b7b@linux.alibaba.com \
    --to=libaokun@linux.alibaba.com \
    --cc=sashiko@lists.linux.dev \
    --cc=tytso@mit.edu \
    /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