Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1366892

[PATCH] mm/highmem: simplify is_highmem()

From Chanho Min <chanho.min@lge.com>
Newsgroups linux.kernel
Subject [PATCH] mm/highmem: simplify is_highmem()
Date 2016-03-30 06:50 +0200
Message-ID <rigeR-cG-5@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mm/highmem: simplify is_highmem() Chanho Min <chanho.min@lge.com> - 2016-03-30 06:50 +0200
  Re: [PATCH] mm/highmem: simplify is_highmem() Dan Williams <dan.j.williams@intel.com> - 2016-03-30 08:40 +0200
  Re: [PATCH] mm/highmem: simplify is_highmem() Michal Hocko <mhocko@kernel.org> - 2016-03-30 11:30 +0200
    Re: [PATCH] mm/highmem: simplify is_highmem() Andrew Morton <akpm@linux-foundation.org> - 2016-04-01 00:40 +0200

csiph-web