lkml.org 
[lkml]   [2001]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] v2.5.1-pre9-00_kvec.diff
Hi,

On Tue, 11 Dec 2001, Benjamin LaHaise wrote:

> On Tue, Dec 11, 2001 at 09:35:15PM -0600, Steven Walter wrote:
> > > + nr_pages = (ptr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
> > > + nr_pages -= ptr >> PAGE_SHIFT;
> >
> > Isn't this the same as
> > nr_pages = (len + PAGE_SIZE -1) >> PAGE_SHIFT;
>
> No.

But this is:

nr_pages = ((ptr & ~PAGE_MASK) + len + PAGE_SIZE - 1) >> PAGE_SHIFT;

and this even slightly better (at least on ia32):

mask = PAGE_SIZE - 1;
nr_pages = ((ptr & mask) + len + mask) >> PAGE_SHIFT;

bye, Roman

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

\
 
 \ /
  Last update: 2005-03-22 13:18    [W:0.084 / U:1.184 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site