linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: Jianguo Wu <wujianguo@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	zhangyanfei@cn.fujitsu.com, David Rientjes <rientjes@google.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Michal Hocko <mhocko@suse.cz>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/vmalloc: use help function to get vmalloc area size
Date: Fri, 30 Aug 2013 16:49:49 +0800	[thread overview]
Message-ID: <2335.31695926121$1377852612@news.gmane.org> (raw)
In-Reply-To: <52205B09.4020800@huawei.com>

On Fri, Aug 30, 2013 at 04:42:49PM +0800, Jianguo Wu wrote:
>Use get_vm_area_size() to get vmalloc area's actual size without guard page.
>

Do you see this?

http://marc.info/?l=linux-mm&m=137698172417316&w=2

>Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
>---
> mm/vmalloc.c |   12 ++++++------
> 1 files changed, 6 insertions(+), 6 deletions(-)
>
>diff --git a/mm/vmalloc.c b/mm/vmalloc.c
>index 13a5495..abe13bc 100644
>--- a/mm/vmalloc.c
>+++ b/mm/vmalloc.c
>@@ -1263,7 +1263,7 @@ void unmap_kernel_range(unsigned long addr, unsigned long size)
> int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page ***pages)
> {
> 	unsigned long addr = (unsigned long)area->addr;
>-	unsigned long end = addr + area->size - PAGE_SIZE;
>+	unsigned long end = addr + get_vm_area_size(area);
> 	int err;
>
> 	err = vmap_page_range(addr, end, prot, *pages);
>@@ -1558,7 +1558,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
> 	unsigned int nr_pages, array_size, i;
> 	gfp_t nested_gfp = (gfp_mask & GFP_RECLAIM_MASK) | __GFP_ZERO;
>
>-	nr_pages = (area->size - PAGE_SIZE) >> PAGE_SHIFT;
>+	nr_pages = get_vm_area_size(area) >> PAGE_SHIFT;
> 	array_size = (nr_pages * sizeof(struct page *));
>
> 	area->nr_pages = nr_pages;
>@@ -1990,7 +1990,7 @@ long vread(char *buf, char *addr, unsigned long count)
>
> 		vm = va->vm;
> 		vaddr = (char *) vm->addr;
>-		if (addr >= vaddr + vm->size - PAGE_SIZE)
>+		if (addr >= vaddr + get_vm_area_size(vm))
> 			continue;
> 		while (addr < vaddr) {
> 			if (count == 0)
>@@ -2000,7 +2000,7 @@ long vread(char *buf, char *addr, unsigned long count)
> 			addr++;
> 			count--;
> 		}
>-		n = vaddr + vm->size - PAGE_SIZE - addr;
>+		n = vaddr + get_vm_area_size(vm) - addr;
> 		if (n > count)
> 			n = count;
> 		if (!(vm->flags & VM_IOREMAP))
>@@ -2072,7 +2072,7 @@ long vwrite(char *buf, char *addr, unsigned long count)
>
> 		vm = va->vm;
> 		vaddr = (char *) vm->addr;
>-		if (addr >= vaddr + vm->size - PAGE_SIZE)
>+		if (addr >= vaddr + get_vm_area_size(vm))
> 			continue;
> 		while (addr < vaddr) {
> 			if (count == 0)
>@@ -2081,7 +2081,7 @@ long vwrite(char *buf, char *addr, unsigned long count)
> 			addr++;
> 			count--;
> 		}
>-		n = vaddr + vm->size - PAGE_SIZE - addr;
>+		n = vaddr + get_vm_area_size(vm) - addr;
> 		if (n > count)
> 			n = count;
> 		if (!(vm->flags & VM_IOREMAP)) {
>-- 
>1.7.1
>
>
>--
>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>

--
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>

  reply	other threads:[~2013-08-30  8:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30  8:42 Jianguo Wu
2013-08-30  8:49 ` Wanpeng Li [this message]
2013-08-30  8:49 ` Wanpeng Li
     [not found] ` <52205cb9.ca112b0a.0544.ffff8988SMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-30  9:00   ` Jianguo Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='2335.31695926121$1377852612@news.gmane.org' \
    --to=liwanp@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=rientjes@google.com \
    --cc=wujianguo@huawei.com \
    --cc=zhangyanfei@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox