linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Chanho Min <chanho.min@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Vlastimil Babka <vbabka@suse.cz>,
	David Rientjes <rientjes@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Zhang Zhen <zhenzhang.zhang@huawei.com>,
	Linux MM <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Gunho Lee <gunho.lee@lge.com>
Subject: Re: [PATCH] mm/highmem: simplify is_highmem()
Date: Tue, 29 Mar 2016 23:34:14 -0700	[thread overview]
Message-ID: <CAPcyv4gqKZUh8_oE=J2xv2ZX78v3PKdHa1qmQP-FDMbt1iEAZQ@mail.gmail.com> (raw)
In-Reply-To: <1459313022-11750-1-git-send-email-chanho.min@lge.com>

On Tue, Mar 29, 2016 at 9:43 PM, Chanho Min <chanho.min@lge.com> 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@lge.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));
>  #else
>         return 0;
>  #endif

Yup, looks like a straightforward replacement of open coded versions
of the same routines.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>

--
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>

  reply	other threads:[~2016-03-30  6:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30  4:43 Chanho Min
2016-03-30  6:34 ` Dan Williams [this message]
2016-03-30  9:24 ` Michal Hocko
2016-03-31 22:38   ` Andrew Morton

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='CAPcyv4gqKZUh8_oE=J2xv2ZX78v3PKdHa1qmQP-FDMbt1iEAZQ@mail.gmail.com' \
    --to=dan.j.williams@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=chanho.min@lge.com \
    --cc=gunho.lee@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    --cc=zhenzhang.zhang@huawei.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