Skip to contentSkip to conversation

x86/mm/64: Rename the argument 'size' as 'nr_pages' in register_page_bootmem_memmap

PATCH Superseded Baoquan He 3 participants 7 messages Oct 24, 2017 – Oct 27, 2017

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Baoquan He

author
#0 lore raw

PATCH 1/1 x86/mm/64: Rename the argument 'size' as 'nr_pages' in register_page_bootmem_memmap

For register_page_bootmem_memmap(), the 3rd argument 'size' indicates the number of pages which are inside the memory section, not a size.

---
 arch/x86/mm/init_64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/init_64.c +2 -2
index 048fbe8fc274..f5aa0d7c4cd1 100644
@@ -1426,10 +1426,10 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
 
 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
 void register_page_bootmem_memmap(unsigned long section_nr,
-				  struct page *start_page, unsigned long size)
+				  struct page *start_page, unsigned long nr_pages)
 {
 	unsigned long addr = (unsigned long)start_page;
-	unsigned long end = (unsigned long)(start_page + size);
+	unsigned long end = (unsigned long)(start_page + nr_pages);
 	unsigned long next;
 	pgd_t *pgd;
 	p4d_t *p4d;
Signature · 1 line
2.5.5
#1 lore raw
Quoted 15 lines · Baoquan He

For register_page_bootmem_memmap(), the 3rd argument 'size' indicates the number of pages which are inside the memory section, not a size.

---
 arch/x86/mm/init_64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/init_64.c +0 -0
index 048fbe8fc274..f5aa0d7c4cd1 100644
@@ -1426,10 +1426,10 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
 
 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)

arch/x86/mm/init_64.c int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node) · line 1435

Quoted 10 lines
arch/x86/mm/init_64.c +2 -2
 void register_page_bootmem_memmap(unsigned long section_nr,
-				  struct page *start_page, unsigned long size)
+				  struct page *start_page, unsigned long nr_pages)
 {
 	unsigned long addr = (unsigned long)start_page;
-	unsigned long end = (unsigned long)(start_page + size);
+	unsigned long end = (unsigned long)(start_page + nr_pages);
 	unsigned long next;
 	pgd_t *pgd;
 	p4d_t *p4d;

This doesn't build on x86-64 allyesconfig:

arch/x86/mm/init_64.c: In function ‘register_page_bootmem_memmap’:
arch/x86/mm/init_64.c:1438:15: error: ‘nr_pages’ redeclared as different kind of symbol arch/x86/mm/init_64.c:1429:46: note: previous definition of ‘nr_pages’ was here

Also note that I improved the changelog (see below), could you please pick those changes up for a v2 submission?

Thanks,

Ingo

==================>

Quoted 1 line

From 67780ebe5c99190d2a946de106bd0c7b83e11b68 Mon Sep 17 00:00:00 2001

From: Baoquan He <[email protected]>
Date: Tue, 24 Oct 2017 20:47:29 +0800
Subject: [PATCH] x86/mm/64: Rename the register_page_bootmem_memmap() 'size' parameter to 'nr_pages'

register_page_bootmem_memmap()'s 3rd 'size' parameter is named in a somewhat misleading fashion - rename it to 'nr_pages' which makes the units of it much clearer.

---
 arch/x86/mm/init_64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/init_64.c +2 -2
index 048fbe8fc274..f5aa0d7c4cd1 100644
@@ -1426,10 +1426,10 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
 
 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
 void register_page_bootmem_memmap(unsigned long section_nr,
-				  struct page *start_page, unsigned long size)
+				  struct page *start_page, unsigned long nr_pages)
 {
 	unsigned long addr = (unsigned long)start_page;
-	unsigned long end = (unsigned long)(start_page + size);
+	unsigned long end = (unsigned long)(start_page + nr_pages);
 	unsigned long next;
 	pgd_t *pgd;
 	p4d_t *p4d;
author
#2 lore raw

Hi Ingo,

Quoted 20 lines · Ingo Molnar
Quoted 7 lines
arch/x86/mm/init_64.c +0 -0
index 048fbe8fc274..f5aa0d7c4cd1 100644
@@ -1426,10 +1426,10 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
 
 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)

arch/x86/mm/init_64.c int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node) · line 1435

Quoted 10 lines
arch/x86/mm/init_64.c +2 -2
 void register_page_bootmem_memmap(unsigned long section_nr,
-				  struct page *start_page, unsigned long size)
+				  struct page *start_page, unsigned long nr_pages)
 {
 	unsigned long addr = (unsigned long)start_page;
-	unsigned long end = (unsigned long)(start_page + size);
+	unsigned long end = (unsigned long)(start_page + nr_pages);
 	unsigned long next;
 	pgd_t *pgd;
 	p4d_t *p4d;

This doesn't build on x86-64 allyesconfig:

Quoted 6 lines

arch/x86/mm/init_64.c: In function ‘register_page_bootmem_memmap’:
arch/x86/mm/init_64.c:1438:15: error: ‘nr_pages’ redeclared as different kind of symbol arch/x86/mm/init_64.c:1429:46: note: previous definition of ‘nr_pages’ was here

Also note that I improved the changelog (see below), could you please pick those changes up for a v2 submission?

Thanks a lot for checking this and rewrote the change log. Seems I didn't merge the change in mm.h. Will make v2 with your patch log changes and repost after testing.

Thanks
Baoquan

Quoted 40 lines

==================>
From 67780ebe5c99190d2a946de106bd0c7b83e11b68 Mon Sep 17 00:00:00 2001
From: Baoquan He <[email protected]>
Date: Tue, 24 Oct 2017 20:47:29 +0800
Subject: [PATCH] x86/mm/64: Rename the register_page_bootmem_memmap() 'size' parameter to 'nr_pages'

register_page_bootmem_memmap()'s 3rd 'size' parameter is named in a somewhat misleading fashion - rename it to 'nr_pages' which makes the units of it much clearer.

---
 arch/x86/mm/init_64.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/init_64.c +2 -2
index 048fbe8fc274..f5aa0d7c4cd1 100644
@@ -1426,10 +1426,10 @@ int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node)
 
 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
 void register_page_bootmem_memmap(unsigned long section_nr,
-				  struct page *start_page, unsigned long size)
+				  struct page *start_page, unsigned long nr_pages)
 {
 	unsigned long addr = (unsigned long)start_page;
-	unsigned long end = (unsigned long)(start_page + size);
+	unsigned long end = (unsigned long)(start_page + nr_pages);
 	unsigned long next;
 	pgd_t *pgd;
 	p4d_t *p4d;
#3 lore raw

Re: [PATCH] x86/mm/64: Rename the register_page_bootmem_memmap() 'size' parameter to 'nr_pages'

In reply to Ingo Molnar
Thank you for the patch! Yet we hit a small issue.

Hi Ingo,

Thank you for the patch! Yet we hit a small issue.
[auto build test ERROR on tip/x86/core]
[also build test ERROR on v4.14-rc6 next-20171018]
[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/Ingo-Molnar/x86-mm-64-Rename-the-register_page_bootmem_memmap-size-parameter-to-nr_pages/20171027-181456
config: x86_64-kexec (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 >>):

arch/x86/mm/init_64.c: In function 'register_page_bootmem_memmap':

>> arch/x86/mm/init_64.c:1341:15: error: 'nr_pages' redeclared as different kind of symbol
     unsigned int nr_pages;
                  ^~~~~~~~

arch/x86/mm/init_64.c:1332:46: note: previous definition of 'nr_pages' was here
struct page *start_page, unsigned long nr_pages)
^~~~~~~~

vim +/nr_pages +1341 arch/x86/mm/init_64.c

c2b91e2ee Yinghai Lu         2008-04-12  1329  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1330  #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1331  void register_page_bootmem_memmap(unsigned long section_nr,
56f1692b6 Ingo Molnar        2017-10-24  1332  				  struct page *start_page, unsigned long nr_pages)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1333  {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1334  	unsigned long addr = (unsigned long)start_page;
56f1692b6 Ingo Molnar        2017-10-24  1335  	unsigned long end = (unsigned long)(start_page + nr_pages);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1336  	unsigned long next;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1337  	pgd_t *pgd;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1338  	p4d_t *p4d;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1339  	pud_t *pud;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1340  	pmd_t *pmd;
46723bfa5 Yasuaki Ishimatsu  2013-02-22 @1341  	unsigned int nr_pages;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1342  	struct page *page;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1343  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1344  	for (; addr < end; addr = next) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1345  		pte_t *pte = NULL;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1346  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1347  		pgd = pgd_offset_k(addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1348  		if (pgd_none(*pgd)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1349  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1350  			continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1351  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1352  		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1353  
f2a6a7050 Kirill A. Shutemov 2017-03-17  1354  		p4d = p4d_offset(pgd, addr);
f2a6a7050 Kirill A. Shutemov 2017-03-17  1355  		if (p4d_none(*p4d)) {
f2a6a7050 Kirill A. Shutemov 2017-03-17  1356  			next = (addr + PAGE_SIZE) & PAGE_MASK;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1357  			continue;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1358  		}
f2a6a7050 Kirill A. Shutemov 2017-03-17  1359  		get_page_bootmem(section_nr, p4d_page(*p4d), MIX_SECTION_INFO);
f2a6a7050 Kirill A. Shutemov 2017-03-17  1360  
f2a6a7050 Kirill A. Shutemov 2017-03-17  1361  		pud = pud_offset(p4d, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1362  		if (pud_none(*pud)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1363  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1364  			continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1365  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1366  		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1367  
16bf92261 Borislav Petkov    2016-03-29  1368  		if (!boot_cpu_has(X86_FEATURE_PSE)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1369  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1370  			pmd = pmd_offset(pud, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1371  			if (pmd_none(*pmd))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1372  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1373  			get_page_bootmem(section_nr, pmd_page(*pmd),
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1374  					 MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1375  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1376  			pte = pte_offset_kernel(pmd, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1377  			if (pte_none(*pte))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1378  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1379  			get_page_bootmem(section_nr, pte_page(*pte),
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1380  					 SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1381  		} else {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1382  			next = pmd_addr_end(addr, end);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1383  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1384  			pmd = pmd_offset(pud, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1385  			if (pmd_none(*pmd))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1386  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1387  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1388  			nr_pages = 1 << (get_order(PMD_SIZE));
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1389  			page = pmd_page(*pmd);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1390  			while (nr_pages--)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1391  				get_page_bootmem(section_nr, page++,
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1392  						 SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1393  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1394  	}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1395  }
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1396  #endif
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1397  

:::::: The code at line 1341 was first introduced by commit
:::::: 46723bfa540f0a1e494476a1734d03626a0bd1e0 memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap

:::::: TO: Yasuaki Ishimatsu <[email protected]> :::::: CC: Linus Torvalds <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

author
#4 lore raw

Re: [PATCH] x86/mm/64: Rename the register_page_bootmem_memmap() 'size' parameter to 'nr_pages'

Hi,

Quoted 16 lines · kbuild test robot

Hi Ingo,

Thank you for the patch! Yet we hit a small issue.
[auto build test ERROR on tip/x86/core]
[also build test ERROR on v4.14-rc6 next-20171018]
[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/Ingo-Molnar/x86-mm-64-Rename-the-register_page_bootmem_memmap-size-parameter-to-nr_pages/20171027-181456
config: x86_64-kexec (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 >>):

Quoted 7 lines

arch/x86/mm/init_64.c: In function 'register_page_bootmem_memmap':

Quoted 1 line
Quoted 1 line

arch/x86/mm/init_64.c:1341:15: error: 'nr_pages' redeclared as different kind of symbol

     unsigned int nr_pages;
                  ^~~~~~~~

arch/x86/mm/init_64.c:1332:46: note: previous definition of 'nr_pages' was here
struct page *start_page, unsigned long nr_pages)
^~~~~~~~

The code change is incomplete in this thread, Ingo helped rewrite the patch log in the suggested patch. I catched this error too when rebuilt, will post v3. Please drop this one.

Thanks
Baoquan

Quoted 82 lines

vim +/nr_pages +1341 arch/x86/mm/init_64.c

c2b91e2ee Yinghai Lu         2008-04-12  1329  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1330  #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1331  void register_page_bootmem_memmap(unsigned long section_nr,
56f1692b6 Ingo Molnar        2017-10-24  1332  				  struct page *start_page, unsigned long nr_pages)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1333  {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1334  	unsigned long addr = (unsigned long)start_page;
56f1692b6 Ingo Molnar        2017-10-24  1335  	unsigned long end = (unsigned long)(start_page + nr_pages);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1336  	unsigned long next;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1337  	pgd_t *pgd;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1338  	p4d_t *p4d;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1339  	pud_t *pud;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1340  	pmd_t *pmd;
46723bfa5 Yasuaki Ishimatsu  2013-02-22 @1341  	unsigned int nr_pages;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1342  	struct page *page;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1343  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1344  	for (; addr < end; addr = next) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1345  		pte_t *pte = NULL;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1346  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1347  		pgd = pgd_offset_k(addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1348  		if (pgd_none(*pgd)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1349  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1350  			continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1351  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1352  		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1353  
f2a6a7050 Kirill A. Shutemov 2017-03-17  1354  		p4d = p4d_offset(pgd, addr);
f2a6a7050 Kirill A. Shutemov 2017-03-17  1355  		if (p4d_none(*p4d)) {
f2a6a7050 Kirill A. Shutemov 2017-03-17  1356  			next = (addr + PAGE_SIZE) & PAGE_MASK;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1357  			continue;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1358  		}
f2a6a7050 Kirill A. Shutemov 2017-03-17  1359  		get_page_bootmem(section_nr, p4d_page(*p4d), MIX_SECTION_INFO);
f2a6a7050 Kirill A. Shutemov 2017-03-17  1360  
f2a6a7050 Kirill A. Shutemov 2017-03-17  1361  		pud = pud_offset(p4d, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1362  		if (pud_none(*pud)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1363  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1364  			continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1365  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1366  		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1367  
16bf92261 Borislav Petkov    2016-03-29  1368  		if (!boot_cpu_has(X86_FEATURE_PSE)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1369  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1370  			pmd = pmd_offset(pud, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1371  			if (pmd_none(*pmd))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1372  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1373  			get_page_bootmem(section_nr, pmd_page(*pmd),
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1374  					 MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1375  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1376  			pte = pte_offset_kernel(pmd, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1377  			if (pte_none(*pte))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1378  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1379  			get_page_bootmem(section_nr, pte_page(*pte),
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1380  					 SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1381  		} else {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1382  			next = pmd_addr_end(addr, end);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1383  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1384  			pmd = pmd_offset(pud, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1385  			if (pmd_none(*pmd))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1386  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1387  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1388  			nr_pages = 1 << (get_order(PMD_SIZE));
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1389  			page = pmd_page(*pmd);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1390  			while (nr_pages--)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1391  				get_page_bootmem(section_nr, page++,
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1392  						 SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1393  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1394  	}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1395  }
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1396  #endif
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1397  

:::::: The code at line 1341 was first introduced by commit
:::::: 46723bfa540f0a1e494476a1734d03626a0bd1e0 memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap

:::::: TO: Yasuaki Ishimatsu <[email protected]> :::::: CC: Linus Torvalds <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#5 lore raw
In reply to Baoquan He
url: https://github.com/0day-ci/linux/commits/Baoquan-He/x86-mm-64-Rename-the-argument-size-as-nr_pages-in-register_page_bootmem_memmap/20171026-125956 config: x86_64-allyesconfig (attached as…

Hi Baoquan,

[auto build test ERROR on tip/x86/core]
[also build test ERROR on v4.14-rc6 next-20171018]
[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/Baoquan-He/x86-mm-64-Rename-the-argument-size-as-nr_pages-in-register_page_bootmem_memmap/20171026-125956
config: x86_64-allyesconfig (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 >>):

arch/x86//mm/init_64.c: In function 'register_page_bootmem_memmap':

>> arch/x86//mm/init_64.c:1341:15: error: 'nr_pages' redeclared as different kind of symbol
     unsigned int nr_pages;
                  ^~~~~~~~

arch/x86//mm/init_64.c:1332:46: note: previous definition of 'nr_pages' was here
struct page *start_page, unsigned long nr_pages)
^~~~~~~~

vim +/nr_pages +1341 arch/x86//mm/init_64.c

c2b91e2ee Yinghai Lu         2008-04-12  1329  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1330  #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1331  void register_page_bootmem_memmap(unsigned long section_nr,
b5f7b7e8b Baoquan He         2017-10-24  1332  				  struct page *start_page, unsigned long nr_pages)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1333  {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1334  	unsigned long addr = (unsigned long)start_page;
b5f7b7e8b Baoquan He         2017-10-24  1335  	unsigned long end = (unsigned long)(start_page + nr_pages);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1336  	unsigned long next;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1337  	pgd_t *pgd;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1338  	p4d_t *p4d;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1339  	pud_t *pud;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1340  	pmd_t *pmd;
46723bfa5 Yasuaki Ishimatsu  2013-02-22 @1341  	unsigned int nr_pages;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1342  	struct page *page;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1343  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1344  	for (; addr < end; addr = next) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1345  		pte_t *pte = NULL;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1346  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1347  		pgd = pgd_offset_k(addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1348  		if (pgd_none(*pgd)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1349  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1350  			continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1351  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1352  		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1353  
f2a6a7050 Kirill A. Shutemov 2017-03-17  1354  		p4d = p4d_offset(pgd, addr);
f2a6a7050 Kirill A. Shutemov 2017-03-17  1355  		if (p4d_none(*p4d)) {
f2a6a7050 Kirill A. Shutemov 2017-03-17  1356  			next = (addr + PAGE_SIZE) & PAGE_MASK;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1357  			continue;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1358  		}
f2a6a7050 Kirill A. Shutemov 2017-03-17  1359  		get_page_bootmem(section_nr, p4d_page(*p4d), MIX_SECTION_INFO);
f2a6a7050 Kirill A. Shutemov 2017-03-17  1360  
f2a6a7050 Kirill A. Shutemov 2017-03-17  1361  		pud = pud_offset(p4d, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1362  		if (pud_none(*pud)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1363  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1364  			continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1365  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1366  		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1367  
16bf92261 Borislav Petkov    2016-03-29  1368  		if (!boot_cpu_has(X86_FEATURE_PSE)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1369  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1370  			pmd = pmd_offset(pud, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1371  			if (pmd_none(*pmd))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1372  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1373  			get_page_bootmem(section_nr, pmd_page(*pmd),
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1374  					 MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1375  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1376  			pte = pte_offset_kernel(pmd, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1377  			if (pte_none(*pte))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1378  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1379  			get_page_bootmem(section_nr, pte_page(*pte),
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1380  					 SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1381  		} else {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1382  			next = pmd_addr_end(addr, end);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1383  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1384  			pmd = pmd_offset(pud, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1385  			if (pmd_none(*pmd))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1386  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1387  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1388  			nr_pages = 1 << (get_order(PMD_SIZE));
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1389  			page = pmd_page(*pmd);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1390  			while (nr_pages--)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1391  				get_page_bootmem(section_nr, page++,
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1392  						 SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1393  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1394  	}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1395  }
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1396  #endif
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1397  

:::::: The code at line 1341 was first introduced by commit
:::::: 46723bfa540f0a1e494476a1734d03626a0bd1e0 memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap

:::::: TO: Yasuaki Ishimatsu <[email protected]> :::::: CC: Linus Torvalds <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

author
#6 lore raw
Quoted 13 lines · kbuild test robot

Hi Baoquan,

[auto build test ERROR on tip/x86/core]
[also build test ERROR on v4.14-rc6 next-20171018]
[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/Baoquan-He/x86-mm-64-Rename-the-argument-size-as-nr_pages-in-register_page_bootmem_memmap/20171026-125956
config: x86_64-allyesconfig (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 
Quoted 8 lines

All errors (new ones prefixed by >>):

   arch/x86//mm/init_64.c: In function 'register_page_bootmem_memmap':
Quoted 1 line
Quoted 1 line

arch/x86//mm/init_64.c:1341:15: error: 'nr_pages' redeclared as different kind of symbol

     unsigned int nr_pages;
                  ^~~~~~~~

arch/x86//mm/init_64.c:1332:46: note: previous definition of 'nr_pages' was here
struct page *start_page, unsigned long nr_pages)

Thanks for telling, this patch is incomplete. I have posted v2 and will post v3 per Ingo's comments. So NACK this v1 post.

Quoted 83 lines
                                                 ^~~~~~~~

vim +/nr_pages +1341 arch/x86//mm/init_64.c

c2b91e2ee Yinghai Lu         2008-04-12  1329  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1330  #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1331  void register_page_bootmem_memmap(unsigned long section_nr,
b5f7b7e8b Baoquan He         2017-10-24  1332  				  struct page *start_page, unsigned long nr_pages)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1333  {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1334  	unsigned long addr = (unsigned long)start_page;
b5f7b7e8b Baoquan He         2017-10-24  1335  	unsigned long end = (unsigned long)(start_page + nr_pages);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1336  	unsigned long next;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1337  	pgd_t *pgd;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1338  	p4d_t *p4d;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1339  	pud_t *pud;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1340  	pmd_t *pmd;
46723bfa5 Yasuaki Ishimatsu  2013-02-22 @1341  	unsigned int nr_pages;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1342  	struct page *page;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1343  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1344  	for (; addr < end; addr = next) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1345  		pte_t *pte = NULL;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1346  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1347  		pgd = pgd_offset_k(addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1348  		if (pgd_none(*pgd)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1349  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1350  			continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1351  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1352  		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1353  
f2a6a7050 Kirill A. Shutemov 2017-03-17  1354  		p4d = p4d_offset(pgd, addr);
f2a6a7050 Kirill A. Shutemov 2017-03-17  1355  		if (p4d_none(*p4d)) {
f2a6a7050 Kirill A. Shutemov 2017-03-17  1356  			next = (addr + PAGE_SIZE) & PAGE_MASK;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1357  			continue;
f2a6a7050 Kirill A. Shutemov 2017-03-17  1358  		}
f2a6a7050 Kirill A. Shutemov 2017-03-17  1359  		get_page_bootmem(section_nr, p4d_page(*p4d), MIX_SECTION_INFO);
f2a6a7050 Kirill A. Shutemov 2017-03-17  1360  
f2a6a7050 Kirill A. Shutemov 2017-03-17  1361  		pud = pud_offset(p4d, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1362  		if (pud_none(*pud)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1363  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1364  			continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1365  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1366  		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1367  
16bf92261 Borislav Petkov    2016-03-29  1368  		if (!boot_cpu_has(X86_FEATURE_PSE)) {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1369  			next = (addr + PAGE_SIZE) & PAGE_MASK;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1370  			pmd = pmd_offset(pud, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1371  			if (pmd_none(*pmd))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1372  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1373  			get_page_bootmem(section_nr, pmd_page(*pmd),
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1374  					 MIX_SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1375  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1376  			pte = pte_offset_kernel(pmd, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1377  			if (pte_none(*pte))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1378  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1379  			get_page_bootmem(section_nr, pte_page(*pte),
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1380  					 SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1381  		} else {
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1382  			next = pmd_addr_end(addr, end);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1383  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1384  			pmd = pmd_offset(pud, addr);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1385  			if (pmd_none(*pmd))
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1386  				continue;
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1387  
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1388  			nr_pages = 1 << (get_order(PMD_SIZE));
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1389  			page = pmd_page(*pmd);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1390  			while (nr_pages--)
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1391  				get_page_bootmem(section_nr, page++,
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1392  						 SECTION_INFO);
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1393  		}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1394  	}
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1395  }
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1396  #endif
46723bfa5 Yasuaki Ishimatsu  2013-02-22  1397  

:::::: The code at line 1341 was first introduced by commit
:::::: 46723bfa540f0a1e494476a1734d03626a0bd1e0 memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap

:::::: TO: Yasuaki Ishimatsu <[email protected]> :::::: CC: Linus Torvalds <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation