Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147737
b: refs/heads/master
c: 89219d3
h: refs/heads/master
i:
  147735: 97901bf
v: v3
  • Loading branch information
Catalin Marinas committed Jun 11, 2009
1 parent 0144252 commit e7bbad2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 06f22f13f3cc2eff00db09f053218e5d4b757bc8
refs/heads/master: 89219d37a2377c44fde7bff0bf0623453c05329a
30 changes: 27 additions & 3 deletions trunk/mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/rcupdate.h>
#include <linux/bootmem.h>
#include <linux/pfn.h>
#include <linux/kmemleak.h>

#include <asm/atomic.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -1327,6 +1328,9 @@ static void __vunmap(const void *addr, int deallocate_pages)
void vfree(const void *addr)
{
BUG_ON(in_interrupt());

kmemleak_free(addr);

__vunmap(addr, 1);
}
EXPORT_SYMBOL(vfree);
Expand Down Expand Up @@ -1439,8 +1443,17 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,

void *__vmalloc_area(struct vm_struct *area, gfp_t gfp_mask, pgprot_t prot)
{
return __vmalloc_area_node(area, gfp_mask, prot, -1,
__builtin_return_address(0));
void *addr = __vmalloc_area_node(area, gfp_mask, prot, -1,
__builtin_return_address(0));

/*
* A ref_count = 3 is needed because the vm_struct and vmap_area
* structures allocated in the __get_vm_area_node() function contain
* references to the virtual address of the vmalloc'ed block.
*/
kmemleak_alloc(addr, area->size - PAGE_SIZE, 3, gfp_mask);

return addr;
}

/**
Expand All @@ -1459,6 +1472,8 @@ static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
int node, void *caller)
{
struct vm_struct *area;
void *addr;
unsigned long real_size = size;

size = PAGE_ALIGN(size);
if (!size || (size >> PAGE_SHIFT) > num_physpages)
Expand All @@ -1470,7 +1485,16 @@ static void *__vmalloc_node(unsigned long size, gfp_t gfp_mask, pgprot_t prot,
if (!area)
return NULL;

return __vmalloc_area_node(area, gfp_mask, prot, node, caller);
addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);

/*
* A ref_count = 3 is needed because the vm_struct and vmap_area
* structures allocated in the __get_vm_area_node() function contain
* references to the virtual address of the vmalloc'ed block.
*/
kmemleak_alloc(addr, real_size, 3, gfp_mask);

return addr;
}

void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
Expand Down

0 comments on commit e7bbad2

Please sign in to comment.