Re: whats happening

From: keyser-lk@soze.net
Date: Sat Dec 23 2000 - 12:15:13 EST


On Sat, 23 Dec 2000, Sourav Sen wrote:

> In some parts of the kernel code I find expression like
>
> len = (len + ~PAGE_MASK) & PAGE_MASK ;
>
> Whats happening to len?

It's being aligned properly.

if you have a continuous array of objects that are each 8 bytes, you
create a mask that's FFFFFFF8, then if len=7, instead of doing an
operation on the last byte of the first thing and the first 7 bytes of the
second, the above expression will add 7, making len 14, then normalize it
to the last valid object address, 8. And if you start with a valid
address, you get that same address back.

justin

-- 
To summon a demon you must first know its name.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Dec 23 2000 - 21:00:34 EST