Re: [PATCH v4 next 0/9] Implement mul_u64_u64_div_u64_roundup()

From: David Laight

Date: Fri Oct 31 2025 - 12:17:12 EST


On Fri, 31 Oct 2025 14:52:56 +0100
Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> On 10/29, David Laight wrote:
> >
> > The pwm-stm32.c code wants a 'rounding up' version of mul_u64_u64_div_u64().
> > This can be done simply by adding 'divisor - 1' to the 128bit product.
> > Implement mul_u64_add_u64_div_u64(a, b, c, d) = (a * b + c)/d based on the
> > existing code.
> > Define mul_u64_u64_div_u64(a, b, d) as mul_u64_add_u64_div_u64(a, b, 0, d) and
> > mul_u64_u64_div_u64_roundup(a, b, d) as mul_u64_add_u64_div_u64(a, b, d-1, d).
>
> Sorry for the noise. Can't review due to the lack of knowledge.
> But this reminds me... What about
>
> [PATCH v3 1/2] x86/math64: handle #DE in mul_u64_u64_div_u64()
> https://lore.kernel.org/all/20250815164055.GA13444@xxxxxxxxxx
>
> ?
>
> should I resend it once again or we don't care?

I'd remembered that as well.
I'll do a new version of that on top as a separate patch.
Probably when this set has been merged further.

David