From: Michal Hocko <mhocko@kernel.org>
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>,
Dan Williams <dan.j.williams@intel.com>,
Zhang Zhen <zhenzhang.zhang@huawei.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Gunho Lee <gunho.lee@lge.com>
Subject: Re: [PATCH] mm/highmem: simplify is_highmem()
Date: Wed, 30 Mar 2016 11:24:38 +0200 [thread overview]
Message-ID: <20160330092438.GG30729@dhcp22.suse.cz> (raw)
In-Reply-To: <1459313022-11750-1-git-send-email-chanho.min@lge.com>
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@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));
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
--
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>
next prev parent reply other threads:[~2016-03-30 9:24 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
2016-03-30 9:24 ` Michal Hocko [this message]
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=20160330092438.GG30729@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=chanho.min@lge.com \
--cc=dan.j.williams@intel.com \
--cc=gunho.lee@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--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