lkml.org 
[lkml]   [2006]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 2.6.20-rc1 05/10] Add kmemleak support for i386
    Date
    This patch adds the kmemleak-related entries to the vmlinux.lds.S
    linker script.

    Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
    ---

    arch/i386/kernel/vmlinux.lds.S | 6 ++++++
    include/asm-i386/thread_info.h | 18 ++++++++++++++++--
    2 files changed, 22 insertions(+), 2 deletions(-)

    diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
    index a53c8b1..2850bed 100644
    --- a/arch/i386/kernel/vmlinux.lds.S
    +++ b/arch/i386/kernel/vmlinux.lds.S
    @@ -69,6 +69,7 @@ SECTIONS

    /* writeable */
    . = ALIGN(4096);
    + _sdata = .; /* Start of data section */
    .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
    *(.data)
    CONSTRUCTORS
    @@ -193,6 +194,11 @@ SECTIONS
    *(.data.percpu)
    __per_cpu_end = .;
    }
    + .init.memleak_offsets : AT(ADDR(.init.memleak_offsets) - LOAD_OFFSET) {
    + __memleak_offsets_start = .;
    + *(.init.memleak_offsets)
    + __memleak_offsets_end = .;
    + }
    . = ALIGN(4096);
    /* freed after init ends here */

    diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
    index 4b187bb..02f3457 100644
    --- a/include/asm-i386/thread_info.h
    +++ b/include/asm-i386/thread_info.h
    @@ -95,9 +95,23 @@ static inline struct thread_info *curren

    /* thread information allocation */
    #ifdef CONFIG_DEBUG_STACK_USAGE
    -#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
    +#define alloc_thread_info(tsk) \
    + ({ \
    + struct thread_info *ret; \
    + \
    + ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
    + memleak_ignore(ret); \
    + ret; \
    + })
    #else
    -#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
    +#define alloc_thread_info(tsk) \
    + ({ \
    + struct thread_info *ret; \
    + \
    + ret = kmalloc(THREAD_SIZE, GFP_KERNEL); \
    + memleak_ignore(ret); \
    + ret; \
    + })
    #endif

    #define free_thread_info(info) kfree(info)
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/
    \
     
     \ /
      Last update: 2006-12-16 16:53    [W:0.033 / U:0.744 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site