Subject: Re: linux-next: manual merge of the rr tree

From: Christoph Lameter <[email-masked]>
Date: Fri, 9 Jan 2009 08:42:09 -0600 (CST)

On Thu, 8 Jan 2009, David Miller wrote:

> > The wrapping is okay on platforms that use straight 2 complement without
> > additional tricks in high bits. Some platforms do not wrap.
>
> It's not okay for loop termination conditions and that's where GCC
> takes advantage of this invariant.

Can you give me a concrete code example?

> Otherwise, if overflow is possible, tranforming an array index
> comparison into a pointer comparison is no longer legal.

This means that access to an object immediately before or after would wrap
around. If the object is not near 0 or near the end of the address space
then such a thing cannot occur. We have the ZERO page at address 0 so the
lower end is taken care and usually there are also special uses for very
high addresses.

The wrapping is mainly an issue if the percpu area is linked to very high
addresses but later the per cpu areas for the individual processors are
allocated on relatively low addresses. The address calculation of the
location of a percpu address for a particular cpu then occurs by
adding an offset that will wrap around zero. This is fine on x86.