* [PATCH v4 0/4] mm: clean up names and parameters of memmap_init_xxxx functions @ 2021-01-20 4:52 Baoquan He 2021-01-20 4:52 ` [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() Baoquan He ` (3 more replies) 0 siblings, 4 replies; 12+ messages in thread From: Baoquan He @ 2021-01-20 4:52 UTC (permalink / raw) To: linux-kernel; +Cc: linux-mm, akpm, rppt, david, bhe This patchset is correcting inappropriate function names of memmap_init_xxx, and simplify parameters of functions in the code flow when I tried to fix a regression bug in memmap defer init. This is based on the latest next/master. v3 can be found here: https://lore.kernel.org/linux-mm/20210105074708.18483-1-bhe@redhat.com/ v3->v4: - Rebased patch 1, 2 on top of Mike's below new patch. [PATCH v3 0/2] mm: fix initialization of struct page for holes in memory layout - Move the code of renaming function parameter 'range_start_pfn' and local variable 'range_end_pfn' of memmap_init() from patch 1 to patch 2 according to David's comment. - Use the reverse Christmas tree style to reorder the local variables in memmap_init_zone() in patch 2 accodrding to David's comment. Baoquan He (4): mm: rename memmap_init() and memmap_init_zone() mm: simplify parater of function memmap_init_zone() mm: simplify parameter of setup_usemap() mm: remove unneeded local variable in free_area_init_core arch/ia64/include/asm/pgtable.h | 3 +-- arch/ia64/mm/init.c | 14 +++++----- include/linux/mm.h | 2 +- mm/memory_hotplug.c | 2 +- mm/page_alloc.c | 46 ++++++++++++++------------------- 5 files changed, 31 insertions(+), 36 deletions(-) -- 2.17.2 ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() 2021-01-20 4:52 [PATCH v4 0/4] mm: clean up names and parameters of memmap_init_xxxx functions Baoquan He @ 2021-01-20 4:52 ` Baoquan He 2021-01-20 15:47 ` kernel test robot 2021-01-22 8:46 ` David Hildenbrand 2021-01-20 4:52 ` [PATCH v4 2/4] mm: simplify parater of function memmap_init_zone() Baoquan He ` (2 subsequent siblings) 3 siblings, 2 replies; 12+ messages in thread From: Baoquan He @ 2021-01-20 4:52 UTC (permalink / raw) To: linux-kernel; +Cc: linux-mm, akpm, rppt, david, bhe The current memmap_init_zone() only handles memory region inside one zone, actually memmap_init() does the memmap init of one zone. So rename both of them accordingly. Signed-off-by: Baoquan He <bhe@redhat.com> --- arch/ia64/include/asm/pgtable.h | 2 +- arch/ia64/mm/init.c | 6 +++--- include/linux/mm.h | 2 +- mm/memory_hotplug.c | 2 +- mm/page_alloc.c | 8 ++++---- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h index 779b6972aa84..dce2ff37df65 100644 --- a/arch/ia64/include/asm/pgtable.h +++ b/arch/ia64/include/asm/pgtable.h @@ -520,7 +520,7 @@ extern struct page *zero_page_memmap_ptr; # ifdef CONFIG_VIRTUAL_MEM_MAP /* arch mem_map init routine is needed due to holes in a virtual mem_map */ - extern void memmap_init (unsigned long size, int nid, unsigned long zone, + extern void memmap_init_zone(unsigned long size, int nid, unsigned long zone, unsigned long start_pfn); # endif /* CONFIG_VIRTUAL_MEM_MAP */ # endif /* !__ASSEMBLY__ */ diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index e76386a3479e..c8e68e92beb3 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c @@ -535,18 +535,18 @@ virtual_memmap_init(u64 start, u64 end, void *arg) / sizeof(struct page)); if (map_start < map_end) - memmap_init_zone((unsigned long)(map_end - map_start), + memmap_init_range((unsigned long)(map_end - map_start), args->nid, args->zone, page_to_pfn(map_start), page_to_pfn(map_end), MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); return 0; } void __meminit -memmap_init (unsigned long size, int nid, unsigned long zone, +memmap_init_zone(unsigned long size, int nid, unsigned long zone, unsigned long start_pfn) { if (!vmem_map) { - memmap_init_zone(size, nid, zone, start_pfn, start_pfn + size, + memmap_init_range(size, nid, zone, start_pfn, start_pfn + size, MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); } else { struct page *start; diff --git a/include/linux/mm.h b/include/linux/mm.h index 3dac7bc667ee..56bb239f9150 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -2398,7 +2398,7 @@ extern int __meminit early_pfn_to_nid(unsigned long pfn); #endif extern void set_dma_reserve(unsigned long new_dma_reserve); -extern void memmap_init_zone(unsigned long, int, unsigned long, +extern void memmap_init_range(unsigned long, int, unsigned long, unsigned long, unsigned long, enum meminit_context, struct vmem_altmap *, int migratetype); extern void setup_per_zone_wmarks(void); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index f9d57b9be8c7..ddcb1cd24c60 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -713,7 +713,7 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, * expects the zone spans the pfn range. All the pages in the range * are reserved so nobody should be touching them so we should be safe */ - memmap_init_zone(nr_pages, nid, zone_idx(zone), start_pfn, 0, + memmap_init_range(nr_pages, nid, zone_idx(zone), start_pfn, 0, MEMINIT_HOTPLUG, altmap, migratetype); set_zone_contiguous(zone); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 44ec5594798d..42a1d2d2a87d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6117,7 +6117,7 @@ overlap_memmap_init(unsigned long zone, unsigned long *pfn) * (usually MIGRATE_MOVABLE). Besides setting the migratetype, no related * zone stats (e.g., nr_isolate_pageblock) are touched. */ -void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, +void __meminit memmap_init_range(unsigned long size, int nid, unsigned long zone, unsigned long start_pfn, unsigned long zone_end_pfn, enum meminit_context context, struct vmem_altmap *altmap, int migratetype) @@ -6254,7 +6254,7 @@ static void __meminit zone_init_free_lists(struct zone *zone) } } -void __meminit __weak memmap_init(unsigned long size, int nid, +void __meminit __weak memmap_init_zone(unsigned long size, int nid, unsigned long zone, unsigned long range_start_pfn) { @@ -6268,7 +6268,7 @@ void __meminit __weak memmap_init(unsigned long size, int nid, if (end_pfn > start_pfn) { size = end_pfn - start_pfn; - memmap_init_zone(size, nid, zone, start_pfn, range_end_pfn, + memmap_init_range(size, nid, zone, start_pfn, range_end_pfn, MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); } } @@ -6978,7 +6978,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat) set_pageblock_order(); setup_usemap(pgdat, zone, zone_start_pfn, size); init_currently_empty_zone(zone, zone_start_pfn, size); - memmap_init(size, nid, j, zone_start_pfn); + memmap_init_zone(size, nid, j, zone_start_pfn); } } -- 2.17.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() 2021-01-20 4:52 ` [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() Baoquan He @ 2021-01-20 15:47 ` kernel test robot 2021-01-21 8:17 ` Baoquan He 2021-01-22 7:13 ` Baoquan He 2021-01-22 8:46 ` David Hildenbrand 1 sibling, 2 replies; 12+ messages in thread From: kernel test robot @ 2021-01-20 15:47 UTC (permalink / raw) To: Baoquan He, linux-kernel; +Cc: kbuild-all, linux-mm, akpm, rppt, david, bhe [-- Attachment #1: Type: text/plain, Size: 2973 bytes --] Hi Baoquan, I love your patch! Perhaps something to improve: [auto build test WARNING on linux/master] [also build test WARNING on linus/master v5.11-rc4 next-20210120] [cannot apply to mmotm/master hnaz-linux-mm/master ia64/next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e2a199f6ccdc15cf111d68d212e2fd4ce65682e config: mips-randconfig-r036-20210120 (attached as .config) compiler: mips-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/1bbb0b35dd2fae4a7a38098e63899677c2e53108 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 git checkout 1bbb0b35dd2fae4a7a38098e63899677c2e53108 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): mm/page_alloc.c:3597:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes] 3597 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) | ^~~~~~~~~~~~~~~~~~~~~~ >> mm/page_alloc.c:6258:23: warning: no previous prototype for 'memmap_init_zone' [-Wmissing-prototypes] 6258 | void __meminit __weak memmap_init_zone(unsigned long size, int nid, | ^~~~~~~~~~~~~~~~ vim +/memmap_init_zone +6258 mm/page_alloc.c 6257 > 6258 void __meminit __weak memmap_init_zone(unsigned long size, int nid, 6259 unsigned long zone, 6260 unsigned long range_start_pfn) 6261 { 6262 unsigned long start_pfn, end_pfn; 6263 unsigned long range_end_pfn = range_start_pfn + size; 6264 int i; 6265 6266 for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { 6267 start_pfn = clamp(start_pfn, range_start_pfn, range_end_pfn); 6268 end_pfn = clamp(end_pfn, range_start_pfn, range_end_pfn); 6269 6270 if (end_pfn > start_pfn) { 6271 size = end_pfn - start_pfn; 6272 memmap_init_range(size, nid, zone, start_pfn, range_end_pfn, 6273 MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); 6274 } 6275 } 6276 } 6277 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 30930 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() 2021-01-20 15:47 ` kernel test robot @ 2021-01-21 8:17 ` Baoquan He 2021-01-21 8:25 ` Mike Rapoport 2021-01-22 7:13 ` Baoquan He 1 sibling, 1 reply; 12+ messages in thread From: Baoquan He @ 2021-01-21 8:17 UTC (permalink / raw) To: kernel test robot; +Cc: linux-kernel, kbuild-all, linux-mm, akpm, rppt, david On 01/20/21 at 11:47pm, kernel test robot wrote: > Hi Baoquan, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on linux/master] > [also build test WARNING on linus/master v5.11-rc4 next-20210120] > [cannot apply to mmotm/master hnaz-linux-mm/master ia64/next] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: https://github.com/0day-ci/linux/commits/Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 > base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e2a199f6ccdc15cf111d68d212e2fd4ce65682e > config: mips-randconfig-r036-20210120 (attached as .config) > compiler: mips-linux-gcc (GCC) 9.3.0 > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/0day-ci/linux/commit/1bbb0b35dd2fae4a7a38098e63899677c2e53108 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 > git checkout 1bbb0b35dd2fae4a7a38098e63899677c2e53108 > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > mm/page_alloc.c:3597:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes] > 3597 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) > | ^~~~~~~~~~~~~~~~~~~~~~ > >> mm/page_alloc.c:6258:23: warning: no previous prototype for 'memmap_init_zone' [-Wmissing-prototypes] > 6258 | void __meminit __weak memmap_init_zone(unsigned long size, int nid, This is not introduced by this patch, but existing issue, should be not related to this patchset. I will investigate and see what we should do with memmap_init_zone(), adding static or adding it to header file, or just leave it as should_fail_alloc_page(). By the way, I tried to reproduce on a fedora 32 system of x86 arch, but met below issue. could you help check what I can do to fix the error. [root@dell-per710-01 linux]# COMPILER_INSTALL_PATH=~/0day COMPILER=gcc-9.3.0 ~/bin/make.cross ARCH=mips Compiler will be installed in /root/0day make W=1 CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y CROSS_COMPILE=/root/0day/gcc-9.3.0-nolibc/mips-linux/bin/mips-linux- --jobs=16 ARCH=mips HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so HOSTCXX scripts/gcc-plugins/structleak_plugin.so HOSTCXX scripts/gcc-plugins/randomize_layout_plugin.so In file included from /root/0day/gcc-9.3.0-nolibc/mips-linux/bin/../lib/gcc/mips-linux/9.3.0/plugin/include/gcc-plugin.h:28, from scripts/gcc-plugins/gcc-common.h:7, from scripts/gcc-plugins/latent_entropy_plugin.c:78: /root/0day/gcc-9.3.0-nolibc/mips-linux/bin/../lib/gcc/mips-linux/9.3.0/plugin/include/system.h:687:10: fatal error: gmp.h: No such file or directy 687 | #include <gmp.h> | ^~~~~~~ compilation terminated. make[2]: *** [scripts/gcc-plugins/Makefile:47: scripts/gcc-plugins/latent_entropy_plugin.so] Error 1 make[2]: *** Waiting for unfinished jobs.. Thanks Baoquan > | ^~~~~~~~~~~~~~~~ > > > vim +/memmap_init_zone +6258 mm/page_alloc.c > > 6257 > > 6258 void __meminit __weak memmap_init_zone(unsigned long size, int nid, > 6259 unsigned long zone, > 6260 unsigned long range_start_pfn) > 6261 { > 6262 unsigned long start_pfn, end_pfn; > 6263 unsigned long range_end_pfn = range_start_pfn + size; > 6264 int i; > 6265 > 6266 for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { > 6267 start_pfn = clamp(start_pfn, range_start_pfn, range_end_pfn); > 6268 end_pfn = clamp(end_pfn, range_start_pfn, range_end_pfn); > 6269 > 6270 if (end_pfn > start_pfn) { > 6271 size = end_pfn - start_pfn; > 6272 memmap_init_range(size, nid, zone, start_pfn, range_end_pfn, > 6273 MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > 6274 } > 6275 } > 6276 } > 6277 > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() 2021-01-21 8:17 ` Baoquan He @ 2021-01-21 8:25 ` Mike Rapoport 2021-01-21 8:43 ` Baoquan He 0 siblings, 1 reply; 12+ messages in thread From: Mike Rapoport @ 2021-01-21 8:25 UTC (permalink / raw) To: Baoquan He Cc: kernel test robot, linux-kernel, kbuild-all, linux-mm, akpm, david On Thu, Jan 21, 2021 at 04:17:27PM +0800, Baoquan He wrote: > On 01/20/21 at 11:47pm, kernel test robot wrote: > > Hi Baoquan, > > > > I love your patch! Perhaps something to improve: > > > > [auto build test WARNING on linux/master] > > [also build test WARNING on linus/master v5.11-rc4 next-20210120] > > [cannot apply to mmotm/master hnaz-linux-mm/master ia64/next] > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > And when submitting patch, we suggest to use '--base' as documented in > > https://git-scm.com/docs/git-format-patch] > > > > url: https://github.com/0day-ci/linux/commits/Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e2a199f6ccdc15cf111d68d212e2fd4ce65682e > > config: mips-randconfig-r036-20210120 (attached as .config) > > compiler: mips-linux-gcc (GCC) 9.3.0 > > reproduce (this is a W=1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # https://github.com/0day-ci/linux/commit/1bbb0b35dd2fae4a7a38098e63899677c2e53108 > > git remote add linux-review https://github.com/0day-ci/linux > > git fetch --no-tags linux-review Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 > > git checkout 1bbb0b35dd2fae4a7a38098e63899677c2e53108 > > # save the attached .config to linux build tree > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips > > > > If you fix the issue, kindly add following tag as appropriate > > Reported-by: kernel test robot <lkp@intel.com> > > > > All warnings (new ones prefixed by >>): > > > > mm/page_alloc.c:3597:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes] > > 3597 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) > > | ^~~~~~~~~~~~~~~~~~~~~~ > > >> mm/page_alloc.c:6258:23: warning: no previous prototype for 'memmap_init_zone' [-Wmissing-prototypes] > > 6258 | void __meminit __weak memmap_init_zone(unsigned long size, int nid, > > This is not introduced by this patch, but existing issue, should > be not related to this patchset. I will investigate and see what we > should do with memmap_init_zone(), adding static or adding it to header > file, or just leave it as should_fail_alloc_page(). > > > By the way, I tried to reproduce on a fedora 32 system of x86 arch, but > met below issue. could you help check what I can do to fix the error. > > > [root@dell-per710-01 linux]# COMPILER_INSTALL_PATH=~/0day COMPILER=gcc-9.3.0 ~/bin/make.cross ARCH=mips > Compiler will be installed in /root/0day > make W=1 CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y CROSS_COMPILE=/root/0day/gcc-9.3.0-nolibc/mips-linux/bin/mips-linux- --jobs=16 ARCH=mips > HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so > HOSTCXX scripts/gcc-plugins/structleak_plugin.so > HOSTCXX scripts/gcc-plugins/randomize_layout_plugin.so > In file included from /root/0day/gcc-9.3.0-nolibc/mips-linux/bin/../lib/gcc/mips-linux/9.3.0/plugin/include/gcc-plugin.h:28, > from scripts/gcc-plugins/gcc-common.h:7, > from scripts/gcc-plugins/latent_entropy_plugin.c:78: > /root/0day/gcc-9.3.0-nolibc/mips-linux/bin/../lib/gcc/mips-linux/9.3.0/plugin/include/system.h:687:10: fatal error: gmp.h: No such file or directy > 687 | #include <gmp.h> > | ^~~~~~~ > compilation terminated. > make[2]: *** [scripts/gcc-plugins/Makefile:47: scripts/gcc-plugins/latent_entropy_plugin.so] Error 1 > make[2]: *** Waiting for unfinished jobs.. Do you have gmp-devel installed? > Thanks > Baoquan > > > | ^~~~~~~~~~~~~~~~ > > > > > > vim +/memmap_init_zone +6258 mm/page_alloc.c > > > > 6257 > > > 6258 void __meminit __weak memmap_init_zone(unsigned long size, int nid, > > 6259 unsigned long zone, > > 6260 unsigned long range_start_pfn) > > 6261 { > > 6262 unsigned long start_pfn, end_pfn; > > 6263 unsigned long range_end_pfn = range_start_pfn + size; > > 6264 int i; > > 6265 > > 6266 for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { > > 6267 start_pfn = clamp(start_pfn, range_start_pfn, range_end_pfn); > > 6268 end_pfn = clamp(end_pfn, range_start_pfn, range_end_pfn); > > 6269 > > 6270 if (end_pfn > start_pfn) { > > 6271 size = end_pfn - start_pfn; > > 6272 memmap_init_range(size, nid, zone, start_pfn, range_end_pfn, > > 6273 MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > > 6274 } > > 6275 } > > 6276 } > > 6277 > > > > --- > > 0-DAY CI Kernel Test Service, Intel Corporation > > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org > > -- Sincerely yours, Mike. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() 2021-01-21 8:25 ` Mike Rapoport @ 2021-01-21 8:43 ` Baoquan He 0 siblings, 0 replies; 12+ messages in thread From: Baoquan He @ 2021-01-21 8:43 UTC (permalink / raw) To: Mike Rapoport Cc: kernel test robot, linux-kernel, kbuild-all, linux-mm, akpm, david On 01/21/21 at 10:25am, Mike Rapoport wrote: > On Thu, Jan 21, 2021 at 04:17:27PM +0800, Baoquan He wrote: > > On 01/20/21 at 11:47pm, kernel test robot wrote: > > > Hi Baoquan, > > > > > > I love your patch! Perhaps something to improve: > > > > > > [auto build test WARNING on linux/master] > > > [also build test WARNING on linus/master v5.11-rc4 next-20210120] > > > [cannot apply to mmotm/master hnaz-linux-mm/master ia64/next] > > > [If your patch is applied to the wrong git tree, kindly drop us a note. > > > And when submitting patch, we suggest to use '--base' as documented in > > > https://git-scm.com/docs/git-format-patch] > > > > > > url: https://github.com/0day-ci/linux/commits/Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 > > > base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e2a199f6ccdc15cf111d68d212e2fd4ce65682e > > > config: mips-randconfig-r036-20210120 (attached as .config) > > > compiler: mips-linux-gcc (GCC) 9.3.0 > > > reproduce (this is a W=1 build): > > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > > > chmod +x ~/bin/make.cross > > > # https://github.com/0day-ci/linux/commit/1bbb0b35dd2fae4a7a38098e63899677c2e53108 > > > git remote add linux-review https://github.com/0day-ci/linux > > > git fetch --no-tags linux-review Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 > > > git checkout 1bbb0b35dd2fae4a7a38098e63899677c2e53108 > > > # save the attached .config to linux build tree > > > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips > > > > > > If you fix the issue, kindly add following tag as appropriate > > > Reported-by: kernel test robot <lkp@intel.com> > > > > > > All warnings (new ones prefixed by >>): > > > > > > mm/page_alloc.c:3597:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes] > > > 3597 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) > > > | ^~~~~~~~~~~~~~~~~~~~~~ > > > >> mm/page_alloc.c:6258:23: warning: no previous prototype for 'memmap_init_zone' [-Wmissing-prototypes] > > > 6258 | void __meminit __weak memmap_init_zone(unsigned long size, int nid, > > > > This is not introduced by this patch, but existing issue, should > > be not related to this patchset. I will investigate and see what we > > should do with memmap_init_zone(), adding static or adding it to header > > file, or just leave it as should_fail_alloc_page(). > > > > > > By the way, I tried to reproduce on a fedora 32 system of x86 arch, but > > met below issue. could you help check what I can do to fix the error. > > > > > > [root@dell-per710-01 linux]# COMPILER_INSTALL_PATH=~/0day COMPILER=gcc-9.3.0 ~/bin/make.cross ARCH=mips > > Compiler will be installed in /root/0day > > make W=1 CONFIG_OF_ALL_DTBS=y CONFIG_DTC=y CROSS_COMPILE=/root/0day/gcc-9.3.0-nolibc/mips-linux/bin/mips-linux- --jobs=16 ARCH=mips > > HOSTCXX scripts/gcc-plugins/latent_entropy_plugin.so > > HOSTCXX scripts/gcc-plugins/structleak_plugin.so > > HOSTCXX scripts/gcc-plugins/randomize_layout_plugin.so > > In file included from /root/0day/gcc-9.3.0-nolibc/mips-linux/bin/../lib/gcc/mips-linux/9.3.0/plugin/include/gcc-plugin.h:28, > > from scripts/gcc-plugins/gcc-common.h:7, > > from scripts/gcc-plugins/latent_entropy_plugin.c:78: > > /root/0day/gcc-9.3.0-nolibc/mips-linux/bin/../lib/gcc/mips-linux/9.3.0/plugin/include/system.h:687:10: fatal error: gmp.h: No such file or directy > > 687 | #include <gmp.h> > > | ^~~~~~~ > > compilation terminated. > > make[2]: *** [scripts/gcc-plugins/Makefile:47: scripts/gcc-plugins/latent_entropy_plugin.so] Error 1 > > make[2]: *** Waiting for unfinished jobs.. > > Do you have gmp-devel installed? Ah, I didn't, thanks. Then libmpc-devel is needed. Will continue. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() 2021-01-20 15:47 ` kernel test robot 2021-01-21 8:17 ` Baoquan He @ 2021-01-22 7:13 ` Baoquan He 1 sibling, 0 replies; 12+ messages in thread From: Baoquan He @ 2021-01-22 7:13 UTC (permalink / raw) To: kernel test robot; +Cc: linux-kernel, kbuild-all, linux-mm, akpm, rppt, david On 01/20/21 at 11:47pm, kernel test robot wrote: > Hi Baoquan, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on linux/master] > [also build test WARNING on linus/master v5.11-rc4 next-20210120] > [cannot apply to mmotm/master hnaz-linux-mm/master ia64/next] > [If your patch is applied to the wrong git tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch] > > url: https://github.com/0day-ci/linux/commits/Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 > base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e2a199f6ccdc15cf111d68d212e2fd4ce65682e > config: mips-randconfig-r036-20210120 (attached as .config) > compiler: mips-linux-gcc (GCC) 9.3.0 > reproduce (this is a W=1 build): > wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # https://github.com/0day-ci/linux/commit/1bbb0b35dd2fae4a7a38098e63899677c2e53108 > git remote add linux-review https://github.com/0day-ci/linux > git fetch --no-tags linux-review Baoquan-He/mm-clean-up-names-and-parameters-of-memmap_init_xxxx-functions/20210120-135239 > git checkout 1bbb0b35dd2fae4a7a38098e63899677c2e53108 > # save the attached .config to linux build tree > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > mm/page_alloc.c:3597:15: warning: no previous prototype for 'should_fail_alloc_page' [-Wmissing-prototypes] > 3597 | noinline bool should_fail_alloc_page(gfp_t gfp_mask, unsigned int order) > | ^~~~~~~~~~~~~~~~~~~~~~ > >> mm/page_alloc.c:6258:23: warning: no previous prototype for 'memmap_init_zone' [-Wmissing-prototypes] > 6258 | void __meminit __weak memmap_init_zone(unsigned long size, int nid, > | ^~~~~~~~~~~~~~~~ Have posted a patch to fix this warning as below. The patch is based on this patchset. https://lore.kernel.org/linux-mm/20210122070359.24010-1-bhe@redhat.com/ Thanks Baoquan ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() 2021-01-20 4:52 ` [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() Baoquan He 2021-01-20 15:47 ` kernel test robot @ 2021-01-22 8:46 ` David Hildenbrand 1 sibling, 0 replies; 12+ messages in thread From: David Hildenbrand @ 2021-01-22 8:46 UTC (permalink / raw) To: Baoquan He, linux-kernel; +Cc: linux-mm, akpm, rppt On 20.01.21 05:52, Baoquan He wrote: > The current memmap_init_zone() only handles memory region inside one zone, > actually memmap_init() does the memmap init of one zone. So rename both of > them accordingly. > > Signed-off-by: Baoquan He <bhe@redhat.com> > --- > arch/ia64/include/asm/pgtable.h | 2 +- > arch/ia64/mm/init.c | 6 +++--- > include/linux/mm.h | 2 +- > mm/memory_hotplug.c | 2 +- > mm/page_alloc.c | 8 ++++---- > 5 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h > index 779b6972aa84..dce2ff37df65 100644 > --- a/arch/ia64/include/asm/pgtable.h > +++ b/arch/ia64/include/asm/pgtable.h > @@ -520,7 +520,7 @@ extern struct page *zero_page_memmap_ptr; > > # ifdef CONFIG_VIRTUAL_MEM_MAP > /* arch mem_map init routine is needed due to holes in a virtual mem_map */ > - extern void memmap_init (unsigned long size, int nid, unsigned long zone, > + extern void memmap_init_zone(unsigned long size, int nid, unsigned long zone, > unsigned long start_pfn); > # endif /* CONFIG_VIRTUAL_MEM_MAP */ > # endif /* !__ASSEMBLY__ */ > diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c > index e76386a3479e..c8e68e92beb3 100644 > --- a/arch/ia64/mm/init.c > +++ b/arch/ia64/mm/init.c > @@ -535,18 +535,18 @@ virtual_memmap_init(u64 start, u64 end, void *arg) > / sizeof(struct page)); > > if (map_start < map_end) > - memmap_init_zone((unsigned long)(map_end - map_start), > + memmap_init_range((unsigned long)(map_end - map_start), > args->nid, args->zone, page_to_pfn(map_start), page_to_pfn(map_end), > MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > return 0; > } > > void __meminit > -memmap_init (unsigned long size, int nid, unsigned long zone, > +memmap_init_zone(unsigned long size, int nid, unsigned long zone, > unsigned long start_pfn) > { > if (!vmem_map) { > - memmap_init_zone(size, nid, zone, start_pfn, start_pfn + size, > + memmap_init_range(size, nid, zone, start_pfn, start_pfn + size, > MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > } else { > struct page *start; > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 3dac7bc667ee..56bb239f9150 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -2398,7 +2398,7 @@ extern int __meminit early_pfn_to_nid(unsigned long pfn); > #endif > > extern void set_dma_reserve(unsigned long new_dma_reserve); > -extern void memmap_init_zone(unsigned long, int, unsigned long, > +extern void memmap_init_range(unsigned long, int, unsigned long, > unsigned long, unsigned long, enum meminit_context, > struct vmem_altmap *, int migratetype); > extern void setup_per_zone_wmarks(void); > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c > index f9d57b9be8c7..ddcb1cd24c60 100644 > --- a/mm/memory_hotplug.c > +++ b/mm/memory_hotplug.c > @@ -713,7 +713,7 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, > * expects the zone spans the pfn range. All the pages in the range > * are reserved so nobody should be touching them so we should be safe > */ > - memmap_init_zone(nr_pages, nid, zone_idx(zone), start_pfn, 0, > + memmap_init_range(nr_pages, nid, zone_idx(zone), start_pfn, 0, > MEMINIT_HOTPLUG, altmap, migratetype); > > set_zone_contiguous(zone); > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 44ec5594798d..42a1d2d2a87d 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -6117,7 +6117,7 @@ overlap_memmap_init(unsigned long zone, unsigned long *pfn) > * (usually MIGRATE_MOVABLE). Besides setting the migratetype, no related > * zone stats (e.g., nr_isolate_pageblock) are touched. > */ > -void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, > +void __meminit memmap_init_range(unsigned long size, int nid, unsigned long zone, > unsigned long start_pfn, unsigned long zone_end_pfn, > enum meminit_context context, > struct vmem_altmap *altmap, int migratetype) > @@ -6254,7 +6254,7 @@ static void __meminit zone_init_free_lists(struct zone *zone) > } > } > > -void __meminit __weak memmap_init(unsigned long size, int nid, > +void __meminit __weak memmap_init_zone(unsigned long size, int nid, > unsigned long zone, > unsigned long range_start_pfn) > { > @@ -6268,7 +6268,7 @@ void __meminit __weak memmap_init(unsigned long size, int nid, > > if (end_pfn > start_pfn) { > size = end_pfn - start_pfn; > - memmap_init_zone(size, nid, zone, start_pfn, range_end_pfn, > + memmap_init_range(size, nid, zone, start_pfn, range_end_pfn, > MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > } > } > @@ -6978,7 +6978,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat) > set_pageblock_order(); > setup_usemap(pgdat, zone, zone_start_pfn, size); > init_currently_empty_zone(zone, zone_start_pfn, size); > - memmap_init(size, nid, j, zone_start_pfn); > + memmap_init_zone(size, nid, j, zone_start_pfn); > } > } > > Reviewed-by: David Hildenbrand <david@redhat.com> -- Thanks, David / dhildenb ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4 2/4] mm: simplify parater of function memmap_init_zone() 2021-01-20 4:52 [PATCH v4 0/4] mm: clean up names and parameters of memmap_init_xxxx functions Baoquan He 2021-01-20 4:52 ` [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() Baoquan He @ 2021-01-20 4:52 ` Baoquan He 2021-01-22 8:43 ` David Hildenbrand 2021-01-20 4:52 ` [PATCH v4 3/4] mm: simplify parameter of setup_usemap() Baoquan He 2021-01-20 4:52 ` [PATCH v4 4/4] mm: remove unneeded local variable in free_area_init_core Baoquan He 3 siblings, 1 reply; 12+ messages in thread From: Baoquan He @ 2021-01-20 4:52 UTC (permalink / raw) To: linux-kernel; +Cc: linux-mm, akpm, rppt, david, bhe As David suggested, simply passing 'struct zone *zone' is enough. We can get all needed information from 'struct zone*' easily. Suggested-by: David Hildenbrand <david@redhat.com> Signed-off-by: Baoquan He <bhe@redhat.com> --- arch/ia64/include/asm/pgtable.h | 3 +-- arch/ia64/mm/init.c | 12 +++++++----- mm/page_alloc.c | 24 +++++++++++------------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h index dce2ff37df65..2c81394a2430 100644 --- a/arch/ia64/include/asm/pgtable.h +++ b/arch/ia64/include/asm/pgtable.h @@ -520,8 +520,7 @@ extern struct page *zero_page_memmap_ptr; # ifdef CONFIG_VIRTUAL_MEM_MAP /* arch mem_map init routine is needed due to holes in a virtual mem_map */ - extern void memmap_init_zone(unsigned long size, int nid, unsigned long zone, - unsigned long start_pfn); + extern void memmap_init_zone(struct zone *zone); # endif /* CONFIG_VIRTUAL_MEM_MAP */ # endif /* !__ASSEMBLY__ */ diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index c8e68e92beb3..88fb44895408 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c @@ -541,12 +541,14 @@ virtual_memmap_init(u64 start, u64 end, void *arg) return 0; } -void __meminit -memmap_init_zone(unsigned long size, int nid, unsigned long zone, - unsigned long start_pfn) +void __meminit memmap_init_zone(struct zone *zone) { + int nid = zone_to_nid(zone), zone_id = zone_idx(zone); + unsigned long start_pfn = zone->zone_start_pfn; + unsigned long size = zone->spanned_pages; + if (!vmem_map) { - memmap_init_range(size, nid, zone, start_pfn, start_pfn + size, + memmap_init_range(size, nid, zone_id, start_pfn, start_pfn + size, MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); } else { struct page *start; @@ -556,7 +558,7 @@ memmap_init_zone(unsigned long size, int nid, unsigned long zone, args.start = start; args.end = start + size; args.nid = nid; - args.zone = zone; + args.zone = zone_id; efi_memmap_walk(virtual_memmap_init, &args); } diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 42a1d2d2a87d..cbb67d9c1b2a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6254,23 +6254,21 @@ static void __meminit zone_init_free_lists(struct zone *zone) } } -void __meminit __weak memmap_init_zone(unsigned long size, int nid, - unsigned long zone, - unsigned long range_start_pfn) +void __meminit __weak memmap_init_zone(struct zone *zone) { + unsigned long zone_start_pfn = zone->zone_start_pfn; + unsigned long zone_end_pfn = zone_start_pfn + zone->spanned_pages; + int i, nid = zone_to_nid(zone), zone_id = zone_idx(zone); unsigned long start_pfn, end_pfn; - unsigned long range_end_pfn = range_start_pfn + size; - int i; for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { - start_pfn = clamp(start_pfn, range_start_pfn, range_end_pfn); - end_pfn = clamp(end_pfn, range_start_pfn, range_end_pfn); + start_pfn = clamp(start_pfn, zone_start_pfn, zone_end_pfn); + end_pfn = clamp(end_pfn, zone_start_pfn, zone_end_pfn); - if (end_pfn > start_pfn) { - size = end_pfn - start_pfn; - memmap_init_range(size, nid, zone, start_pfn, range_end_pfn, - MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); - } + if (end_pfn > start_pfn) + memmap_init_range(end_pfn - start_pfn, nid, + zone_id, start_pfn, zone_end_pfn, + MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); } } @@ -6978,7 +6976,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat) set_pageblock_order(); setup_usemap(pgdat, zone, zone_start_pfn, size); init_currently_empty_zone(zone, zone_start_pfn, size); - memmap_init_zone(size, nid, j, zone_start_pfn); + memmap_init_zone(zone); } } -- 2.17.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v4 2/4] mm: simplify parater of function memmap_init_zone() 2021-01-20 4:52 ` [PATCH v4 2/4] mm: simplify parater of function memmap_init_zone() Baoquan He @ 2021-01-22 8:43 ` David Hildenbrand 0 siblings, 0 replies; 12+ messages in thread From: David Hildenbrand @ 2021-01-22 8:43 UTC (permalink / raw) To: Baoquan He, linux-kernel; +Cc: linux-mm, akpm, rppt On 20.01.21 05:52, Baoquan He wrote: > As David suggested, simply passing 'struct zone *zone' is enough. We can > get all needed information from 'struct zone*' easily. > > Suggested-by: David Hildenbrand <david@redhat.com> > Signed-off-by: Baoquan He <bhe@redhat.com> > --- > arch/ia64/include/asm/pgtable.h | 3 +-- > arch/ia64/mm/init.c | 12 +++++++----- > mm/page_alloc.c | 24 +++++++++++------------- > 3 files changed, 19 insertions(+), 20 deletions(-) > > diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h > index dce2ff37df65..2c81394a2430 100644 > --- a/arch/ia64/include/asm/pgtable.h > +++ b/arch/ia64/include/asm/pgtable.h > @@ -520,8 +520,7 @@ extern struct page *zero_page_memmap_ptr; > > # ifdef CONFIG_VIRTUAL_MEM_MAP > /* arch mem_map init routine is needed due to holes in a virtual mem_map */ > - extern void memmap_init_zone(unsigned long size, int nid, unsigned long zone, > - unsigned long start_pfn); > + extern void memmap_init_zone(struct zone *zone); > # endif /* CONFIG_VIRTUAL_MEM_MAP */ > # endif /* !__ASSEMBLY__ */ > > diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c > index c8e68e92beb3..88fb44895408 100644 > --- a/arch/ia64/mm/init.c > +++ b/arch/ia64/mm/init.c > @@ -541,12 +541,14 @@ virtual_memmap_init(u64 start, u64 end, void *arg) > return 0; > } > > -void __meminit > -memmap_init_zone(unsigned long size, int nid, unsigned long zone, > - unsigned long start_pfn) > +void __meminit memmap_init_zone(struct zone *zone) > { > + int nid = zone_to_nid(zone), zone_id = zone_idx(zone); > + unsigned long start_pfn = zone->zone_start_pfn; > + unsigned long size = zone->spanned_pages; > + > if (!vmem_map) { > - memmap_init_range(size, nid, zone, start_pfn, start_pfn + size, > + memmap_init_range(size, nid, zone_id, start_pfn, start_pfn + size, > MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > } else { > struct page *start; > @@ -556,7 +558,7 @@ memmap_init_zone(unsigned long size, int nid, unsigned long zone, > args.start = start; > args.end = start + size; > args.nid = nid; > - args.zone = zone; > + args.zone = zone_id; > > efi_memmap_walk(virtual_memmap_init, &args); > } > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 42a1d2d2a87d..cbb67d9c1b2a 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -6254,23 +6254,21 @@ static void __meminit zone_init_free_lists(struct zone *zone) > } > } > > -void __meminit __weak memmap_init_zone(unsigned long size, int nid, > - unsigned long zone, > - unsigned long range_start_pfn) > +void __meminit __weak memmap_init_zone(struct zone *zone) > { > + unsigned long zone_start_pfn = zone->zone_start_pfn; > + unsigned long zone_end_pfn = zone_start_pfn + zone->spanned_pages; > + int i, nid = zone_to_nid(zone), zone_id = zone_idx(zone); > unsigned long start_pfn, end_pfn; > - unsigned long range_end_pfn = range_start_pfn + size; > - int i; > > for_each_mem_pfn_range(i, nid, &start_pfn, &end_pfn, NULL) { > - start_pfn = clamp(start_pfn, range_start_pfn, range_end_pfn); > - end_pfn = clamp(end_pfn, range_start_pfn, range_end_pfn); > + start_pfn = clamp(start_pfn, zone_start_pfn, zone_end_pfn); > + end_pfn = clamp(end_pfn, zone_start_pfn, zone_end_pfn); > > - if (end_pfn > start_pfn) { > - size = end_pfn - start_pfn; > - memmap_init_range(size, nid, zone, start_pfn, range_end_pfn, > - MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > - } > + if (end_pfn > start_pfn) > + memmap_init_range(end_pfn - start_pfn, nid, > + zone_id, start_pfn, zone_end_pfn, > + MEMINIT_EARLY, NULL, MIGRATE_MOVABLE); > } > } > > @@ -6978,7 +6976,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat) > set_pageblock_order(); > setup_usemap(pgdat, zone, zone_start_pfn, size); > init_currently_empty_zone(zone, zone_start_pfn, size); > - memmap_init_zone(size, nid, j, zone_start_pfn); > + memmap_init_zone(zone); > } > } > > Reviewed-by: David Hildenbrand <david@redhat.com> -- Thanks, David / dhildenb ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v4 3/4] mm: simplify parameter of setup_usemap() 2021-01-20 4:52 [PATCH v4 0/4] mm: clean up names and parameters of memmap_init_xxxx functions Baoquan He 2021-01-20 4:52 ` [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() Baoquan He 2021-01-20 4:52 ` [PATCH v4 2/4] mm: simplify parater of function memmap_init_zone() Baoquan He @ 2021-01-20 4:52 ` Baoquan He 2021-01-20 4:52 ` [PATCH v4 4/4] mm: remove unneeded local variable in free_area_init_core Baoquan He 3 siblings, 0 replies; 12+ messages in thread From: Baoquan He @ 2021-01-20 4:52 UTC (permalink / raw) To: linux-kernel; +Cc: linux-mm, akpm, rppt, david, bhe Parameter 'zone' has got needed information, let's remove other unnecessary parameters. Signed-off-by: Baoquan He <bhe@redhat.com> Reviewed-by: Mike Rapoport <rppt@linux.ibm.com> Reviewed-by: David Hildenbrand <david@redhat.com> --- mm/page_alloc.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index cbb67d9c1b2a..69cf19baac12 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6761,25 +6761,22 @@ static unsigned long __init usemap_size(unsigned long zone_start_pfn, unsigned l return usemapsize / 8; } -static void __ref setup_usemap(struct pglist_data *pgdat, - struct zone *zone, - unsigned long zone_start_pfn, - unsigned long zonesize) +static void __ref setup_usemap(struct zone *zone) { - unsigned long usemapsize = usemap_size(zone_start_pfn, zonesize); + unsigned long usemapsize = usemap_size(zone->zone_start_pfn, + zone->spanned_pages); zone->pageblock_flags = NULL; if (usemapsize) { zone->pageblock_flags = memblock_alloc_node(usemapsize, SMP_CACHE_BYTES, - pgdat->node_id); + zone_to_nid(zone)); if (!zone->pageblock_flags) panic("Failed to allocate %ld bytes for zone %s pageblock flags on node %d\n", - usemapsize, zone->name, pgdat->node_id); + usemapsize, zone->name, zone_to_nid(zone)); } } #else -static inline void setup_usemap(struct pglist_data *pgdat, struct zone *zone, - unsigned long zone_start_pfn, unsigned long zonesize) {} +static inline void setup_usemap(struct zone *zone) {} #endif /* CONFIG_SPARSEMEM */ #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE @@ -6974,7 +6971,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat) continue; set_pageblock_order(); - setup_usemap(pgdat, zone, zone_start_pfn, size); + setup_usemap(zone); init_currently_empty_zone(zone, zone_start_pfn, size); memmap_init_zone(zone); } -- 2.17.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v4 4/4] mm: remove unneeded local variable in free_area_init_core 2021-01-20 4:52 [PATCH v4 0/4] mm: clean up names and parameters of memmap_init_xxxx functions Baoquan He ` (2 preceding siblings ...) 2021-01-20 4:52 ` [PATCH v4 3/4] mm: simplify parameter of setup_usemap() Baoquan He @ 2021-01-20 4:52 ` Baoquan He 3 siblings, 0 replies; 12+ messages in thread From: Baoquan He @ 2021-01-20 4:52 UTC (permalink / raw) To: linux-kernel; +Cc: linux-mm, akpm, rppt, david, bhe Local variable 'zone_start_pfn' is not needed since there's only one call site in free_area_init_core(). Let's remove it and pass zone->zone_start_pfn directly to init_currently_empty_zone(). Signed-off-by: Baoquan He <bhe@redhat.com> Reviewed-by: Mike Rapoport <rppt@linux.ibm.com> Reviewed-by: David Hildenbrand <david@redhat.com> --- mm/page_alloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 69cf19baac12..e0df67948ace 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6923,7 +6923,6 @@ static void __init free_area_init_core(struct pglist_data *pgdat) for (j = 0; j < MAX_NR_ZONES; j++) { struct zone *zone = pgdat->node_zones + j; unsigned long size, freesize, memmap_pages; - unsigned long zone_start_pfn = zone->zone_start_pfn; size = zone->spanned_pages; freesize = zone->present_pages; @@ -6972,7 +6971,7 @@ static void __init free_area_init_core(struct pglist_data *pgdat) set_pageblock_order(); setup_usemap(zone); - init_currently_empty_zone(zone, zone_start_pfn, size); + init_currently_empty_zone(zone, zone->zone_start_pfn, size); memmap_init_zone(zone); } } -- 2.17.2 ^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-01-22 8:48 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-20 4:52 [PATCH v4 0/4] mm: clean up names and parameters of memmap_init_xxxx functions Baoquan He 2021-01-20 4:52 ` [PATCH v4 1/4] mm: rename memmap_init() and memmap_init_zone() Baoquan He 2021-01-20 15:47 ` kernel test robot 2021-01-21 8:17 ` Baoquan He 2021-01-21 8:25 ` Mike Rapoport 2021-01-21 8:43 ` Baoquan He 2021-01-22 7:13 ` Baoquan He 2021-01-22 8:46 ` David Hildenbrand 2021-01-20 4:52 ` [PATCH v4 2/4] mm: simplify parater of function memmap_init_zone() Baoquan He 2021-01-22 8:43 ` David Hildenbrand 2021-01-20 4:52 ` [PATCH v4 3/4] mm: simplify parameter of setup_usemap() Baoquan He 2021-01-20 4:52 ` [PATCH v4 4/4] mm: remove unneeded local variable in free_area_init_core Baoquan He
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).