linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org
Subject: Re: [PATCH 1/2] mmzone: simplify zone_intersects()
Date: Sun, 18 Jun 2017 18:59:51 +0200	[thread overview]
Message-ID: <20170618165951.GG18660@dhcp22.suse.cz> (raw)
In-Reply-To: <20170616092335.5177-1-richard.weiyang@gmail.com>

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@gmail.com>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      parent reply	other threads:[~2017-06-18 16:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16  9:23 Wei Yang
2017-06-16  9:23 ` [PATCH 2/2] mm/memory_hotplug: remove duplicate call for set_page_links Wei Yang
2017-06-16 17:33   ` Andrew Morton
2017-06-17  2:55     ` Wei Yang
2017-06-22  6:50     ` Michal Hocko
2017-06-18 16:59 ` Michal Hocko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170618165951.GG18660@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=richard.weiyang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox