kmemleak : Make module scanning optional using config

Currently kmemleak scans module memory as provided
in the area list. This takes up lot of time with
irq's and preemption disabled. Provide a compile
time configurable config to enable this functionality.

Change-Id: I5117705e7e6726acdf492e7f87c0703bc1f28da0
Signed-off-by: Vignesh Radhakrishnan <vigneshr@codeaurora.org>
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
[satyap: trivial merge conflict resolution and remove duplicate entry]
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
This commit is contained in:
Vignesh Radhakrishnan 2015-01-30 16:26:41 +05:30 committed by David Keitel
parent 1723ce4914
commit 1dd9d8dd98
2 changed files with 13 additions and 7 deletions

View file

@ -2579,7 +2579,13 @@ void * __weak module_alloc(unsigned long size)
return vmalloc_exec(size); return vmalloc_exec(size);
} }
#ifdef CONFIG_DEBUG_KMEMLEAK #if defined(CONFIG_DEBUG_KMEMLEAK) && defined(CONFIG_DEBUG_MODULE_SCAN_OFF)
static void kmemleak_load_module(const struct module *mod,
const struct load_info *info)
{
kmemleak_no_scan(mod->module_core);
}
#elif defined(CONFIG_DEBUG_KMEMLEAK)
static void kmemleak_load_module(const struct module *mod, static void kmemleak_load_module(const struct module *mod,
const struct load_info *info) const struct load_info *info)
{ {

View file

@ -956,14 +956,14 @@ config DEBUG_TASK_STACK_SCAN_OFF
writing to the debugfs entry : writing to the debugfs entry :
echo "stack=on" > /sys/kernel/debug/kmemleak. echo "stack=on" > /sys/kernel/debug/kmemleak.
config DEBUG_TASK_STACK_SCAN_OFF config DEBUG_MODULE_SCAN_OFF
bool "Disable kmemleak task stack scan by default" bool "Disable module memory scan for leaks by default"
depends on DEBUG_KMEMLEAK depends on DEBUG_KMEMLEAK
help help
Say Y here to disable kmemleak task stack scan by default Say Y here to disable scanning kernel modules area list
at compile time. It can be enabled later if required by by default for memory leaks. Module scan an potentially
writing to the debugfs entry : run with irq/preemption disabled for considerable amount
echo "stack=on" > /sys/kernel/debug/kmemleak. of time.
config DEBUG_PREEMPT config DEBUG_PREEMPT
bool "Debug preemptible kernel" bool "Debug preemptible kernel"