All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Namhyung Kim <namhyung@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: cleanup gfp_zone()
Date: Tue, 28 Sep 2010 14:32:39 -0700	[thread overview]
Message-ID: <20100928143239.5fe34e1e.akpm@linux-foundation.org> (raw)
In-Reply-To: <1285676624-1300-1-git-send-email-namhyung@gmail.com>

On Tue, 28 Sep 2010 21:23:44 +0900
Namhyung Kim <namhyung@gmail.com> wrote:

> Use Z[TB]_SHIFT() macro to calculate GFP_ZONE_TABLE and GFP_ZONE_BAD.
> This also removes lots of warnings from sparse like following:
> 
>  warning: restricted gfp_t degrades to integer
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
>  include/linux/gfp.h |   43 ++++++++++++++++++++++++-------------------
>  1 files changed, 24 insertions(+), 19 deletions(-)
> 
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index 975609c..cebfee1 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -185,15 +185,16 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
>  #error ZONES_SHIFT too large to create GFP_ZONE_TABLE integer
>  #endif
>  
> +#define ZT_SHIFT(gfp) ((__force int) (gfp) * ZONES_SHIFT)
>  #define GFP_ZONE_TABLE ( \
> -	(ZONE_NORMAL << 0 * ZONES_SHIFT)				\
> -	| (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT)			\
> -	| (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT)		\
> -	| (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT)			\
> -	| (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT)			\
> -	| (OPT_ZONE_DMA << (__GFP_MOVABLE | __GFP_DMA) * ZONES_SHIFT)	\
> -	| (ZONE_MOVABLE << (__GFP_MOVABLE | __GFP_HIGHMEM) * ZONES_SHIFT)\
> -	| (OPT_ZONE_DMA32 << (__GFP_MOVABLE | __GFP_DMA32) * ZONES_SHIFT)\
> +	(ZONE_NORMAL        << ZT_SHIFT(0))				\
> +	| (OPT_ZONE_DMA     << ZT_SHIFT(__GFP_DMA))			\
> +	| (OPT_ZONE_HIGHMEM << ZT_SHIFT(__GFP_HIGHMEM))			\
> +	| (OPT_ZONE_DMA32   << ZT_SHIFT(__GFP_DMA32))			\
> +	| (ZONE_NORMAL      << ZT_SHIFT(__GFP_MOVABLE))			\
> +	| (OPT_ZONE_DMA     << ZT_SHIFT(__GFP_MOVABLE | __GFP_DMA))	\
> +	| (ZONE_MOVABLE     << ZT_SHIFT(__GFP_MOVABLE | __GFP_HIGHMEM)) \
> +	| (OPT_ZONE_DMA32   << ZT_SHIFT(__GFP_MOVABLE | __GFP_DMA32))	\
>  )

hm.  I hope these sparse warnings are sufficiently useful to justify
all the gunk we're adding to support them.

Is it actually finding any bugs?

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Namhyung Kim <namhyung@gmail.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: cleanup gfp_zone()
Date: Tue, 28 Sep 2010 14:32:39 -0700	[thread overview]
Message-ID: <20100928143239.5fe34e1e.akpm@linux-foundation.org> (raw)
In-Reply-To: <1285676624-1300-1-git-send-email-namhyung@gmail.com>

On Tue, 28 Sep 2010 21:23:44 +0900
Namhyung Kim <namhyung@gmail.com> wrote:

> Use Z[TB]_SHIFT() macro to calculate GFP_ZONE_TABLE and GFP_ZONE_BAD.
> This also removes lots of warnings from sparse like following:
> 
>  warning: restricted gfp_t degrades to integer
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> ---
>  include/linux/gfp.h |   43 ++++++++++++++++++++++++-------------------
>  1 files changed, 24 insertions(+), 19 deletions(-)
> 
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index 975609c..cebfee1 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -185,15 +185,16 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
>  #error ZONES_SHIFT too large to create GFP_ZONE_TABLE integer
>  #endif
>  
> +#define ZT_SHIFT(gfp) ((__force int) (gfp) * ZONES_SHIFT)
>  #define GFP_ZONE_TABLE ( \
> -	(ZONE_NORMAL << 0 * ZONES_SHIFT)				\
> -	| (OPT_ZONE_DMA << __GFP_DMA * ZONES_SHIFT)			\
> -	| (OPT_ZONE_HIGHMEM << __GFP_HIGHMEM * ZONES_SHIFT)		\
> -	| (OPT_ZONE_DMA32 << __GFP_DMA32 * ZONES_SHIFT)			\
> -	| (ZONE_NORMAL << __GFP_MOVABLE * ZONES_SHIFT)			\
> -	| (OPT_ZONE_DMA << (__GFP_MOVABLE | __GFP_DMA) * ZONES_SHIFT)	\
> -	| (ZONE_MOVABLE << (__GFP_MOVABLE | __GFP_HIGHMEM) * ZONES_SHIFT)\
> -	| (OPT_ZONE_DMA32 << (__GFP_MOVABLE | __GFP_DMA32) * ZONES_SHIFT)\
> +	(ZONE_NORMAL        << ZT_SHIFT(0))				\
> +	| (OPT_ZONE_DMA     << ZT_SHIFT(__GFP_DMA))			\
> +	| (OPT_ZONE_HIGHMEM << ZT_SHIFT(__GFP_HIGHMEM))			\
> +	| (OPT_ZONE_DMA32   << ZT_SHIFT(__GFP_DMA32))			\
> +	| (ZONE_NORMAL      << ZT_SHIFT(__GFP_MOVABLE))			\
> +	| (OPT_ZONE_DMA     << ZT_SHIFT(__GFP_MOVABLE | __GFP_DMA))	\
> +	| (ZONE_MOVABLE     << ZT_SHIFT(__GFP_MOVABLE | __GFP_HIGHMEM)) \
> +	| (OPT_ZONE_DMA32   << ZT_SHIFT(__GFP_MOVABLE | __GFP_DMA32))	\
>  )

hm.  I hope these sparse warnings are sufficiently useful to justify
all the gunk we're adding to support them.

Is it actually finding any bugs?

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

  reply	other threads:[~2010-09-28 21:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-28 12:23 [PATCH] mm: cleanup gfp_zone() Namhyung Kim
2010-09-28 12:23 ` Namhyung Kim
2010-09-28 21:32 ` Andrew Morton [this message]
2010-09-28 21:32   ` Andrew Morton
2010-09-28 21:41   ` Al Viro
2010-09-28 21:41     ` Al Viro
2010-09-28 21:45     ` Andrew Morton
2010-09-28 21:45       ` Andrew Morton
2010-09-28 22:15       ` Al Viro
2010-09-28 22:15         ` Al Viro
2010-09-29  7:06         ` [PATCH v2] mm: fix sparse warnings on GFP_ZONE_TABLE/BAD Namhyung Kim
2010-09-29  7:06           ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100928143239.5fe34e1e.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=namhyung@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.