Re: [PATCH] memory hotplug: avoid double registration on ia64 platform

2012-08-17 Thread Greg KH
On Fri, Aug 17, 2012 at 03:52:47PM +0800, qiuxishi wrote:
> From: Xishi Qiu 
> 
> Hi all,
> There may be have a bug when register section info. For example, on
> an Itanium platform, the pfn range of node0 includes the other nodes.
> So when hot remove memory, we can't free the memmap's page because
> page_count() is 2 after put_page_bootmem().
> 
> sparse_remove_one_section()->free_section_usemap()->free_map_bootmem()
> ->put_page_bootmem()
> 
> pgdat0: start_pfn=0x100,spanned_pfn=0x20fb00, present_pfn=0x7f8a3, => 
> 0x100-0x20fc00
> pgdat1: start_pfn=0x8,  spanned_pfn=0x8,  present_pfn=0x8, => 
> 0x8-0x10
> pgdat2: start_pfn=0x10, spanned_pfn=0x8,  present_pfn=0x8, => 
> 0x10-0x18
> pgdat3: start_pfn=0x18, spanned_pfn=0x8,  present_pfn=0x8, => 
> 0x18-0x20
> 
> 
> Signed-off-by: Xishi Qiu 
> ---
>  mm/memory_hotplug.c |   10 --
>  1 files changed, 4 insertions(+), 6 deletions(-)



This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] memory hotplug: avoid double registration on ia64 platform

2012-08-17 Thread qiuxishi
From: Xishi Qiu 

Hi all,
There may be have a bug when register section info. For example, on
an Itanium platform, the pfn range of node0 includes the other nodes.
So when hot remove memory, we can't free the memmap's page because
page_count() is 2 after put_page_bootmem().

sparse_remove_one_section()->free_section_usemap()->free_map_bootmem()
->put_page_bootmem()

pgdat0: start_pfn=0x100,spanned_pfn=0x20fb00, present_pfn=0x7f8a3, => 
0x100-0x20fc00
pgdat1: start_pfn=0x8,  spanned_pfn=0x8,  present_pfn=0x8, => 
0x8-0x10
pgdat2: start_pfn=0x10, spanned_pfn=0x8,  present_pfn=0x8, => 
0x10-0x18
pgdat3: start_pfn=0x18, spanned_pfn=0x8,  present_pfn=0x8, => 
0x18-0x20


Signed-off-by: Xishi Qiu 
---
 mm/memory_hotplug.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 2adbcac..cf493c7 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -126,9 +126,6 @@ static void register_page_bootmem_info_section(unsigned 
long start_pfn)
struct mem_section *ms;
struct page *page, *memmap;

-   if (!pfn_valid(start_pfn))
-   return;
-
section_nr = pfn_to_section_nr(start_pfn);
ms = __nr_to_section(section_nr);

@@ -187,9 +184,10 @@ void register_page_bootmem_info_node(struct pglist_data 
*pgdat)
end_pfn = pfn + pgdat->node_spanned_pages;

/* register_section info */
-   for (; pfn < end_pfn; pfn += PAGES_PER_SECTION)
-   register_page_bootmem_info_section(pfn);
-
+   for (; pfn < end_pfn; pfn += PAGES_PER_SECTION) {
+   if (pfn_valid(pfn) && (pfn_to_nid(pfn) == node))
+   register_page_bootmem_info_section(pfn);
+   }
 }
 #endif /* !CONFIG_SPARSEMEM_VMEMMAP */

-- 1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] memory hotplug: avoid double registration on ia64 platform

2012-08-17 Thread qiuxishi
From: Xishi Qiu qiuxi...@huawei.com

Hi all,
There may be have a bug when register section info. For example, on
an Itanium platform, the pfn range of node0 includes the other nodes.
So when hot remove memory, we can't free the memmap's page because
page_count() is 2 after put_page_bootmem().

sparse_remove_one_section()-free_section_usemap()-free_map_bootmem()
-put_page_bootmem()

pgdat0: start_pfn=0x100,spanned_pfn=0x20fb00, present_pfn=0x7f8a3, = 
0x100-0x20fc00
pgdat1: start_pfn=0x8,  spanned_pfn=0x8,  present_pfn=0x8, = 
0x8-0x10
pgdat2: start_pfn=0x10, spanned_pfn=0x8,  present_pfn=0x8, = 
0x10-0x18
pgdat3: start_pfn=0x18, spanned_pfn=0x8,  present_pfn=0x8, = 
0x18-0x20


Signed-off-by: Xishi Qiu qiuxi...@huawei.com
---
 mm/memory_hotplug.c |   10 --
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 2adbcac..cf493c7 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -126,9 +126,6 @@ static void register_page_bootmem_info_section(unsigned 
long start_pfn)
struct mem_section *ms;
struct page *page, *memmap;

-   if (!pfn_valid(start_pfn))
-   return;
-
section_nr = pfn_to_section_nr(start_pfn);
ms = __nr_to_section(section_nr);

@@ -187,9 +184,10 @@ void register_page_bootmem_info_node(struct pglist_data 
*pgdat)
end_pfn = pfn + pgdat-node_spanned_pages;

/* register_section info */
-   for (; pfn  end_pfn; pfn += PAGES_PER_SECTION)
-   register_page_bootmem_info_section(pfn);
-
+   for (; pfn  end_pfn; pfn += PAGES_PER_SECTION) {
+   if (pfn_valid(pfn)  (pfn_to_nid(pfn) == node))
+   register_page_bootmem_info_section(pfn);
+   }
 }
 #endif /* !CONFIG_SPARSEMEM_VMEMMAP */

-- 1.7.1
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] memory hotplug: avoid double registration on ia64 platform

2012-08-17 Thread Greg KH
On Fri, Aug 17, 2012 at 03:52:47PM +0800, qiuxishi wrote:
 From: Xishi Qiu qiuxi...@huawei.com
 
 Hi all,
 There may be have a bug when register section info. For example, on
 an Itanium platform, the pfn range of node0 includes the other nodes.
 So when hot remove memory, we can't free the memmap's page because
 page_count() is 2 after put_page_bootmem().
 
 sparse_remove_one_section()-free_section_usemap()-free_map_bootmem()
 -put_page_bootmem()
 
 pgdat0: start_pfn=0x100,spanned_pfn=0x20fb00, present_pfn=0x7f8a3, = 
 0x100-0x20fc00
 pgdat1: start_pfn=0x8,  spanned_pfn=0x8,  present_pfn=0x8, = 
 0x8-0x10
 pgdat2: start_pfn=0x10, spanned_pfn=0x8,  present_pfn=0x8, = 
 0x10-0x18
 pgdat3: start_pfn=0x18, spanned_pfn=0x8,  present_pfn=0x8, = 
 0x18-0x20
 
 
 Signed-off-by: Xishi Qiu qiuxi...@huawei.com
 ---
  mm/memory_hotplug.c |   10 --
  1 files changed, 4 insertions(+), 6 deletions(-)

formletter

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

/formletter
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/