mm-kmemleak-treat-vm_struct-as-alternative-reference-to-vmalloced-objects.patch removed from -mm tree
The patch titled
Subject: mm: kmemleak: treat vm_struct as alternative reference to vmalloc'ed objects
has been removed from the -mm tree. Its filename was
mm-kmemleak-treat-vm_struct-as-alternative-reference-to-vmalloced-objects.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Catalin Marinas <[email protected]>
Subject: mm: kmemleak: treat vm_struct as alternative reference to vmalloc'ed objects
Kmemleak requires that vmalloc'ed objects have a minimum reference count of 2: one in the corresponding vm_struct object and the other owned by the vmalloc() caller. There are cases, however, where the original vmalloc() returned pointer is lost and, instead, a pointer to vm_struct is stored (see free_thread_stack()). Kmemleak currently reports such objects as leaks.
This patch adds support for treating any surplus references to an object as additional references to a specified object. It introduces the kmemleak_vmalloc() API function which takes a vm_struct pointer and sets its surplus reference passing to the actual vmalloc() returned pointer. The __vmalloc_node_range() calling site has been modified accordingly.
---
Documentation/dev-tools/kmemleak.rst | 1 include/linux/kmemleak.h | 7 + mm/kmemleak.c | 93 +++++++++++++++++++++++-- mm/vmalloc.c | 7 - 4 files changed, 98 insertions(+), 10 deletions(-)
Documentation/dev-tools/kmemleak.rst renamed from Documentation/dev-tools/kmemleak.rst~mm-kmemleak-treat-vm_struct-as-alternative-reference-to-vmalloced-objects +1 -0
@@ -150,6 +150,7 @@ See the include/linux/kmemleak.h header - ``kmemleak_init`` - initialize kmemleak - ``kmemleak_alloc`` - notify of a memory block allocation - ``kmemleak_alloc_percpu`` - notify of a percpu memory block allocation +- ``kmemleak_vmalloc`` - notify of a vmalloc() memory allocation - ``kmemleak_free`` - notify of a memory block freeing - ``kmemleak_free_part`` - notify of a partial memory block freeing - ``kmemleak_free_percpu`` - notify of a percpu memory block freeing
include/linux/kmemleak.h renamed from include/linux/kmemleak.h~mm-kmemleak-treat-vm_struct-as-alternative-reference-to-vmalloced-objects +7 -0
@@ -22,6 +22,7 @@#define __KMEMLEAK_H#include <linux/slab.h> +#include <linux/vmalloc.h> #ifdef CONFIG_DEBUG_KMEMLEAK
@@ -30,6 +31,8 @@ extern void kmemleak_alloc(const void *p gfp_t gfp) __ref;extern void kmemleak_alloc_percpu (const void __percpu *ptr,size_t size,gfp_t gfp)__ref ; +extern void kmemleak_vmalloc (const struct vm_struct *area,size_t size, +gfp_t gfp)__ref ;extern void kmemleak_free (const void *ptr)__ref ;extern void kmemleak_free_part (const void *ptr,size_t size)__ref ;extern void kmemleak_free_percpu (const void __percpu *ptr)__ref ;
@@ -81,6 +84,10 @@ static inline void kmemleak_alloc_percpu gfp_t gfp) { } +static inline void kmemleak_vmalloc (const struct vm_struct *area,size_t size, +gfp_t gfp) +{ +}static inline void kmemleak_free (const void *ptr) { }
mm/kmemleak.c renamed from mm/kmemleak.c~mm-kmemleak-treat-vm_struct-as-alternative-reference-to-vmalloced-objects +89 -4
154 lines not on this page · raw message
mm/vmalloc.c renamed from mm/vmalloc.c~mm-kmemleak-treat-vm_struct-as-alternative-reference-to-vmalloced-objects +1 -6
@@ -1770,12 +1770,7 @@ void *__vmalloc_node_range(unsigned long*/ clear_vm_uninitialized_flag (area); -/* -* A ref_count = 2 is needed because vm_struct allocated in -* __get_vm_area_node() contains a reference to the virtual address of -* the vmalloc'ed block. -*/ -kmemleak_alloc (addr, real_size,2 , gfp_mask); +kmemleak_vmalloc (area, size, gfp_mask);return addr;
_
Patches currently in -mm which might be from [email protected] are