Re: [PATCH] mm/highmem: simplify is_highmem()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 29, 2016 at 9:43 PM, Chanho Min <chanho.min@xxxxxxx> 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@xxxxxxx>
> ---
>  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@xxxxxxxxx>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]