mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
Merge branch 'kmemleak' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-2.6-cm
* 'kmemleak' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-2.6-cm: kmemleak: Fix typo in the comment lib/scatterlist: Hook sg_kmalloc into kmemleak (v2) kmemleak: Add DocBook style comments to kmemleak.c kmemleak: Introduce a default off mode for kmemleak kmemleak: Show more information for objects found by alias
This commit is contained in:
commit
4c619407b0
3 changed files with 101 additions and 29 deletions
|
|
@ -410,6 +410,13 @@ config DEBUG_KMEMLEAK_TEST
|
|||
|
||||
If unsure, say N.
|
||||
|
||||
config DEBUG_KMEMLEAK_DEFAULT_OFF
|
||||
bool "Default kmemleak to off"
|
||||
depends on DEBUG_KMEMLEAK
|
||||
help
|
||||
Say Y here to disable kmemleak by default. It can then be enabled
|
||||
on the command line via kmemleak=on.
|
||||
|
||||
config DEBUG_PREEMPT
|
||||
bool "Debug preemptible kernel"
|
||||
depends on DEBUG_KERNEL && PREEMPT && TRACE_IRQFLAGS_SUPPORT
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include <linux/slab.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/kmemleak.h>
|
||||
|
||||
/**
|
||||
* sg_next - return the next scatterlist entry in a list
|
||||
|
|
@ -115,17 +116,29 @@ EXPORT_SYMBOL(sg_init_one);
|
|||
*/
|
||||
static struct scatterlist *sg_kmalloc(unsigned int nents, gfp_t gfp_mask)
|
||||
{
|
||||
if (nents == SG_MAX_SINGLE_ALLOC)
|
||||
return (struct scatterlist *) __get_free_page(gfp_mask);
|
||||
else
|
||||
if (nents == SG_MAX_SINGLE_ALLOC) {
|
||||
/*
|
||||
* Kmemleak doesn't track page allocations as they are not
|
||||
* commonly used (in a raw form) for kernel data structures.
|
||||
* As we chain together a list of pages and then a normal
|
||||
* kmalloc (tracked by kmemleak), in order to for that last
|
||||
* allocation not to become decoupled (and thus a
|
||||
* false-positive) we need to inform kmemleak of all the
|
||||
* intermediate allocations.
|
||||
*/
|
||||
void *ptr = (void *) __get_free_page(gfp_mask);
|
||||
kmemleak_alloc(ptr, PAGE_SIZE, 1, gfp_mask);
|
||||
return ptr;
|
||||
} else
|
||||
return kmalloc(nents * sizeof(struct scatterlist), gfp_mask);
|
||||
}
|
||||
|
||||
static void sg_kfree(struct scatterlist *sg, unsigned int nents)
|
||||
{
|
||||
if (nents == SG_MAX_SINGLE_ALLOC)
|
||||
if (nents == SG_MAX_SINGLE_ALLOC) {
|
||||
kmemleak_free(sg);
|
||||
free_page((unsigned long) sg);
|
||||
else
|
||||
} else
|
||||
kfree(sg);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue