mm/slab: use IS_ENABLED() instead of ZONE_DMA_FLAG
Subsystems (2)
PATCH 1/1 mm/slab: use IS_ENABLED() instead of ZONE_DMA_FLAG
The Kconfig symbol ZONE_DMA_FLAG probably predates the introduction of IS_ENABLED(). Remove it and replace its two uses with the equivalent IS_ENABLED(CONFIG_ZONE_DMA).
---
Build tested on x86_64 (on top of next-20140925).
Run tested on i686 (on top of v3.17-rc6). That test required me to switch from SLUB (Fedora's default) to SLAB. That makes running this patch both more scary and less informative. Besides, I have no idea how to hit the codepaths I just changed. You'd expect this to not actually change slab.o, but I'm not sure how to check that. So, in short: review very much appreciated.
mm/Kconfig | 5 ----- mm/slab.c | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-)
mm/Kconfig +0 -5
@@ -273,11 +273,6 @@ config ARCH_ENABLE_HUGEPAGE_MIGRATION config PHYS_ADDR_T_64BIT def_bool 64BIT || ARCH_PHYS_ADDR_T_64BIT -config ZONE_DMA_FLAG - int - default "0" if !ZONE_DMA - default "1" - config BOUNCE bool "Enable bounce buffers" default y
mm/slab.c +2 -2
@@ -2243,7 +2243,7 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) cachep->freelist_size = freelist_size; cachep->flags = flags; cachep->allocflags = __GFP_COMP; -if (CONFIG_ZONE_DMA_FLAG && (flags &SLAB_CACHE_DMA )) +if (IS_ENABLED (CONFIG_ZONE_DMA ) && (flags &SLAB_CACHE_DMA )) cachep->allocflags |=GFP_DMA ; cachep->size = size; cachep->reciprocal_buffer_size =reciprocal_value (size);
@@ -2516,7 +2516,7 @@ static void cache_init_objs(struct kmem_cache *cachep,static void kmem_flagcheck (struct kmem_cache *cachep,gfp_t flags) { -if (CONFIG_ZONE_DMA_FLAG ) { +if (IS_ENABLED (CONFIG_ZONE_DMA )) {if (flags &GFP_DMA )BUG_ON (!(cachep->allocflags &GFP_DMA ));else
Signature · 7 lines
1.9.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Paul Bolle
The
KconfigsymbolZONE_DMA_FLAGprobably predates the introduction ofIS_ENABLED(). Remove it and replace its two uses with the equivalentIS_ENABLED(CONFIG_ZONE_DMA).
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 40 lines · Paul Bolle
The
KconfigsymbolZONE_DMA_FLAGprobably predates the introduction ofIS_ENABLED(). Remove it and replace its two uses with the equivalentIS_ENABLED(CONFIG_ZONE_DMA).Signed-off-by Paul Bolle <[email protected]>---
Build tested onx86_64(on top of next-20140925).Run tested on i686 (on top of v3.17-rc6). That test required me to switch from SLUB (Fedora's default) to SLAB. That makes running this patch both more scary and less informative. Besides, I have no idea how to hit the codepaths I just changed. You'd expect this to not actually change slab.o, but I'm not sure how to check that. So, in short: review very much appreciated.
mm/Kconfig | 5 ----- mm/slab.c | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-)mm/Kconfig +0
-5@@ -273,11 +273,6 @@ config ARCH_ENABLE_HUGEPAGE_MIGRATION config PHYS_ADDR_T_64BIT def_bool 64BIT || ARCH_PHYS_ADDR_T_64BIT -config ZONE_DMA_FLAG - int - default "0" if !ZONE_DMA - default "1" - config BOUNCE bool "Enable bounce buffers" default ymm/slab.c +0
-0
mm/slab.c __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) · line 2247
Quoted 6 lines
mm/slab.c +1
-1@@ -2243,7 +2243,7 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) cachep->freelist_size = freelist_size; cachep->flags = flags; cachep->allocflags = __GFP_COMP; -if (CONFIG_ZONE_DMA_FLAG && (flags &SLAB_CACHE_DMA )) +if (IS_ENABLED (CONFIG_ZONE_DMA ) && (flags &SLAB_CACHE_DMA )) cachep->allocflags |=GFP_DMA ;
GFP_DMA is actually safe to use even without CONFIG_ZONE_DMA, so you only need to check for SLAB_CACHE_DMA here.
mm/slab.c static void cache_init_objs(struct kmem_cache *cachep, · line 2522
Quoted 9 lines
mm/slab.c +1
-1@@ -2516,7 +2516,7 @@ static void cache_init_objs(struct kmem_cache *cachep,static void kmem_flagcheck (struct kmem_cache *cachep,gfp_t flags) { -if (CONFIG_ZONE_DMA_FLAG ) { +if (IS_ENABLED (CONFIG_ZONE_DMA )) {if (flags &GFP_DMA )BUG_ON (!(cachep->allocflags &GFP_DMA ));else
I think this assertion can be removed altogether and replaced by ORing the passed in flags with the cache gfp flags. The page allocator will catch any contradictions, but the 3 callsites that actually do use DMA caches are well-behaved as of now.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Hi Johannes,
Quoted 53 lines · Johannes Weiner
Quoted 40 lines · Paul Bolle
The
KconfigsymbolZONE_DMA_FLAGprobably predates the introduction ofIS_ENABLED(). Remove it and replace its two uses with the equivalentIS_ENABLED(CONFIG_ZONE_DMA).Signed-off-by Paul Bolle <[email protected]>---
Build tested onx86_64(on top of next-20140925).Run tested on i686 (on top of v3.17-rc6). That test required me to switch from SLUB (Fedora's default) to SLAB. That makes running this patch both more scary and less informative. Besides, I have no idea how to hit the codepaths I just changed. You'd expect this to not actually change slab.o, but I'm not sure how to check that. So, in short: review very much appreciated.
mm/Kconfig | 5 ----- mm/slab.c | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-)mm/Kconfig +0
-5@@ -273,11 +273,6 @@ config ARCH_ENABLE_HUGEPAGE_MIGRATION config PHYS_ADDR_T_64BIT def_bool 64BIT || ARCH_PHYS_ADDR_T_64BIT -config ZONE_DMA_FLAG - int - default "0" if !ZONE_DMA - default "1" - config BOUNCE bool "Enable bounce buffers" default ymm/slab.c +0
-0mm/slab.c __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) · line 2247
Quoted 6 lines
mm/slab.c +1
-1@@ -2243,7 +2243,7 @@ __kmem_cache_create (struct kmem_cache *cachep, unsigned long flags) cachep->freelist_size = freelist_size; cachep->flags = flags; cachep->allocflags = __GFP_COMP; -if (CONFIG_ZONE_DMA_FLAG && (flags &SLAB_CACHE_DMA )) +if (IS_ENABLED (CONFIG_ZONE_DMA ) && (flags &SLAB_CACHE_DMA )) cachep->allocflags |=GFP_DMA ;
GFP_DMAis actually safe to use even withoutCONFIG_ZONE_DMA, so you only need to check forSLAB_CACHE_DMAhere.Quoted 2 lines
mm/slab.c +0
-0@@ -2516,7 +2516,7 @@ static void cache_init_objs(struct kmem_cache *cachep,
Quoted 12 lines
mm/slab.c static void cache_init_objs(struct kmem_cache *cachep, · line 2522
Quoted 7 lines
mm/slab.c +1
-1static void kmem_flagcheck (struct kmem_cache *cachep,gfp_t flags) { -if (CONFIG_ZONE_DMA_FLAG ) { +if (IS_ENABLED (CONFIG_ZONE_DMA )) {if (flags &GFP_DMA )BUG_ON (!(cachep->allocflags &GFP_DMA ));else I think this assertion can be removed altogether and replaced by ORing the passed in flags with the cache gfp flags. The page allocator will catch any contradictions, but the 3 callsites that actually do use DMA caches are well-behaved as of now.
Do your comments require the patch to be redone (partially or entirely)? In that case someone else should probably take it and improve it, as I hardly understand the issues you raise. Or is the patch already queued somewhere, with Cristoph's Ack attached?
Thanks,
Paul Bolle
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · Paul Bolle
Do your comments require the patch to be redone (partially or entirely)? In that case someone else should probably take it and improve it, as I hardly understand the issues you raise. Or is the patch already queued somewhere, with Cristoph's Ack attached?
Please respin the patch taking Johannes feedback into consideration.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>