lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20090508182845.GX31071@waste.org>
Date:	Fri, 8 May 2009 13:28:46 -0500
From:	Matt Mackall <mpm@...enic.com>
To:	Wu Fengguang <fengguang.wu@...el.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Andi Kleen <andi@...stfloor.org>, linux-mm@...ck.org
Subject: Re: [PATCH 3/7] proc: kpagecount/kpageflags code cleanup

On Thu, May 07, 2009 at 09:21:20AM +0800, Wu Fengguang wrote:
> Move increments of pfn/out to bottom of the loop.
> 
> Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>

Acked-by: Matt Mackall <mpm@...enic.com>

> ---
>  fs/proc/page.c |   17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> --- linux.orig/fs/proc/page.c
> +++ linux/fs/proc/page.c
> @@ -11,6 +11,7 @@
>  
>  #define KPMSIZE sizeof(u64)
>  #define KPMMASK (KPMSIZE - 1)
> +
>  /* /proc/kpagecount - an array exposing page counts
>   *
>   * Each entry is a u64 representing the corresponding
> @@ -32,20 +33,22 @@ static ssize_t kpagecount_read(struct fi
>  		return -EINVAL;
>  
>  	while (count > 0) {
> -		ppage = NULL;
>  		if (pfn_valid(pfn))
>  			ppage = pfn_to_page(pfn);
> -		pfn++;
> +		else
> +			ppage = NULL;
>  		if (!ppage)
>  			pcount = 0;
>  		else
>  			pcount = page_mapcount(ppage);
>  
> -		if (put_user(pcount, out++)) {
> +		if (put_user(pcount, out)) {
>  			ret = -EFAULT;
>  			break;
>  		}
>  
> +		pfn++;
> +		out++;
>  		count -= KPMSIZE;
>  	}
>  
> @@ -98,10 +101,10 @@ static ssize_t kpageflags_read(struct fi
>  		return -EINVAL;
>  
>  	while (count > 0) {
> -		ppage = NULL;
>  		if (pfn_valid(pfn))
>  			ppage = pfn_to_page(pfn);
> -		pfn++;
> +		else
> +			ppage = NULL;
>  		if (!ppage)
>  			kflags = 0;
>  		else
> @@ -119,11 +122,13 @@ static ssize_t kpageflags_read(struct fi
>  			kpf_copy_bit(kflags, KPF_RECLAIM, PG_reclaim) |
>  			kpf_copy_bit(kflags, KPF_BUDDY, PG_buddy);
>  
> -		if (put_user(uflags, out++)) {
> +		if (put_user(uflags, out)) {
>  			ret = -EFAULT;
>  			break;
>  		}
>  
> +		pfn++;
> +		out++;
>  		count -= KPMSIZE;
>  	}
>  
> 
> -- 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ