Message ID | 1478163499-110185-1-git-send-email-puck.chen@hisilicon.com |
---|---|
State | New |
Headers | show |
Hi Chen, [auto build test ERROR on mmotm/master] [also build test ERROR on v4.9-rc3 next-20161028] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Chen-Feng/mm-cma-improve-utilization-of-cma-pages/20161103-173624 base: git://git.cmpxchg.org/linux-mmotm.git master config: x86_64-randconfig-x011-201644 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): In file included from include/linux/slab.h:14:0, from include/linux/crypto.h:24, from arch/x86/kernel/asm-offsets.c:8: include/linux/gfp.h: In function 'gfpflags_to_migratetype': >> include/linux/gfp.h:274:10: error: 'MIGRATE_CMA' undeclared (first use in this function) return MIGRATE_CMA; ^~~~~~~~~~~ include/linux/gfp.h:274:10: note: each undeclared identifier is reported only once for each function it appears in make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1 make[2]: Target '__build' not remade because of errors. make[1]: *** [prepare0] Error 2 make[1]: Target 'prepare' not remade because of errors. make: *** [sub-make] Error 2 vim +/MIGRATE_CMA +274 include/linux/gfp.h 268 { 269 VM_WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK); 270 BUILD_BUG_ON((1UL << GFP_MOVABLE_SHIFT) != ___GFP_MOVABLE); 271 BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE); 272 273 if (IS_ENABLED(CONFIG_CMA) && gfp_flags & __GFP_MOVABLE) > 274 return MIGRATE_CMA; 275 276 if (unlikely(page_group_by_mobility_disabled)) 277 return MIGRATE_UNMOVABLE; --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Sorry for this. Only test on arm64. Should be this: +#if IS_ENABLED(CONFIG_CMA) + if (gfp_flags & __GFP_MOVABLE) + return MIGRATE_CMA; +#endif On 2016/11/3 17:54, kbuild test robot wrote: > Hi Chen, > > [auto build test ERROR on mmotm/master] > [also build test ERROR on v4.9-rc3 next-20161028] > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] > > url: https://github.com/0day-ci/linux/commits/Chen-Feng/mm-cma-improve-utilization-of-cma-pages/20161103-173624 > base: git://git.cmpxchg.org/linux-mmotm.git master > config: x86_64-randconfig-x011-201644 (attached as .config) > compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 > reproduce: > # save the attached .config to linux build tree > make ARCH=x86_64 > > All errors (new ones prefixed by >>): > > In file included from include/linux/slab.h:14:0, > from include/linux/crypto.h:24, > from arch/x86/kernel/asm-offsets.c:8: > include/linux/gfp.h: In function 'gfpflags_to_migratetype': >>> include/linux/gfp.h:274:10: error: 'MIGRATE_CMA' undeclared (first use in this function) > return MIGRATE_CMA; > ^~~~~~~~~~~ > include/linux/gfp.h:274:10: note: each undeclared identifier is reported only once for each function it appears in > make[2]: *** [arch/x86/kernel/asm-offsets.s] Error 1 > make[2]: Target '__build' not remade because of errors. > make[1]: *** [prepare0] Error 2 > make[1]: Target 'prepare' not remade because of errors. > make: *** [sub-make] Error 2 > > vim +/MIGRATE_CMA +274 include/linux/gfp.h > > 268 { > 269 VM_WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK); > 270 BUILD_BUG_ON((1UL << GFP_MOVABLE_SHIFT) != ___GFP_MOVABLE); > 271 BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE); > 272 > 273 if (IS_ENABLED(CONFIG_CMA) && gfp_flags & __GFP_MOVABLE) > > 274 return MIGRATE_CMA; > 275 > 276 if (unlikely(page_group_by_mobility_disabled)) > 277 return MIGRATE_UNMOVABLE; > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation >
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index f8041f9de..0bb8599 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -270,6 +270,9 @@ static inline int gfpflags_to_migratetype(const gfp_t gfp_flags) BUILD_BUG_ON((1UL << GFP_MOVABLE_SHIFT) != ___GFP_MOVABLE); BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE); + if (IS_ENABLED(CONFIG_CMA) && gfp_flags & __GFP_MOVABLE) + return MIGRATE_CMA; + if (unlikely(page_group_by_mobility_disabled)) return MIGRATE_UNMOVABLE; diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 0f088f3..c7875c1 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -39,8 +39,6 @@ enum { MIGRATE_UNMOVABLE, MIGRATE_MOVABLE, MIGRATE_RECLAIMABLE, - MIGRATE_PCPTYPES, /* the number of types on the pcp lists */ - MIGRATE_HIGHATOMIC = MIGRATE_PCPTYPES, #ifdef CONFIG_CMA /* * MIGRATE_CMA migration type is designed to mimic the way @@ -57,6 +55,8 @@ enum { */ MIGRATE_CMA, #endif + MIGRATE_PCPTYPES, /* the number of types on the pcp lists */ + MIGRATE_HIGHATOMIC = MIGRATE_PCPTYPES, #ifdef CONFIG_MEMORY_ISOLATION MIGRATE_ISOLATE, /* can't allocate from here */ #endif diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 8fd42aa..33ed6f3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1828,17 +1828,6 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order, #endif }; -#ifdef CONFIG_CMA -static struct page *__rmqueue_cma_fallback(struct zone *zone, - unsigned int order) -{ - return __rmqueue_smallest(zone, order, MIGRATE_CMA); -} -#else -static inline struct page *__rmqueue_cma_fallback(struct zone *zone, - unsigned int order) { return NULL; } -#endif - /* * Move the free pages in a range to the free lists of the requested type. * Note that start_page and end_pages are not aligned on a pageblock @@ -2171,10 +2160,13 @@ static struct page *__rmqueue(struct zone *zone, unsigned int order, struct page *page; page = __rmqueue_smallest(zone, order, migratetype); - if (unlikely(!page)) { - if (migratetype == MIGRATE_MOVABLE) - page = __rmqueue_cma_fallback(zone, order); + /* Fallback cma type to movable here */ + if (!page && migratetype == MIGRATE_CMA) { + migratetype = MIGRATE_MOVABLE; + page = __rmqueue_smallest(zone, order, migratetype); + } + if (unlikely(!page)) { if (!page) page = __rmqueue_fallback(zone, order, migratetype); } @@ -2787,7 +2779,7 @@ bool __zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark, if (alloc_harder) return true; - for (mt = 0; mt < MIGRATE_PCPTYPES; mt++) { + for (mt = 0; mt < MIGRATE_PCPTYPES - 1; mt++) { if (!list_empty(&area->free_list[mt])) return true; } @@ -4206,10 +4198,10 @@ static void show_migration_types(unsigned char type) [MIGRATE_UNMOVABLE] = 'U', [MIGRATE_MOVABLE] = 'M', [MIGRATE_RECLAIMABLE] = 'E', - [MIGRATE_HIGHATOMIC] = 'H', #ifdef CONFIG_CMA [MIGRATE_CMA] = 'C', #endif + [MIGRATE_HIGHATOMIC] = 'H', #ifdef CONFIG_MEMORY_ISOLATION [MIGRATE_ISOLATE] = 'I', #endif
Currently, cma pages can only be use by fallback of movable. When there is no movable pages, the pcp pages will also be refilled. So use the cma type before movable pages, and let cma-type fallback to movable type. I also have seen Joonsoo Kim on cma-zone. Makes cma pages a zone. It's a good idea. But while testing it, the cma zone can be exhausted soon. Then the cma zone will always doing balance. The slab_scans and swap ion/out will be too high. CC: Qiu xishi <qiuxishi@huawei.com> Signed-off-by: Chen Feng <puck.chen@hisilicon.com> Reviewd-by: Fu Jun <oliver.fu@hisilicon.com> --- include/linux/gfp.h | 3 +++ include/linux/mmzone.h | 4 ++-- mm/page_alloc.c | 24 ++++++++---------------- 3 files changed, 13 insertions(+), 18 deletions(-) -- 1.9.1