Re: [RFC][PATCH 2/5] pagemap: use PAGE_MASK/PAGE_ALIGN()

From: Dave Hansen
Date: Wed Aug 08 2007 - 11:11:58 EST


On Wed, 2007-08-08 at 09:38 +0200, Christian Ehrhardt wrote:
>
> > ret = -ENOMEM;
> > - uaddr = (unsigned long)buf & ~(PAGE_SIZE-1);
> > + uaddr = (unsigned long)buf & PAGE_MASK;
> > uend = (unsigned long)(buf + count);
> > - pagecount = (uend - uaddr + PAGE_SIZE-1) / PAGE_SIZE;
> > + pagecount = (uend - PAGE_ALIGN(uaddr)) / PAGE_SIZE;
>
> Unless I'm missing something the PAGE_ALIGN as ist stands is now a NOP
> because uaddr is already page aligned. You probably wanted to
> PAGE_ALIGN(uend). However, this will likely add an additional instruction
> to the generated code.

Yeah, I aligned the wrong thing. I'll fix that up.

-- Dave

-
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/