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:	Wed, 30 Mar 2016 11:24:38 +0200
From:	Michal Hocko <mhocko@...nel.org>
To:	Chanho Min <chanho.min@....com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Mel Gorman <mgorman@...hsingularity.net>,
	Vlastimil Babka <vbabka@...e.cz>,
	David Rientjes <rientjes@...gle.com>,
	Dan Williams <dan.j.williams@...el.com>,
	Zhang Zhen <zhenzhang.zhang@...wei.com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, Gunho Lee <gunho.lee@....com>
Subject: Re: [PATCH] mm/highmem: simplify is_highmem()

On Wed 30-03-16 13:43:42, Chanho Min wrote:
> The is_highmem() is can be simplified by use of is_highmem_idx().
> This patch removes redundant code and will make it easier to maintain
> if the zone policy is changed or a new zone is added.
> 
> Signed-off-by: Chanho Min <chanho.min@....com>
> ---
>  include/linux/mmzone.h |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index e23a9e7..9ac90c3 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -817,10 +817,7 @@ static inline int is_highmem_idx(enum zone_type idx)
>  static inline int is_highmem(struct zone *zone)
>  {
>  #ifdef CONFIG_HIGHMEM
> -	int zone_off = (char *)zone - (char *)zone->zone_pgdat->node_zones;
> -	return zone_off == ZONE_HIGHMEM * sizeof(*zone) ||
> -	       (zone_off == ZONE_MOVABLE * sizeof(*zone) &&
> -		zone_movable_is_highmem());
> +	return is_highmem_idx(zone_idx(zone));

This will reintroduce the pointer arithmetic removed by ddc81ed2c5d4
("remove sparse warning for mmzone.h") AFAICS. I have no idea how much
that matters though. The mentioned commit doesn't tell much about saves
except for
"
	On X86_32 this saves a sar, but code size increases by one byte per
        is_highmem() use due to 32-bit cmps rather than 16 bit cmps.
"

>  #else
>  	return 0;
>  #endif
> -- 
> 1.7.9.5
> 

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ