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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 20 Dec 2012 14:55:41 +0100
From:	Michal Hocko <mhocko@...e.cz>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Johannes Weiner <hannes@...xchg.org>,
	Rik van Riel <riel@...hat.com>, Mel Gorman <mgorman@...e.de>,
	Hugh Dickins <hughd@...gle.com>,
	Satoru Moriya <satoru.moriya@....com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org
Subject: Re: [patch 2/7] mm: vmscan: save work scanning (almost) empty LRU
 lists

On Wed 19-12-12 15:59:01, Andrew Morton wrote:
[...]
> From: Andrew Morton <akpm@...ux-foundation.org>
> Subject: mm/page_alloc.c:__setup_per_zone_wmarks: make min_pages unsigned long
> 
> `int' is an inappropriate type for a number-of-pages counter.
> 
> While we're there, use the clamp() macro.
> 
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Rik van Riel <riel@...hat.com>
> Cc: Mel Gorman <mgorman@...e.de>
> Cc: Michal Hocko <mhocko@...e.cz>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: Satoru Moriya <satoru.moriya@....com>
> Cc: Simon Jeons <simon.jeons@...il.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>

Reviewed-by: Michal Hocko <mhocko@...e.cz>

> ---
> 
>  mm/page_alloc.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff -puN mm/page_alloc.c~a mm/page_alloc.c
> --- a/mm/page_alloc.c~a
> +++ a/mm/page_alloc.c
> @@ -5258,13 +5258,10 @@ static void __setup_per_zone_wmarks(void
>  			 * deltas controls asynch page reclaim, and so should
>  			 * not be capped for highmem.
>  			 */
> -			int min_pages;
> +			unsigned long min_pages;
>  
>  			min_pages = zone->present_pages / 1024;
> -			if (min_pages < SWAP_CLUSTER_MAX)
> -				min_pages = SWAP_CLUSTER_MAX;
> -			if (min_pages > 128)
> -				min_pages = 128;
> +			min_pages = clamp(min_pages, SWAP_CLUSTER_MAX, 128UL);
>  			zone->watermark[WMARK_MIN] = min_pages;
>  		} else {
>  			/*
> _
> 
> 
> From: Andrew Morton <akpm@...ux-foundation.org>
> Subject: mm/vmscan.c:shrink_lruvec(): switch to min()
> 
> "mm: vmscan: save work scanning (almost) empty LRU lists" made
> SWAP_CLUSTER_MAX an unsigned long.
> 
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Rik van Riel <riel@...hat.com>
> Cc: Mel Gorman <mgorman@...e.de>
> Cc: Michal Hocko <mhocko@...e.cz>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: Satoru Moriya <satoru.moriya@....com>
> Cc: Simon Jeons <simon.jeons@...il.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>

Reviewed-by: Michal Hocko <mhocko@...e.cz>

> ---
> 
>  mm/vmscan.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff -puN mm/vmscan.c~a mm/vmscan.c
> --- a/mm/vmscan.c~a
> +++ a/mm/vmscan.c
> @@ -1873,8 +1873,7 @@ restart:
>  					nr[LRU_INACTIVE_FILE]) {
>  		for_each_evictable_lru(lru) {
>  			if (nr[lru]) {
> -				nr_to_scan = min_t(unsigned long,
> -						   nr[lru], SWAP_CLUSTER_MAX);
> +				nr_to_scan = min(nr[lru], SWAP_CLUSTER_MAX);
>  				nr[lru] -= nr_to_scan;
>  
>  				nr_reclaimed += shrink_list(lru, nr_to_scan,
> _
> 
> 
> From: Andrew Morton <akpm@...ux-foundation.org>
> Subject: mm/vmscan.c:__zone_reclaim(): replace max_t() with max()
> 
> "mm: vmscan: save work scanning (almost) empty LRU lists" made
> SWAP_CLUSTER_MAX an unsigned long.
> 
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Rik van Riel <riel@...hat.com>
> Cc: Mel Gorman <mgorman@...e.de>
> Cc: Michal Hocko <mhocko@...e.cz>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: Satoru Moriya <satoru.moriya@....com>
> Cc: Simon Jeons <simon.jeons@...il.com>
> Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>

Reviewed-by: Michal Hocko <mhocko@...e.cz>

> ---
> 
>  mm/vmscan.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff -puN mm/vmscan.c~mm-vmscanc-__zone_reclaim-replace-max_t-with-max mm/vmscan.c
> --- a/mm/vmscan.c~mm-vmscanc-__zone_reclaim-replace-max_t-with-max
> +++ a/mm/vmscan.c
> @@ -3347,8 +3347,7 @@ static int __zone_reclaim(struct zone *z
>  		.may_writepage = !!(zone_reclaim_mode & RECLAIM_WRITE),
>  		.may_unmap = !!(zone_reclaim_mode & RECLAIM_SWAP),
>  		.may_swap = 1,
> -		.nr_to_reclaim = max_t(unsigned long, nr_pages,
> -				       SWAP_CLUSTER_MAX),
> +		.nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX),
>  		.gfp_mask = gfp_mask,
>  		.order = order,
>  		.priority = ZONE_RECLAIM_PRIORITY,
> _
> 
> --
> 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/

-- 
Michal Hocko
SUSE Labs
--
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