2013-09-03 03:00:35

by Wanpeng Li

[permalink] [raw]
Subject: [PATCH v2 1/3] mm/vmalloc: don't set area->caller twice

Changelog:
* rebase against mmotm tree

The caller address has already been set in set_vmalloc_vm(), there's no need
to set it again in __vmalloc_area_node.

Signed-off-by: Wanpeng Li <[email protected]>
---
mm/vmalloc.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 1074543..d78d117 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1566,7 +1566,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
pages = kmalloc_node(array_size, nested_gfp, node);
}
area->pages = pages;
- area->caller = caller;
if (!area->pages) {
remove_vm_area(area->addr);
kfree(area);
--
1.7.5.4


2013-09-03 03:00:39

by Wanpeng Li

[permalink] [raw]
Subject: [PATCH v2 2/3] mm/vmalloc: don't warning vmalloc allocation failure twice

Don't warning twice in __vmalloc_area_node and __vmalloc_node_range if
__vmalloc_area_node allocation failure.

Signed-off-by: Wanpeng Li <[email protected]>
---
mm/vmalloc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index d78d117..e3ec8b4 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1635,7 +1635,7 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,

addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);
if (!addr)
- goto fail;
+ return NULL;

/*
* In this function, newly allocated vm_struct has VM_UNINITIALIZED
--
1.7.5.4

2013-09-03 03:00:44

by Wanpeng Li

[permalink] [raw]
Subject: [PATCH v2 3/3] mm/vmalloc: move VM_UNINITIALIZED just before show_numa_info

The VM_UNINITIALIZED/VM_UNLIST flag introduced by commit f5252e00(mm: avoid
null pointer access in vm_struct via /proc/vmallocinfo) is used to avoid
accessing the pages field with unallocated page when show_numa_info() is
called. This patch move the check just before show_numa_info in order that
some messages still can be dumped via /proc/vmallocinfo.

Signed-off-by: Wanpeng Li <[email protected]>
---
mm/vmalloc.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index e3ec8b4..c4720cd 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -2590,11 +2590,6 @@ static int s_show(struct seq_file *m, void *p)

v = va->vm;

- /* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
- smp_rmb();
- if (v->flags & VM_UNINITIALIZED)
- return 0;
-
seq_printf(m, "0x%pK-0x%pK %7ld",
v->addr, v->addr + v->size, v->size);

@@ -2622,6 +2617,11 @@ static int s_show(struct seq_file *m, void *p)
if (v->flags & VM_VPAGES)
seq_printf(m, " vpages");

+ /* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
+ smp_rmb();
+ if (v->flags & VM_UNINITIALIZED)
+ return 0;
+
show_numa_info(m, v);
seq_putc(m, '\n');
return 0;
--
1.7.5.4

2013-09-03 05:35:20

by Zhang Yanfei

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] mm/vmalloc: don't set area->caller twice

On 09/03/2013 11:00 AM, Wanpeng Li wrote:
> Changelog:
> * rebase against mmotm tree
>
> The caller address has already been set in set_vmalloc_vm(), there's no need
> to set it again in __vmalloc_area_node.
>
> Signed-off-by: Wanpeng Li <[email protected]>

Reviewed-by: Zhang Yanfei <[email protected]>

> ---
> mm/vmalloc.c | 1 -
> 1 files changed, 0 insertions(+), 1 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 1074543..d78d117 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -1566,7 +1566,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
> pages = kmalloc_node(array_size, nested_gfp, node);
> }
> area->pages = pages;
> - area->caller = caller;
> if (!area->pages) {
> remove_vm_area(area->addr);
> kfree(area);
>


--
Thanks.
Zhang Yanfei

2013-09-03 05:38:31

by Zhang Yanfei

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] mm/vmalloc: don't warning vmalloc allocation failure twice

On 09/03/2013 11:00 AM, Wanpeng Li wrote:
> Don't warning twice in __vmalloc_area_node and __vmalloc_node_range if
> __vmalloc_area_node allocation failure.
>
> Signed-off-by: Wanpeng Li <[email protected]>

OK, I missed the warning in __vmalloc_area_node(), so you are right.
You can just revert the commit 46c001a2753f47ffa621131baa3409e636515347.

> ---
> mm/vmalloc.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index d78d117..e3ec8b4 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -1635,7 +1635,7 @@ void *__vmalloc_node_range(unsigned long size, unsigned long align,
>
> addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);
> if (!addr)
> - goto fail;
> + return NULL;
>
> /*
> * In this function, newly allocated vm_struct has VM_UNINITIALIZED
>


--
Thanks.
Zhang Yanfei

2013-09-03 05:41:05

by Zhang Yanfei

[permalink] [raw]
Subject: Re: [PATCH v2 3/3] mm/vmalloc: move VM_UNINITIALIZED just before show_numa_info

On 09/03/2013 11:00 AM, Wanpeng Li wrote:
> The VM_UNINITIALIZED/VM_UNLIST flag introduced by commit f5252e00(mm: avoid
> null pointer access in vm_struct via /proc/vmallocinfo) is used to avoid
> accessing the pages field with unallocated page when show_numa_info() is
> called. This patch move the check just before show_numa_info in order that
> some messages still can be dumped via /proc/vmallocinfo.
>
> Signed-off-by: Wanpeng Li <[email protected]>

Hmmm, sorry again. Please revert commit
d157a55815ffff48caec311dfb543ce8a79e283e. That said, we could still
do the check in show_numa_info like before.

> ---
> mm/vmalloc.c | 10 +++++-----
> 1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index e3ec8b4..c4720cd 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -2590,11 +2590,6 @@ static int s_show(struct seq_file *m, void *p)
>
> v = va->vm;
>
> - /* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
> - smp_rmb();
> - if (v->flags & VM_UNINITIALIZED)
> - return 0;
> -
> seq_printf(m, "0x%pK-0x%pK %7ld",
> v->addr, v->addr + v->size, v->size);
>
> @@ -2622,6 +2617,11 @@ static int s_show(struct seq_file *m, void *p)
> if (v->flags & VM_VPAGES)
> seq_printf(m, " vpages");
>
> + /* Pair with smp_wmb() in clear_vm_uninitialized_flag() */
> + smp_rmb();
> + if (v->flags & VM_UNINITIALIZED)
> + return 0;
> +
> show_numa_info(m, v);
> seq_putc(m, '\n');
> return 0;
>


--
Thanks.
Zhang Yanfei