[lkml]   [2006]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH 08/10] Keep the __init functions after initialization
    From: Catalin Marinas <>

    This patch adds the CONFIG_DEBUG_KEEP_INIT option which preserves the
    .init.text section after initialization. Memory leaks happening during this
    phase can be more easily tracked.

    Signed-off-by: Catalin Marinas <>

    include/linux/init.h | 4 ++++
    lib/Kconfig.debug | 10 ++++++++++
    2 files changed, 14 insertions(+), 0 deletions(-)

    diff --git a/include/linux/init.h b/include/linux/init.h
    index 6667785..1590e9a 100644
    --- a/include/linux/init.h
    +++ b/include/linux/init.h
    @@ -40,7 +40,11 @@ #include <linux/compiler.h>

    /* These are for everybody (although not all archs will actually
    discard it in modules) */
    +#define __init
    #define __init __attribute__ ((__section__ (".init.text")))
    #define __initdata __attribute__ ((__section__ ("")))
    #define __exitdata __attribute__ ((__section__("")))
    #define __exit_call __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
    diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
    index 6c56be2..5013375 100644
    --- a/lib/Kconfig.debug
    +++ b/lib/Kconfig.debug
    @@ -171,6 +171,16 @@ config DEBUG_MEMLEAK_ORPHAN_FREEING
    information displayed allow an easier identification of
    false positives.

    +config DEBUG_KEEP_INIT
    + bool "Do not free the __init functions"
    + default n
    + depends on DEBUG_MEMLEAK
    + help
    + This option moves the __init functions out of the .init.text
    + section and therefore they are no longer freed after the
    + kernel initialization. It is useful for identifying memory
    + leaks happening during the kernel or modules initialization.
    config DEBUG_PREEMPT
    bool "Debug preemptible kernel"
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at
     \ /
      Last update: 2006-07-11 00:15    [W:0.022 / U:223.512 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site