Re: [PATCH 1/2] mmzone: simplify zone_intersects()

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

 



On Fri 16-06-17 17:23:34, Wei Yang wrote:
> To make sure a range intersects a zone, only two comparison is necessary.
> 
> This patch simplifies the function a little.
> 
> Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>

Acked-by: Michal Hocko <mhocko@xxxxxxxx>

> ---
>  include/linux/mmzone.h | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index 0176a2933c61..7e8f100cb56d 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -541,15 +541,11 @@ static inline bool zone_intersects(struct zone *zone,
>  {
>  	if (zone_is_empty(zone))
>  		return false;
> -	if (start_pfn >= zone_end_pfn(zone))
> +	if (start_pfn >= zone_end_pfn(zone) ||
> +	    start_pfn + nr_pages <= zone->zone_start_pfn)
>  		return false;
>  
> -	if (zone->zone_start_pfn <= start_pfn)
> -		return true;
> -	if (start_pfn + nr_pages > zone->zone_start_pfn)
> -		return true;
> -
> -	return false;
> +	return true;
>  }
>  
>  /*
> -- 
> 2.11.0

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux