Skip to content

Commit

Permalink
mm/highmem: simplify is_highmem()
Browse files Browse the repository at this point in the history
is_highmem() 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.

(akpm: saves me 25 bytes of text per is_highmem() callsite)

Signed-off-by: Chanho Min <chanho.min@lge.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Chanho Min authored and sfrothwell committed Apr 3, 2016
1 parent 7238cc7 commit 29c706c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions include/linux/mmzone.h
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,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
Expand Down

0 comments on commit 29c706c

Please sign in to comment.