Re: [PATCH] zone gfp_flags generate from ZONE_ constants

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

 



Andy Whitcroft <[email protected]> wrote:
>
> +/*
>  + * Generate the zone modifier bit.  Zone ZONE_DEFAULT doesn't require a bit
>  + * as the absence of all zone modifiers implies this zone.  Renormalise the
>  + * zone number such that ZONE_DEFAULT is at the bottom and discard it.
>  + * These must fit within the bitmask GFP_ZONEMASK defined in linux/mmzone.h.
>  + */
>  +#define __ZONE_BIT(x) (((x) ^ ZONE_DEFAULT) - 1)
>  +#define ZONE_MODIFIER(x) ((__force gfp_t)(((x) == ZONE_DEFAULT)? (0) : \
>  +							1UL << __ZONE_BIT(x)))
>  +
>  +#define __GFP_DMA	ZONE_MODIFIER(ZONE_DMA)
>  +#define __GFP_HIGHMEM	ZONE_MODIFIER(ZONE_HIGHMEM)
>   #ifdef CONFIG_DMA_IS_DMA32
>  -#define __GFP_DMA32	((__force gfp_t)0x01)	/* ZONE_DMA is ZONE_DMA32 */
>  +#define __GFP_DMA32	ZONE_MODIFIER(ZONE_DMA)	/* ZONE_DMA is ZONE_DMA32 */
>   #elif BITS_PER_LONG < 64
>  -#define __GFP_DMA32	((__force gfp_t)0x00)	/* ZONE_NORMAL is ZONE_DMA32 */
>  +#define __GFP_DMA32	ZONE_MODIFIER(ZONE_NORMAL) /* ZONE_NORMAL is ZONE_DMA32 */
>   #else
>  -#define __GFP_DMA32	((__force gfp_t)0x04)	/* Has own ZONE_DMA32 */
>  +#define __GFP_DMA32	ZONE_MODIFIER(ZONE_DMA32) /* Has own ZONE_DMA32 */
>   #endif

eek.  We often look at the hex value of gfp flags in debug output to work
out what sort of allocation is being attempted.

I guess we could print out the values of these things at boot time..
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux