mm/vmalloc: use help function to get vmalloc area size
Subsystems (2)
PATCH 1/1 mm/vmalloc: use help function to get vmalloc area size
Use get_vm_area_size() to get vmalloc area's actual size without guard page.
--- mm/vmalloc.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
mm/vmalloc.c +6 -6
@@ -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 )) {
Signature · 8 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 2 lines · Jianguo Wu
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
Quoted 72 lines
Signed-off-by Jianguo Wu <[email protected]>---
mm/vmalloc.c| 12 ++++++------1 files changed, 6 insertions(+), 6 deletions(-)mm/vmalloc.c +6
-6@@ -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 )) {Signature · 8 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 2 lines · Jianguo Wu
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
Quoted 72 lines
Signed-off-by Jianguo Wu <[email protected]>---
mm/vmalloc.c| 12 ++++++------1 files changed, 6 insertions(+), 6 deletions(-)mm/vmalloc.c +6
-6@@ -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 )) {Signature · 8 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Wanpeng Li
Quoted 2 lines · Jianguo Wu
Use
get_vm_area_size()to get vmalloc area's actual size without guard page.Do you see this?
Hi Wanpeng,
Sorry for not notice your post, please ignore this patch.
Thanks.
Quoted 67 lines
Quoted 67 lines
Signed-off-by Jianguo Wu <[email protected]>---
mm/vmalloc.c| 12 ++++++------1 files changed, 6 insertions(+), 6 deletions(-)mm/vmalloc.c +6
-6@@ -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 )) {Signature · 1 line
1.7.1
Quoted 13 lines
Quoted 5 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>