linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
@ 2013-01-11  9:56 Michal Hocko
  2013-01-11 10:17 ` Michal Hocko
  2013-01-11 10:26 ` Tang Chen
  0 siblings, 2 replies; 12+ messages in thread
From: Michal Hocko @ 2013-01-11  9:56 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Wen Congyang, Yasuaki Ishimatsu, Tang Chen, Wu Jianguo,
	KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki, Lai Jiangshan,
	Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-mm, LKML

Defconfig for x86_64 complains
arch/x86/mm/init_64.c: In function a??register_page_bootmem_memmapa??:
arch/x86/mm/init_64.c:1340: error: implicit declaration of function a??get_page_bootmema??
arch/x86/mm/init_64.c:1340: error: a??MIX_SECTION_INFOa?? undeclared (first
use in this function)
arch/x86/mm/init_64.c:1340: error: (Each undeclared identifier is
reported only once
arch/x86/mm/init_64.c:1340: error: for each function it appears in.)
arch/x86/mm/init_64.c:1361: error: a??SECTION_INFOa?? undeclared (first use in this function)

move register_page_bootmem_memmap to memory_hotplug where it is used and
where it has all required symbols

Signed-off-by: Michal Hocko <mhocko@suse.cz>
---
 arch/x86/mm/init_64.c |   58 -----------------------------------------------
 include/linux/mm.h    |    2 --
 mm/memory_hotplug.c   |   60 ++++++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 59 insertions(+), 61 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index ddd3b58..a6a7494 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1317,64 +1317,6 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node)
 	return 0;
 }
 
-void register_page_bootmem_memmap(unsigned long section_nr,
-				  struct page *start_page, unsigned long size)
-{
-	unsigned long addr = (unsigned long)start_page;
-	unsigned long end = (unsigned long)(start_page + size);
-	unsigned long next;
-	pgd_t *pgd;
-	pud_t *pud;
-	pmd_t *pmd;
-	unsigned int nr_pages;
-	struct page *page;
-
-	for (; addr < end; addr = next) {
-		pte_t *pte = NULL;
-
-		pgd = pgd_offset_k(addr);
-		if (pgd_none(*pgd)) {
-			next = (addr + PAGE_SIZE) & PAGE_MASK;
-			continue;
-		}
-		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
-
-		pud = pud_offset(pgd, addr);
-		if (pud_none(*pud)) {
-			next = (addr + PAGE_SIZE) & PAGE_MASK;
-			continue;
-		}
-		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
-
-		if (!cpu_has_pse) {
-			next = (addr + PAGE_SIZE) & PAGE_MASK;
-			pmd = pmd_offset(pud, addr);
-			if (pmd_none(*pmd))
-				continue;
-			get_page_bootmem(section_nr, pmd_page(*pmd),
-					 MIX_SECTION_INFO);
-
-			pte = pte_offset_kernel(pmd, addr);
-			if (pte_none(*pte))
-				continue;
-			get_page_bootmem(section_nr, pte_page(*pte),
-					 SECTION_INFO);
-		} else {
-			next = pmd_addr_end(addr, end);
-
-			pmd = pmd_offset(pud, addr);
-			if (pmd_none(*pmd))
-				continue;
-
-			nr_pages = 1 << (get_order(PMD_SIZE));
-			page = pmd_page(*pmd);
-			while (nr_pages--)
-				get_page_bootmem(section_nr, page++,
-						 SECTION_INFO);
-		}
-	}
-}
-
 void __meminit vmemmap_populate_print_last(void)
 {
 	if (p_start) {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7c57bd0..1fea1b23 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1724,8 +1724,6 @@ void vmemmap_populate_print_last(void);
 #ifdef CONFIG_MEMORY_HOTPLUG
 void vmemmap_free(struct page *memmap, unsigned long nr_pages);
 #endif
-void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
-				  unsigned long size);
 
 enum mf_flags {
 	MF_COUNT_INCREASED = 1 << 0,
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index be2b90c..1501d25 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -91,7 +91,6 @@ static void release_memory_resource(struct resource *res)
 	return;
 }
 
-#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
 void get_page_bootmem(unsigned long info,  struct page *page,
 		      unsigned long type)
 {
@@ -101,6 +100,7 @@ void get_page_bootmem(unsigned long info,  struct page *page,
 	atomic_inc(&page->_count);
 }
 
+#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
 /* reference to __meminit __free_pages_bootmem is valid
  * so use __ref to tell modpost not to generate a warning */
 void __ref put_page_bootmem(struct page *page)
@@ -128,6 +128,64 @@ void __ref put_page_bootmem(struct page *page)
 
 }
 
+void register_page_bootmem_memmap(unsigned long section_nr,
+				  struct page *start_page, unsigned long size)
+{
+	unsigned long addr = (unsigned long)start_page;
+	unsigned long end = (unsigned long)(start_page + size);
+	unsigned long next;
+	pgd_t *pgd;
+	pud_t *pud;
+	pmd_t *pmd;
+	unsigned int nr_pages;
+	struct page *page;
+
+	for (; addr < end; addr = next) {
+		pte_t *pte = NULL;
+
+		pgd = pgd_offset_k(addr);
+		if (pgd_none(*pgd)) {
+			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			continue;
+		}
+		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
+
+		pud = pud_offset(pgd, addr);
+		if (pud_none(*pud)) {
+			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			continue;
+		}
+		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
+
+		if (!cpu_has_pse) {
+			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			pmd = pmd_offset(pud, addr);
+			if (pmd_none(*pmd))
+				continue;
+			get_page_bootmem(section_nr, pmd_page(*pmd),
+					 MIX_SECTION_INFO);
+
+			pte = pte_offset_kernel(pmd, addr);
+			if (pte_none(*pte))
+				continue;
+			get_page_bootmem(section_nr, pte_page(*pte),
+					 SECTION_INFO);
+		} else {
+			next = pmd_addr_end(addr, end);
+
+			pmd = pmd_offset(pud, addr);
+			if (pmd_none(*pmd))
+				continue;
+
+			nr_pages = 1 << (get_order(PMD_SIZE));
+			page = pmd_page(*pmd);
+			while (nr_pages--)
+				get_page_bootmem(section_nr, page++,
+						 SECTION_INFO);
+		}
+	}
+}
+
 #ifndef CONFIG_SPARSEMEM_VMEMMAP
 static void register_page_bootmem_info_section(unsigned long start_pfn)
 {
-- 
1.7.10.4

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11  9:56 mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix Michal Hocko
@ 2013-01-11 10:17 ` Michal Hocko
  2013-01-11 10:29   ` Michal Hocko
  2013-01-11 10:26 ` Tang Chen
  1 sibling, 1 reply; 12+ messages in thread
From: Michal Hocko @ 2013-01-11 10:17 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Wen Congyang, Yasuaki Ishimatsu, Tang Chen, Wu Jianguo,
	KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki, Lai Jiangshan,
	Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-mm, LKML

On Fri 11-01-13 10:56:58, Michal Hocko wrote:
[...]
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index be2b90c..1501d25 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -91,7 +91,6 @@ static void release_memory_resource(struct resource *res)
>  	return;
>  }
>  
> -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
>  void get_page_bootmem(unsigned long info,  struct page *page,
>  		      unsigned long type)
>  {
> @@ -101,6 +100,7 @@ void get_page_bootmem(unsigned long info,  struct page *page,
>  	atomic_inc(&page->_count);
>  }
>  
> +#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
>  /* reference to __meminit __free_pages_bootmem is valid
>   * so use __ref to tell modpost not to generate a warning */
>  void __ref put_page_bootmem(struct page *page)

Ups this slipped through and it is unnecessary.
---
Defconfig for x86_64 complains
arch/x86/mm/init_64.c: In function a??register_page_bootmem_memmapa??:
arch/x86/mm/init_64.c:1340: error: implicit declaration of function a??get_page_bootmema??
arch/x86/mm/init_64.c:1340: error: a??MIX_SECTION_INFOa?? undeclared (first
use in this function)
arch/x86/mm/init_64.c:1340: error: (Each undeclared identifier is
reported only once
arch/x86/mm/init_64.c:1340: error: for each function it appears in.)
arch/x86/mm/init_64.c:1361: error: a??SECTION_INFOa?? undeclared (first use in this function)

move register_page_bootmem_memmap to memory_hotplug where it is used and
where it has all required symbols

Signed-off-by: Michal Hocko <mhocko@suse.cz>
---
 arch/x86/mm/init_64.c |   58 -------------------------------------------------
 include/linux/mm.h    |    2 --
 mm/memory_hotplug.c   |   58 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 60 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index ddd3b58..a6a7494 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1317,64 +1317,6 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node)
 	return 0;
 }
 
-void register_page_bootmem_memmap(unsigned long section_nr,
-				  struct page *start_page, unsigned long size)
-{
-	unsigned long addr = (unsigned long)start_page;
-	unsigned long end = (unsigned long)(start_page + size);
-	unsigned long next;
-	pgd_t *pgd;
-	pud_t *pud;
-	pmd_t *pmd;
-	unsigned int nr_pages;
-	struct page *page;
-
-	for (; addr < end; addr = next) {
-		pte_t *pte = NULL;
-
-		pgd = pgd_offset_k(addr);
-		if (pgd_none(*pgd)) {
-			next = (addr + PAGE_SIZE) & PAGE_MASK;
-			continue;
-		}
-		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
-
-		pud = pud_offset(pgd, addr);
-		if (pud_none(*pud)) {
-			next = (addr + PAGE_SIZE) & PAGE_MASK;
-			continue;
-		}
-		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
-
-		if (!cpu_has_pse) {
-			next = (addr + PAGE_SIZE) & PAGE_MASK;
-			pmd = pmd_offset(pud, addr);
-			if (pmd_none(*pmd))
-				continue;
-			get_page_bootmem(section_nr, pmd_page(*pmd),
-					 MIX_SECTION_INFO);
-
-			pte = pte_offset_kernel(pmd, addr);
-			if (pte_none(*pte))
-				continue;
-			get_page_bootmem(section_nr, pte_page(*pte),
-					 SECTION_INFO);
-		} else {
-			next = pmd_addr_end(addr, end);
-
-			pmd = pmd_offset(pud, addr);
-			if (pmd_none(*pmd))
-				continue;
-
-			nr_pages = 1 << (get_order(PMD_SIZE));
-			page = pmd_page(*pmd);
-			while (nr_pages--)
-				get_page_bootmem(section_nr, page++,
-						 SECTION_INFO);
-		}
-	}
-}
-
 void __meminit vmemmap_populate_print_last(void)
 {
 	if (p_start) {
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 7c57bd0..1fea1b23 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1724,8 +1724,6 @@ void vmemmap_populate_print_last(void);
 #ifdef CONFIG_MEMORY_HOTPLUG
 void vmemmap_free(struct page *memmap, unsigned long nr_pages);
 #endif
-void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
-				  unsigned long size);
 
 enum mf_flags {
 	MF_COUNT_INCREASED = 1 << 0,
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index be2b90c..59eddff 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -128,6 +128,64 @@ void __ref put_page_bootmem(struct page *page)
 
 }
 
+void register_page_bootmem_memmap(unsigned long section_nr,
+				  struct page *start_page, unsigned long size)
+{
+	unsigned long addr = (unsigned long)start_page;
+	unsigned long end = (unsigned long)(start_page + size);
+	unsigned long next;
+	pgd_t *pgd;
+	pud_t *pud;
+	pmd_t *pmd;
+	unsigned int nr_pages;
+	struct page *page;
+
+	for (; addr < end; addr = next) {
+		pte_t *pte = NULL;
+
+		pgd = pgd_offset_k(addr);
+		if (pgd_none(*pgd)) {
+			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			continue;
+		}
+		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
+
+		pud = pud_offset(pgd, addr);
+		if (pud_none(*pud)) {
+			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			continue;
+		}
+		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
+
+		if (!cpu_has_pse) {
+			next = (addr + PAGE_SIZE) & PAGE_MASK;
+			pmd = pmd_offset(pud, addr);
+			if (pmd_none(*pmd))
+				continue;
+			get_page_bootmem(section_nr, pmd_page(*pmd),
+					 MIX_SECTION_INFO);
+
+			pte = pte_offset_kernel(pmd, addr);
+			if (pte_none(*pte))
+				continue;
+			get_page_bootmem(section_nr, pte_page(*pte),
+					 SECTION_INFO);
+		} else {
+			next = pmd_addr_end(addr, end);
+
+			pmd = pmd_offset(pud, addr);
+			if (pmd_none(*pmd))
+				continue;
+
+			nr_pages = 1 << (get_order(PMD_SIZE));
+			page = pmd_page(*pmd);
+			while (nr_pages--)
+				get_page_bootmem(section_nr, page++,
+						 SECTION_INFO);
+		}
+	}
+}
+
 #ifndef CONFIG_SPARSEMEM_VMEMMAP
 static void register_page_bootmem_info_section(unsigned long start_pfn)
 {
-- 
1.7.10.4

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11  9:56 mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix Michal Hocko
  2013-01-11 10:17 ` Michal Hocko
@ 2013-01-11 10:26 ` Tang Chen
  1 sibling, 0 replies; 12+ messages in thread
From: Tang Chen @ 2013-01-11 10:26 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Wen Congyang, Yasuaki Ishimatsu, Wu Jianguo,
	KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki, Lai Jiangshan,
	Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-mm, LKML

Hi Michal,

Thank you very much for the nice catch. :)

On 01/11/2013 05:56 PM, Michal Hocko wrote:
> Defconfig for x86_64 complains
> arch/x86/mm/init_64.c: In function ‘register_page_bootmem_memmap’:
> arch/x86/mm/init_64.c:1340: error: implicit declaration of function ‘get_page_bootmem’
> arch/x86/mm/init_64.c:1340: error: ‘MIX_SECTION_INFO’ undeclared (first
> use in this function)
> arch/x86/mm/init_64.c:1340: error: (Each undeclared identifier is
> reported only once
> arch/x86/mm/init_64.c:1340: error: for each function it appears in.)
> arch/x86/mm/init_64.c:1361: error: ‘SECTION_INFO’ undeclared (first use in this function)
>
> move register_page_bootmem_memmap to memory_hotplug where it is used and
> where it has all required symbols
>
> Signed-off-by: Michal Hocko<mhocko@suse.cz>
> ---
>   arch/x86/mm/init_64.c |   58 -----------------------------------------------
>   include/linux/mm.h    |    2 --
>   mm/memory_hotplug.c   |   60 ++++++++++++++++++++++++++++++++++++++++++++++++-
>   3 files changed, 59 insertions(+), 61 deletions(-)
>
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index ddd3b58..a6a7494 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -1317,64 +1317,6 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node)
>   	return 0;
>   }
>
> -void register_page_bootmem_memmap(unsigned long section_nr,
> -				  struct page *start_page, unsigned long size)
> -{
> -	unsigned long addr = (unsigned long)start_page;
> -	unsigned long end = (unsigned long)(start_page + size);
> -	unsigned long next;
> -	pgd_t *pgd;
> -	pud_t *pud;
> -	pmd_t *pmd;
> -	unsigned int nr_pages;
> -	struct page *page;
> -
> -	for (; addr<  end; addr = next) {
> -		pte_t *pte = NULL;
> -
> -		pgd = pgd_offset_k(addr);
> -		if (pgd_none(*pgd)) {
> -			next = (addr + PAGE_SIZE)&  PAGE_MASK;
> -			continue;
> -		}
> -		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
> -
> -		pud = pud_offset(pgd, addr);
> -		if (pud_none(*pud)) {
> -			next = (addr + PAGE_SIZE)&  PAGE_MASK;
> -			continue;
> -		}
> -		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
> -
> -		if (!cpu_has_pse) {
> -			next = (addr + PAGE_SIZE)&  PAGE_MASK;
> -			pmd = pmd_offset(pud, addr);
> -			if (pmd_none(*pmd))
> -				continue;
> -			get_page_bootmem(section_nr, pmd_page(*pmd),
> -					 MIX_SECTION_INFO);
> -
> -			pte = pte_offset_kernel(pmd, addr);
> -			if (pte_none(*pte))
> -				continue;
> -			get_page_bootmem(section_nr, pte_page(*pte),
> -					 SECTION_INFO);
> -		} else {
> -			next = pmd_addr_end(addr, end);
> -
> -			pmd = pmd_offset(pud, addr);
> -			if (pmd_none(*pmd))
> -				continue;
> -
> -			nr_pages = 1<<  (get_order(PMD_SIZE));
> -			page = pmd_page(*pmd);
> -			while (nr_pages--)
> -				get_page_bootmem(section_nr, page++,
> -						 SECTION_INFO);
> -		}
> -	}
> -}
> -
>   void __meminit vmemmap_populate_print_last(void)
>   {
>   	if (p_start) {
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 7c57bd0..1fea1b23 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1724,8 +1724,6 @@ void vmemmap_populate_print_last(void);
>   #ifdef CONFIG_MEMORY_HOTPLUG
>   void vmemmap_free(struct page *memmap, unsigned long nr_pages);
>   #endif
> -void register_page_bootmem_memmap(unsigned long section_nr, struct page *map,
> -				  unsigned long size);
>
>   enum mf_flags {
>   	MF_COUNT_INCREASED = 1<<  0,
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index be2b90c..1501d25 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -91,7 +91,6 @@ static void release_memory_resource(struct resource *res)
>   	return;
>   }
>
> -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
>   void get_page_bootmem(unsigned long info,  struct page *page,
>   		      unsigned long type)
>   {
> @@ -101,6 +100,7 @@ void get_page_bootmem(unsigned long info,  struct page *page,
>   	atomic_inc(&page->_count);
>   }
>
> +#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE
>   /* reference to __meminit __free_pages_bootmem is valid
>    * so use __ref to tell modpost not to generate a warning */
>   void __ref put_page_bootmem(struct page *page)
> @@ -128,6 +128,64 @@ void __ref put_page_bootmem(struct page *page)
>
>   }
>
> +void register_page_bootmem_memmap(unsigned long section_nr,
> +				  struct page *start_page, unsigned long size)
> +{
> +	unsigned long addr = (unsigned long)start_page;
> +	unsigned long end = (unsigned long)(start_page + size);
> +	unsigned long next;
> +	pgd_t *pgd;
> +	pud_t *pud;
> +	pmd_t *pmd;
> +	unsigned int nr_pages;
> +	struct page *page;
> +
> +	for (; addr<  end; addr = next) {
> +		pte_t *pte = NULL;
> +
> +		pgd = pgd_offset_k(addr);
> +		if (pgd_none(*pgd)) {
> +			next = (addr + PAGE_SIZE)&  PAGE_MASK;
> +			continue;
> +		}
> +		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
> +
> +		pud = pud_offset(pgd, addr);
> +		if (pud_none(*pud)) {
> +			next = (addr + PAGE_SIZE)&  PAGE_MASK;
> +			continue;
> +		}
> +		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
> +
> +		if (!cpu_has_pse) {
> +			next = (addr + PAGE_SIZE)&  PAGE_MASK;
> +			pmd = pmd_offset(pud, addr);
> +			if (pmd_none(*pmd))
> +				continue;
> +			get_page_bootmem(section_nr, pmd_page(*pmd),
> +					 MIX_SECTION_INFO);
> +
> +			pte = pte_offset_kernel(pmd, addr);
> +			if (pte_none(*pte))
> +				continue;
> +			get_page_bootmem(section_nr, pte_page(*pte),
> +					 SECTION_INFO);
> +		} else {
> +			next = pmd_addr_end(addr, end);
> +
> +			pmd = pmd_offset(pud, addr);
> +			if (pmd_none(*pmd))
> +				continue;
> +
> +			nr_pages = 1<<  (get_order(PMD_SIZE));
> +			page = pmd_page(*pmd);
> +			while (nr_pages--)
> +				get_page_bootmem(section_nr, page++,
> +						 SECTION_INFO);
> +		}
> +	}
> +}
> +
>   #ifndef CONFIG_SPARSEMEM_VMEMMAP
>   static void register_page_bootmem_info_section(unsigned long start_pfn)
>   {


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11 10:17 ` Michal Hocko
@ 2013-01-11 10:29   ` Michal Hocko
  2013-01-11 10:47     ` Michal Hocko
  0 siblings, 1 reply; 12+ messages in thread
From: Michal Hocko @ 2013-01-11 10:29 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Wen Congyang, Yasuaki Ishimatsu, Tang Chen, Wu Jianguo,
	KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki, Lai Jiangshan,
	Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-mm, LKML

On Fri 11-01-13 11:17:45, Michal Hocko wrote:
[...]
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index be2b90c..59eddff 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -128,6 +128,64 @@ void __ref put_page_bootmem(struct page *page)
>  
>  }
>  
> +void register_page_bootmem_memmap(unsigned long section_nr,
> +				  struct page *start_page, unsigned long size)
> +{
> +	unsigned long addr = (unsigned long)start_page;
> +	unsigned long end = (unsigned long)(start_page + size);
> +	unsigned long next;
> +	pgd_t *pgd;
> +	pud_t *pud;
> +	pmd_t *pmd;
> +	unsigned int nr_pages;
> +	struct page *page;
> +
> +	for (; addr < end; addr = next) {
> +		pte_t *pte = NULL;
> +
> +		pgd = pgd_offset_k(addr);
> +		if (pgd_none(*pgd)) {
> +			next = (addr + PAGE_SIZE) & PAGE_MASK;
> +			continue;
> +		}
> +		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
> +
> +		pud = pud_offset(pgd, addr);
> +		if (pud_none(*pud)) {
> +			next = (addr + PAGE_SIZE) & PAGE_MASK;
> +			continue;
> +		}
> +		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
> +
> +		if (!cpu_has_pse) {

Darn! And now that I am looking at the patch closer it is too x86
centric so this cannot be in the generic code. I will try to cook
something better. Sorry about the noise.
[...]
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11 10:29   ` Michal Hocko
@ 2013-01-11 10:47     ` Michal Hocko
  2013-01-11 11:08       ` Lin Feng
                         ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Michal Hocko @ 2013-01-11 10:47 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Wen Congyang, Yasuaki Ishimatsu, Tang Chen, Wu Jianguo,
	KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki, Lai Jiangshan,
	Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-mm, LKML

On Fri 11-01-13 11:29:24, Michal Hocko wrote:
> On Fri 11-01-13 11:17:45, Michal Hocko wrote:
> [...]
> > diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> > index be2b90c..59eddff 100644
> > --- a/mm/memory_hotplug.c
> > +++ b/mm/memory_hotplug.c
> > @@ -128,6 +128,64 @@ void __ref put_page_bootmem(struct page *page)
> >  
> >  }
> >  
> > +void register_page_bootmem_memmap(unsigned long section_nr,
> > +				  struct page *start_page, unsigned long size)
> > +{
> > +	unsigned long addr = (unsigned long)start_page;
> > +	unsigned long end = (unsigned long)(start_page + size);
> > +	unsigned long next;
> > +	pgd_t *pgd;
> > +	pud_t *pud;
> > +	pmd_t *pmd;
> > +	unsigned int nr_pages;
> > +	struct page *page;
> > +
> > +	for (; addr < end; addr = next) {
> > +		pte_t *pte = NULL;
> > +
> > +		pgd = pgd_offset_k(addr);
> > +		if (pgd_none(*pgd)) {
> > +			next = (addr + PAGE_SIZE) & PAGE_MASK;
> > +			continue;
> > +		}
> > +		get_page_bootmem(section_nr, pgd_page(*pgd), MIX_SECTION_INFO);
> > +
> > +		pud = pud_offset(pgd, addr);
> > +		if (pud_none(*pud)) {
> > +			next = (addr + PAGE_SIZE) & PAGE_MASK;
> > +			continue;
> > +		}
> > +		get_page_bootmem(section_nr, pud_page(*pud), MIX_SECTION_INFO);
> > +
> > +		if (!cpu_has_pse) {
> 
> Darn! And now that I am looking at the patch closer it is too x86
> centric so this cannot be in the generic code. I will try to cook
> something better. Sorry about the noise.

It is more complicated than I thought. One would tell it's a mess.
The patch bellow fixes the compilation issue but I am not sure we want
to include memory_hotplug.h into arch/x86/mm/init_64.c. Moreover

+void register_page_bootmem_memmap(unsigned long section_nr,
+				  struct page *start_page, unsigned long size)
+{
+	/* TODO */
+}

for other archs would suggest that the code is not ready yet. Should
this rather be dropped for now?
---

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11 10:47     ` Michal Hocko
@ 2013-01-11 11:08       ` Lin Feng
  2013-01-11 11:55         ` Michal Hocko
  2013-01-11 12:06       ` Tang Chen
  2013-01-11 12:06       ` Lin Feng
  2 siblings, 1 reply; 12+ messages in thread
From: Lin Feng @ 2013-01-11 11:08 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Wen Congyang, Yasuaki Ishimatsu, Tang Chen,
	Wu Jianguo, KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki,
	Lai Jiangshan, Ingo Molnar, Thomas Gleixner, H. Peter Anvin,
	linux-mm, LKML

Hi Michal,

On 01/11/2013 06:47 PM, Michal Hocko wrote:
> Signed-off-by: Michal Hocko <mhocko@suse.cz>
> ---
>  arch/x86/mm/init_64.c |    3 +++
>  include/linux/mm.h    |    2 ++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index ddd3b58..d8edf52 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -32,6 +32,7 @@
>  #include <linux/memory_hotplug.h>
linux/memory_hotplug.h has already been included here.

I think it's OK to add add the missing CONFIG option or move
the memory-hotlug related complaint code into the CONFIG span. 

thanks,
linfeng
>  #include <linux/nmi.h>
>  #include <linux/gfp.h>
> +#include <linux/memory_hotplug.h>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11 11:08       ` Lin Feng
@ 2013-01-11 11:55         ` Michal Hocko
  0 siblings, 0 replies; 12+ messages in thread
From: Michal Hocko @ 2013-01-11 11:55 UTC (permalink / raw)
  To: Lin Feng
  Cc: Andrew Morton, Wen Congyang, Yasuaki Ishimatsu, Tang Chen,
	Wu Jianguo, KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki,
	Lai Jiangshan, Ingo Molnar, Thomas Gleixner, H. Peter Anvin,
	linux-mm, LKML

On Fri 11-01-13 19:08:59, Lin Feng wrote:
> Hi Michal,
> 
> On 01/11/2013 06:47 PM, Michal Hocko wrote:
> > Signed-off-by: Michal Hocko <mhocko@suse.cz>
> > ---
> >  arch/x86/mm/init_64.c |    3 +++
> >  include/linux/mm.h    |    2 ++
> >  2 files changed, 5 insertions(+)
> > 
> > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> > index ddd3b58..d8edf52 100644
> > --- a/arch/x86/mm/init_64.c
> > +++ b/arch/x86/mm/init_64.c
> > @@ -32,6 +32,7 @@
> >  #include <linux/memory_hotplug.h>
> linux/memory_hotplug.h has already been included here.

Ohh, I have missed that.
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11 10:47     ` Michal Hocko
  2013-01-11 11:08       ` Lin Feng
@ 2013-01-11 12:06       ` Tang Chen
  2013-01-11 12:12         ` Michal Hocko
  2013-01-11 12:06       ` Lin Feng
  2 siblings, 1 reply; 12+ messages in thread
From: Tang Chen @ 2013-01-11 12:06 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Wen Congyang, Yasuaki Ishimatsu, Wu Jianguo,
	KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki, Lai Jiangshan,
	Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-mm, LKML

On 01/11/2013 06:47 PM, Michal Hocko wrote:
>>
>> Darn! And now that I am looking at the patch closer it is too x86
>> centric so this cannot be in the generic code. I will try to cook
>> something better. Sorry about the noise.
>
> It is more complicated than I thought. One would tell it's a mess.
> The patch bellow fixes the compilation issue but I am not sure we want
> to include memory_hotplug.h into arch/x86/mm/init_64.c. Moreover
>
> +void register_page_bootmem_memmap(unsigned long section_nr,
> +				  struct page *start_page, unsigned long size)
> +{
> +	/* TODO */
> +}
>
> for other archs would suggest that the code is not ready yet. Should
> this rather be dropped for now?

Hi Michal,

Do you mean remove register_page_bootmem_memmap() from other
architectures ?  Well, I think this function is called by
register_page_bootmem_info_section(), which is a common function
in mm/memory_hotplug.c shared by all architectures. So I don't think
we should remove it. :)

Thanks. :)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11 10:47     ` Michal Hocko
  2013-01-11 11:08       ` Lin Feng
  2013-01-11 12:06       ` Tang Chen
@ 2013-01-11 12:06       ` Lin Feng
  2 siblings, 0 replies; 12+ messages in thread
From: Lin Feng @ 2013-01-11 12:06 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Wen Congyang, Yasuaki Ishimatsu, Tang Chen,
	Wu Jianguo, KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki,
	Lai Jiangshan, Ingo Molnar, Thomas Gleixner, H. Peter Anvin,
	linux-mm, LKML



On 01/11/2013 06:47 PM, Michal Hocko wrote:
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index ddd3b58..d8edf52 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -32,6 +32,7 @@
>  #include <linux/memory_hotplug.h>
>  #include <linux/nmi.h>
>  #include <linux/gfp.h>
> +#include <linux/memory_hotplug.h>
except for this,

Tested-by: Lin Feng <linfeng@cn.fujitsu.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11 12:06       ` Tang Chen
@ 2013-01-11 12:12         ` Michal Hocko
  2013-01-11 12:38           ` Tang Chen
  0 siblings, 1 reply; 12+ messages in thread
From: Michal Hocko @ 2013-01-11 12:12 UTC (permalink / raw)
  To: Tang Chen
  Cc: Andrew Morton, Wen Congyang, Yasuaki Ishimatsu, Wu Jianguo,
	KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki, Lai Jiangshan,
	Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-mm, LKML

On Fri 11-01-13 20:06:25, Tang Chen wrote:
> On 01/11/2013 06:47 PM, Michal Hocko wrote:
> >>
> >>Darn! And now that I am looking at the patch closer it is too x86
> >>centric so this cannot be in the generic code. I will try to cook
> >>something better. Sorry about the noise.
> >
> >It is more complicated than I thought. One would tell it's a mess.
> >The patch bellow fixes the compilation issue but I am not sure we want
> >to include memory_hotplug.h into arch/x86/mm/init_64.c. Moreover
> >
> >+void register_page_bootmem_memmap(unsigned long section_nr,
> >+				  struct page *start_page, unsigned long size)
> >+{
> >+	/* TODO */
> >+}
> >
> >for other archs would suggest that the code is not ready yet. Should
> >this rather be dropped for now?
> 
> Hi Michal,
> 
> Do you mean remove register_page_bootmem_memmap() from other
> architectures ?

No I meant the patch to be dropped until it gets implementation for
other architectures or the users of the function would be explicit about
archs which are supported. What happens if the implementation is empty
will the generic code work properly? From my very limitted understanding
of the code it won't.

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11 12:12         ` Michal Hocko
@ 2013-01-11 12:38           ` Tang Chen
  2013-01-11 15:38             ` Michal Hocko
  0 siblings, 1 reply; 12+ messages in thread
From: Tang Chen @ 2013-01-11 12:38 UTC (permalink / raw)
  To: Michal Hocko
  Cc: Andrew Morton, Wen Congyang, Yasuaki Ishimatsu, Wu Jianguo,
	KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki, Lai Jiangshan,
	Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-mm, LKML

On 01/11/2013 08:12 PM, Michal Hocko wrote:
> On Fri 11-01-13 20:06:25, Tang Chen wrote:
>> On 01/11/2013 06:47 PM, Michal Hocko wrote:
>>>>
>>>> Darn! And now that I am looking at the patch closer it is too x86
>>>> centric so this cannot be in the generic code. I will try to cook
>>>> something better. Sorry about the noise.
>>>
>>> It is more complicated than I thought. One would tell it's a mess.
>>> The patch bellow fixes the compilation issue but I am not sure we want
>>> to include memory_hotplug.h into arch/x86/mm/init_64.c. Moreover
>>>
>>> +void register_page_bootmem_memmap(unsigned long section_nr,
>>> +				  struct page *start_page, unsigned long size)
>>> +{
>>> +	/* TODO */
>>> +}
>>>
>>> for other archs would suggest that the code is not ready yet. Should
>>> this rather be dropped for now?
>>
>> Hi Michal,
>>
>> Do you mean remove register_page_bootmem_memmap() from other
>> architectures ?
>
> No I meant the patch to be dropped until it gets implementation for
> other architectures or the users of the function would be explicit about
> archs which are supported. What happens if the implementation is empty
> will the generic code work properly? From my very limitted understanding
> of the code it won't.

Hi Michal,

Hum, I see. Thank you for your remind. :)
register_page_bootmem_info_section() will be different in other
architectures if register_page_bootmem_memmap() is empty.

I think we can post a patch to make register_page_bootmem_info_section()
the same as before, and we just implement the x86 version first. So that
it will have no harm to other architectures.

How do you think ?

Thanks. :)

>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix
  2013-01-11 12:38           ` Tang Chen
@ 2013-01-11 15:38             ` Michal Hocko
  0 siblings, 0 replies; 12+ messages in thread
From: Michal Hocko @ 2013-01-11 15:38 UTC (permalink / raw)
  To: Tang Chen
  Cc: Andrew Morton, Wen Congyang, Yasuaki Ishimatsu, Wu Jianguo,
	KOSAKI Motohiro, Jiang Liu, Kamezawa Hiroyuki, Lai Jiangshan,
	Ingo Molnar, Thomas Gleixner, H. Peter Anvin, linux-mm, LKML

On Fri 11-01-13 20:38:33, Tang Chen wrote:
> On 01/11/2013 08:12 PM, Michal Hocko wrote:
> >On Fri 11-01-13 20:06:25, Tang Chen wrote:
> >>On 01/11/2013 06:47 PM, Michal Hocko wrote:
> >>>>
> >>>>Darn! And now that I am looking at the patch closer it is too x86
> >>>>centric so this cannot be in the generic code. I will try to cook
> >>>>something better. Sorry about the noise.
> >>>
> >>>It is more complicated than I thought. One would tell it's a mess.
> >>>The patch bellow fixes the compilation issue but I am not sure we want
> >>>to include memory_hotplug.h into arch/x86/mm/init_64.c. Moreover
> >>>
> >>>+void register_page_bootmem_memmap(unsigned long section_nr,
> >>>+				  struct page *start_page, unsigned long size)
> >>>+{
> >>>+	/* TODO */
> >>>+}
> >>>
> >>>for other archs would suggest that the code is not ready yet. Should
> >>>this rather be dropped for now?
> >>
> >>Hi Michal,
> >>
> >>Do you mean remove register_page_bootmem_memmap() from other
> >>architectures ?
> >
> >No I meant the patch to be dropped until it gets implementation for
> >other architectures or the users of the function would be explicit about
> >archs which are supported. What happens if the implementation is empty
> >will the generic code work properly? From my very limitted understanding
> >of the code it won't.
> 
> Hi Michal,
> 
> Hum, I see. Thank you for your remind. :)
> register_page_bootmem_info_section() will be different in other
> architectures if register_page_bootmem_memmap() is empty.

Not sure I understand what "different" means here but I suspect it would
be buggy. Is that correct?

> I think we can post a patch to make register_page_bootmem_info_section()
> the same as before, and we just implement the x86 version first. So that
> it will have no harm to other architectures.

I haven't followed the previous versions of the patch - I have noticed
this being broken only because it failed during my automatic build
testing when merging new mmots tree into mm git tree. I have no
objections for further patches of course but this one seems to be buggy
so it should be dropped until a fixed version is available.

> How do you think ?
> 
> Thanks. :)
> 
> >
> 

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2013-01-11 15:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-11  9:56 mmots: memory-hotplug: implement register_page_bootmem_info_section of sparse-vmemmap fix Michal Hocko
2013-01-11 10:17 ` Michal Hocko
2013-01-11 10:29   ` Michal Hocko
2013-01-11 10:47     ` Michal Hocko
2013-01-11 11:08       ` Lin Feng
2013-01-11 11:55         ` Michal Hocko
2013-01-11 12:06       ` Tang Chen
2013-01-11 12:12         ` Michal Hocko
2013-01-11 12:38           ` Tang Chen
2013-01-11 15:38             ` Michal Hocko
2013-01-11 12:06       ` Lin Feng
2013-01-11 10:26 ` Tang Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox