On Tue, Jun 23, 2026 at 4:25 AM David Laight david.laight.linux@gmail.com wrote:
On Mon, 22 Jun 2026 17:26:10 -0400 David Hu xuehaohu@google.com wrote:
On Mon, Jun 22, 2026 at 4:13 AM David Laight david.laight.linux@gmail.com wrote:
Hi David,
Thank you for your review. You raised many good points regarding optimizations here. I'll switch to using 2G as the max entry size (`SZ_2G` from `linux/sizes.h`), and remove divisions and multiplications. I'll also replace the `for()` loop with `while (length)`, and drop `min_t()` in favor of `min()` by casting `SZ_2G` to `size_t`.
You shouldn't need a cast at all.
Hi David,
You are right. It looks like `min(length, CONSTANT)` works well here without triggering any type mismatch warnings, regardless of whether `CONSTANT` is `SZ_1G` (`int`), `SZ_2G` (`unsigned int`), `SZ_4G` (`unsigned long long`), or larger. I'll drop the cast and send out a v3 shortly.
Thanks, David