linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [slab:slab/next 11/13] mm/slab_common.c:385:13: sparse: restricted gfp_t degrades to integer
       [not found] ` <0000013c971ab472-8542127a-19e8-4f6a-8b7e-5f5ab8bcd8fd-000000@email.amazonses.com>
@ 2013-02-02 12:59   ` Fengguang Wu
  2013-02-04 14:46     ` [PATCH for-next] mm/sl[au]b: correct allocation type check in kmalloc_slab() Joonsoo Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Fengguang Wu @ 2013-02-02 12:59 UTC (permalink / raw)
  To: Christoph Lameter; +Cc: Pekka Enberg, Linux Memory Management List

On Fri, Feb 01, 2013 at 06:52:55PM +0000, Christoph Lameter wrote:
> On Fri, 1 Feb 2013, kbuild test robot wrote:
> 
> >    374		int index;
> >    375
> >    376		if (size <= 192) {
> >    377			if (!size)
> >    378				return ZERO_SIZE_PTR;
> >    379
> >    380			index = size_index[size_index_elem(size)];
> >    381		} else
> >    382			index = fls(size - 1);
> >    383
> >    384	#ifdef CONFIG_ZONE_DMA
> >  > 385		if (unlikely((flags & SLAB_CACHE_DMA)))
> 
> Should flags be cast to integer before doing the & operation?

It seems not easy to quiet this warning..

(unsigned long)flags & SLAB_CACHE_DMA
/c/wfg/sound/mm/slab_common.c:385:13: sparse: cast from restricted gfp_t

flags & (gfp_t)SLAB_CACHE_DMA
/c/wfg/sound/mm/slab_common.c:385:13: sparse: cast to restricted gfp_t

Thanks,
Fengguang

--
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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH for-next] mm/sl[au]b: correct allocation type check in kmalloc_slab()
  2013-02-02 12:59   ` [slab:slab/next 11/13] mm/slab_common.c:385:13: sparse: restricted gfp_t degrades to integer Fengguang Wu
@ 2013-02-04 14:46     ` Joonsoo Kim
  2013-02-04 19:00       ` Christoph Lameter
  0 siblings, 1 reply; 3+ messages in thread
From: Joonsoo Kim @ 2013-02-04 14:46 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-mm, Pekka Enberg, Christoph Lameter, Fengguang Wu,
	Joonsoo Kim

commit "slab: Common Kmalloc cache determination" made mistake
in kmalloc_slab(). SLAB_CACHE_DMA is for kmem_cache creation,
not for allocation. For allocation, we should use GFP_XXX to identify
type of allocation. So, change SLAB_CACHE_DMA to GFP_DMA.

Cc: Christoph Lameter <cl@linux.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Joonsoo Kim <js1304@gmail.com>

diff --git a/mm/slab_common.c b/mm/slab_common.c
index 6d73f0b..2f0e7d5 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -382,7 +382,7 @@ struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
 		index = fls(size - 1);
 
 #ifdef CONFIG_ZONE_DMA
-	if (unlikely((flags & SLAB_CACHE_DMA)))
+	if (unlikely((flags & GFP_DMA)))
 		return kmalloc_dma_caches[index];
 
 #endif
-- 
1.7.9.5

--
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>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH for-next] mm/sl[au]b: correct allocation type check in kmalloc_slab()
  2013-02-04 14:46     ` [PATCH for-next] mm/sl[au]b: correct allocation type check in kmalloc_slab() Joonsoo Kim
@ 2013-02-04 19:00       ` Christoph Lameter
  0 siblings, 0 replies; 3+ messages in thread
From: Christoph Lameter @ 2013-02-04 19:00 UTC (permalink / raw)
  To: Joonsoo Kim; +Cc: Andrew Morton, linux-mm, Pekka Enberg, Fengguang Wu

On Mon, 4 Feb 2013, Joonsoo Kim wrote:

> commit "slab: Common Kmalloc cache determination" made mistake
> in kmalloc_slab(). SLAB_CACHE_DMA is for kmem_cache creation,
> not for allocation. For allocation, we should use GFP_XXX to identify
> type of allocation. So, change SLAB_CACHE_DMA to GFP_DMA.

Correct.

Acked-by: Christoph Lameter <cl@linux.com>

--
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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-04 19:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <510bae53.+nWBFPQ3bGiTzPs/%fengguang.wu@intel.com>
     [not found] ` <0000013c971ab472-8542127a-19e8-4f6a-8b7e-5f5ab8bcd8fd-000000@email.amazonses.com>
2013-02-02 12:59   ` [slab:slab/next 11/13] mm/slab_common.c:385:13: sparse: restricted gfp_t degrades to integer Fengguang Wu
2013-02-04 14:46     ` [PATCH for-next] mm/sl[au]b: correct allocation type check in kmalloc_slab() Joonsoo Kim
2013-02-04 19:00       ` Christoph Lameter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).