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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In linux.kernel, you wrote:
>
> Use existing macros (PAGE_MASK/PAGE_ALIGN()) instead of
> open-coding them.
>
> Signed-off-by: Dave Hansen <[email protected]>
> ---
>
>  lxc-dave/fs/proc/task_mmu.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff -puN fs/proc/task_mmu.c~pagemap-use-PAGE_MASK fs/proc/task_mmu.c
> --- lxc/fs/proc/task_mmu.c~pagemap-use-PAGE_MASK	2007-08-07 15:30:52.000000000 -0700
> +++ lxc-dave/fs/proc/task_mmu.c	2007-08-07 15:30:52.000000000 -0700
> @@ -669,9 +669,9 @@ static ssize_t pagemap_read(struct file 
>  		goto out;
>  
>  	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.

    regards  Christian


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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux