Re: [PATCH 25/35] move round_up/down to kernel.h

From: H. Peter Anvin
Date: Sat Feb 13 2010 - 16:58:17 EST


On 02/13/2010 12:11 PM, Andrew Morton wrote:
>
>> Both of these names already exist -- yes, a rename is probably in order
>> but it should be a separate patchset.
>
> More than a rename is certainly in order.
>
> And it's not clear who will be shovelling that muck, and when. We
> haven't even worked out what needs to be done.
>

OK, I was under the impression that all that was really called for was a
rename -- which is pretty straightforward, after all; it can mostly be
scripted.

I guess there is a bigger discussion here, and as such we should have it
now. Since in the end, though, it is going to have to be a cross-kernel
change, it is probably one of those things that should be done "just
before -rc1".

Let's figure out what is needed. At a very minimum, we have the
following operations:

-> align downward, arbitrary alignment
-> align upward, arbitrary alignment - current roundup()
-> align downward, power of 2 alignment - current round_down()
-> align upward, power of 2 alignment - current round_up()
-> truncate downward to a power of 2 - current rounddown_pow_of_two()
-> truncate upward to a power of 2 - current roundup_pow_of_two()

Then we have some oddballs:

__ALIGN_MASK(x,m) == round_up(x, m-1)
ALIGN(x,a) == round_up(x, m)
PTR_ALIGN(p, a) == round_up with wrapper
DIV_ROUND_UP(n,d) == roundup(n,d)/d
DIV_ROUND_CLOSEST(n,d)

A structural renaming is certainly in order, but what more are you
looking for, here?

-hpa

--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/