2013-04-15 09:44:04

by Tang Chen

[permalink] [raw]
Subject: [PATCH 0/3] Little error fix and cleanup.

This patch-set did the following things:

patch1: Remove unused parameter "nr_pages" of pages_correctly_reserved().
patch2: Use CONFIG_MEMORY_HOTREMOVE to protect kernel_physical_mapping_remove().
patch3: Add comments for parameter "nid" for memblock_insert_region().

Tang Chen (3):
mm: Remove unused parameter of pages_correctly_reserved().
mem-hotplug: Put kernel_physical_mapping_remove() declaration in
CONFIG_MEMORY_HOTREMOVE.
memblock: Fix missing comment of memblock_insert_region().

arch/x86/mm/init_64.c | 2 +-
drivers/base/memory.c | 5 ++---
mm/memblock.c | 9 +++++----
3 files changed, 8 insertions(+), 8 deletions(-)


2013-04-15 09:44:15

by Tang Chen

[permalink] [raw]
Subject: [PATCH 1/3] mm: Remove unused parameter of pages_correctly_reserved()

nr_pages is not used in pages_correctly_reserved().
So remove it.

Signed-off-by: Tang Chen <[email protected]>
Reviewed-by: Wang Shilong <[email protected]>
Reviewed-by: Wen Congyang <[email protected]>
---
drivers/base/memory.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index a51007b..f926b9c 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -217,8 +217,7 @@ int memory_isolate_notify(unsigned long val, void *v)
* The probe routines leave the pages reserved, just as the bootmem code does.
* Make sure they're still that way.
*/
-static bool pages_correctly_reserved(unsigned long start_pfn,
- unsigned long nr_pages)
+static bool pages_correctly_reserved(unsigned long start_pfn)
{
int i, j;
struct page *page;
@@ -266,7 +265,7 @@ memory_block_action(unsigned long phys_index, unsigned long action, int online_t

switch (action) {
case MEM_ONLINE:
- if (!pages_correctly_reserved(start_pfn, nr_pages))
+ if (!pages_correctly_reserved(start_pfn))
return -EBUSY;

ret = online_pages(start_pfn, nr_pages, online_type);
--
1.7.1

2013-04-15 09:44:24

by Tang Chen

[permalink] [raw]
Subject: [PATCH 2/3] mem-hotplug: Put kernel_physical_mapping_remove() declaration in CONFIG_MEMORY_HOTREMOVE.

kernel_physical_mapping_remove() is only called by arch_remove_memory() in
init_64.c, which is enclosed in CONFIG_MEMORY_HOTREMOVE. So when we don't
configure CONFIG_MEMORY_HOTREMOVE, the compiler will give a warning:

warning: ‘kernel_physical_mapping_remove’ defined but not used

So put kernel_physical_mapping_remove() in CONFIG_MEMORY_HOTREMOVE.

Signed-off-by: Tang Chen <[email protected]>
---
arch/x86/mm/init_64.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 474e28f..dafdeb2 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1019,6 +1019,7 @@ void __ref vmemmap_free(struct page *memmap, unsigned long nr_pages)
remove_pagetable(start, end, false);
}

+#ifdef CONFIG_MEMORY_HOTREMOVE
static void __meminit
kernel_physical_mapping_remove(unsigned long start, unsigned long end)
{
@@ -1028,7 +1029,6 @@ kernel_physical_mapping_remove(unsigned long start, unsigned long end)
remove_pagetable(start, end, true);
}

-#ifdef CONFIG_MEMORY_HOTREMOVE
int __ref arch_remove_memory(u64 start, u64 size)
{
unsigned long start_pfn = start >> PAGE_SHIFT;
--
1.7.1

2013-04-15 09:44:22

by Tang Chen

[permalink] [raw]
Subject: [PATCH 3/3] memblock: Fix missing comment of memblock_insert_region().

There is no comment for parameter nid of memblock_insert_region().
This patch adds comment for it.

Signed-off-by: Tang Chen <[email protected]>
---
mm/memblock.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index b8d9147..16eda3d 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -322,10 +322,11 @@ static void __init_memblock memblock_merge_regions(struct memblock_type *type)

/**
* memblock_insert_region - insert new memblock region
- * @type: memblock type to insert into
- * @idx: index for the insertion point
- * @base: base address of the new region
- * @size: size of the new region
+ * @type: memblock type to insert into
+ * @idx: index for the insertion point
+ * @base: base address of the new region
+ * @size: size of the new region
+ * @nid: node id of the new region
*
* Insert new memblock region [@base,@base+@size) into @type at @idx.
* @type must already have extra room to accomodate the new region.
--
1.7.1

Subject: [tip:x86/mm] x86/mm/hotplug: Put kernel_physical_mapping_remove() declaration in CONFIG_MEMORY_HOTREMOVE

Commit-ID: 587ff8c4eab1587044e69156f997e9d1d3b07709
Gitweb: http://git.kernel.org/tip/587ff8c4eab1587044e69156f997e9d1d3b07709
Author: Tang Chen <[email protected]>
AuthorDate: Mon, 15 Apr 2013 17:46:46 +0800
Committer: Ingo Molnar <[email protected]>
CommitDate: Mon, 15 Apr 2013 12:03:24 +0200

x86/mm/hotplug: Put kernel_physical_mapping_remove() declaration in CONFIG_MEMORY_HOTREMOVE

kernel_physical_mapping_remove() is only called by
arch_remove_memory() in init_64.c, which is enclosed in
CONFIG_MEMORY_HOTREMOVE. So when we don't configure
CONFIG_MEMORY_HOTREMOVE, the compiler will give a warning:

warning: ‘kernel_physical_mapping_remove’ defined but not used

So put kernel_physical_mapping_remove() in
CONFIG_MEMORY_HOTREMOVE.

Signed-off-by: Tang Chen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/mm/init_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 474e28f..dafdeb2 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1019,6 +1019,7 @@ void __ref vmemmap_free(struct page *memmap, unsigned long nr_pages)
remove_pagetable(start, end, false);
}

+#ifdef CONFIG_MEMORY_HOTREMOVE
static void __meminit
kernel_physical_mapping_remove(unsigned long start, unsigned long end)
{
@@ -1028,7 +1029,6 @@ kernel_physical_mapping_remove(unsigned long start, unsigned long end)
remove_pagetable(start, end, true);
}

-#ifdef CONFIG_MEMORY_HOTREMOVE
int __ref arch_remove_memory(u64 start, u64 size)
{
unsigned long start_pfn = start >> PAGE_SHIFT;

2013-04-15 16:31:06

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/3] mm: Remove unused parameter of pages_correctly_reserved()

On Mon, Apr 15, 2013 at 05:46:45PM +0800, Tang Chen wrote:
> nr_pages is not used in pages_correctly_reserved().
> So remove it.
>
> Signed-off-by: Tang Chen <[email protected]>
> Reviewed-by: Wang Shilong <[email protected]>
> Reviewed-by: Wen Congyang <[email protected]>

Acked-by: Greg Kroah-Hartman <[email protected]>

2013-04-16 21:16:13

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 2/3] mem-hotplug: Put kernel_physical_mapping_remove() declaration in CONFIG_MEMORY_HOTREMOVE.

On Mon, 15 Apr 2013 17:46:46 +0800 Tang Chen <[email protected]> wrote:

> kernel_physical_mapping_remove() is only called by arch_remove_memory() in
> init_64.c, which is enclosed in CONFIG_MEMORY_HOTREMOVE. So when we don't
> configure CONFIG_MEMORY_HOTREMOVE, the compiler will give a warning:
>
> warning: ___kernel_physical_mapping_remove___ defined but not used
>
> So put kernel_physical_mapping_remove() in CONFIG_MEMORY_HOTREMOVE.
>
> Signed-off-by: Tang Chen <[email protected]>
> ---
> arch/x86/mm/init_64.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index 474e28f..dafdeb2 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -1019,6 +1019,7 @@ void __ref vmemmap_free(struct page *memmap, unsigned long nr_pages)
> remove_pagetable(start, end, false);
> }
>
> +#ifdef CONFIG_MEMORY_HOTREMOVE
> static void __meminit
> kernel_physical_mapping_remove(unsigned long start, unsigned long end)
> {
> @@ -1028,7 +1029,6 @@ kernel_physical_mapping_remove(unsigned long start, unsigned long end)
> remove_pagetable(start, end, true);
> }
>
> -#ifdef CONFIG_MEMORY_HOTREMOVE
> int __ref arch_remove_memory(u64 start, u64 size)
> {
> unsigned long start_pfn = start >> PAGE_SHIFT;

Thanks. I already have this one queued in
http://ozlabs.org/~akpm/mmots/broken-out/arch-x86-mm-init_64c-fix-build-warning-when-config_memory_hotremove=n.patch,
within my "send it to the x86 maintainers" section.