lkml.org 
[lkml]   [2018]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1] include/linux/gfp.h: getting rid of GFP_ZONE_TABLE/BAD
On Fri, May 11, 2018 at 12:10:25AM +0800, Huaisheng Ye wrote:
> -#define __GFP_DMA ((__force gfp_t)___GFP_DMA)
> -#define __GFP_HIGHMEM ((__force gfp_t)___GFP_HIGHMEM)
> -#define __GFP_DMA32 ((__force gfp_t)___GFP_DMA32)
> +#define __GFP_DMA ((__force gfp_t)OPT_ZONE_DMA ^ ZONE_NORMAL)
> +#define __GFP_HIGHMEM ((__force gfp_t)ZONE_MOVABLE ^ ZONE_NORMAL)
> +#define __GFP_DMA32 ((__force gfp_t)OPT_ZONE_DMA32 ^ ZONE_NORMAL)

No, you've made gfp_zone even more complex than it already is.
If you can't use OPT_ZONE_HIGHMEM here, then this is a waste of time.

> static inline enum zone_type gfp_zone(gfp_t flags)
> {
> enum zone_type z;
> - int bit = (__force int) (flags & GFP_ZONEMASK);
> + z = ((__force unsigned int)flags & ___GFP_ZONE_MASK) ^ ZONE_NORMAL;
> +
> + if (z > OPT_ZONE_HIGHMEM)
> + z = OPT_ZONE_HIGHMEM +
> + !!((__force unsigned int)flags & ___GFP_MOVABLE);
>
> - z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
> - ((1 << GFP_ZONES_SHIFT) - 1);
> - VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
> + VM_BUG_ON(z > ZONE_MOVABLE);
> return z;
> }

\
 
 \ /
  Last update: 2018-05-10 18:31    [W:0.122 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site