1. 20 Jul, 2011 1 commit
  2. 18 Jul, 2011 1 commit
    • Hugh Dickins's avatar
      slab: fix DEBUG_SLAB build · c225150b
      Hugh Dickins authored
      Fix CONFIG_SLAB=y CONFIG_DEBUG_SLAB=y build error and warnings.
      
      Now that ARCH_SLAB_MINALIGN defaults to __alignof__(unsigned long long),
      it is always defined (when slab.h included), but cannot be used in #if:
      mm/slab.c: In function `cache_alloc_debugcheck_after':
      mm/slab.c:3156:5: warning: "__alignof__" is not defined
      mm/slab.c:3156:5: error: missing binary operator before token "("
      make[1]: *** [mm/slab.o] Error 1
      
      So just remove the #if and #endif lines, but then 64-bit build warns:
      mm/slab.c: In function `cache_alloc_debugcheck_after':
      mm/slab.c:3156:6: warning: cast from pointer to integer of different size
      mm/slab.c:3158:10: warning: format `%d' expects type `int', but argument
                                  3 has type `long unsigned int'
      Fix those with casts, whatever the actual type of ARCH_SLAB_MINALIGN.
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
      c225150b
  3. 07 Jul, 2011 5 commits
    • Pekka Enberg's avatar
      SLUB: Fix missing <linux/stacktrace.h> include · bfa71457
      Pekka Enberg authored
      This fixes the following build breakage commit d6543e39 ("slub: Enable backtrace
      for create/delete points"):
      
        CC      mm/slub.o
      mm/slub.c: In function ‘set_track’:
      mm/slub.c:428: error: storage size of ‘trace’ isn’t known
      mm/slub.c:435: error: implicit declaration of function ‘save_stack_trace’
      mm/slub.c:428: warning: unused variable ‘trace’
      make[1]: *** [mm/slub.o] Error 1
      make: *** [mm/slub.o] Error 2
      Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
      bfa71457
    • Marcin Slusarz's avatar
      slub: reduce overhead of slub_debug · c4089f98
      Marcin Slusarz authored
      slub checks for poison one byte by one, which is highly inefficient
      and shows up frequently as a highest cpu-eater in perf top.
      
      Joining reads gives nice speedup:
      
      (Compiling some project with different options)
                                       make -j12    make clean
      slub_debug disabled:             1m 27s       1.2 s
      slub_debug enabled:              1m 46s       7.6 s
      slub_debug enabled + this patch: 1m 33s       3.2 s
      
      check_bytes still shows up high, but not always at the top.
      Signed-off-by: default avatarMarcin Slusarz <marcin.slusarz@gmail.com>
      Cc: Christoph Lameter <cl@linux-foundation.org>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Matt Mackall <mpm@selenic.com>
      Cc: linux-mm@kvack.org
      Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
      c4089f98
    • Ben Greear's avatar
      slub: Add method to verify memory is not freed · d18a90dd
      Ben Greear authored
      This is for tracking down suspect memory usage.
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarBen Greear <greearb@candelatech.com>
      Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
      d18a90dd
    • Ben Greear's avatar
      slub: Enable backtrace for create/delete points · d6543e39
      Ben Greear authored
      This patch attempts to grab a backtrace for the creation
      and deletion points of the slub object.  When a fault is
      detected, we can then get a better idea of where the item
      was deleted.
      
      Example output from debugging some funky nfs/rpc behaviour:
      
      =============================================================================
      BUG kmalloc-64: Object is on free-list
      -----------------------------------------------------------------------------
      
      INFO: Allocated in rpcb_getport_async+0x39c/0x5a5 [sunrpc] age=381 cpu=3 pid=3750
             __slab_alloc+0x348/0x3ba
             kmem_cache_alloc_trace+0x67/0xe7
             rpcb_getport_async+0x39c/0x5a5 [sunrpc]
             call_bind+0x70/0x75 [sunrpc]
             __rpc_execute+0x78/0x24b [sunrpc]
             rpc_execute+0x3d/0x42 [sunrpc]
             rpc_run_task+0x79/0x81 [sunrpc]
             rpc_call_sync+0x3f/0x60 [sunrpc]
             rpc_ping+0x42/0x58 [sunrpc]
             rpc_create+0x4aa/0x527 [sunrpc]
             nfs_create_rpc_client+0xb1/0xf6 [nfs]
             nfs_init_client+0x3b/0x7d [nfs]
             nfs_get_client+0x453/0x5ab [nfs]
             nfs_create_server+0x10b/0x437 [nfs]
             nfs_fs_mount+0x4ca/0x708 [nfs]
             mount_fs+0x6b/0x152
      INFO: Freed in rpcb_map_release+0x3f/0x44 [sunrpc] age=30 cpu=2 pid=29049
             __slab_free+0x57/0x150
             kfree+0x107/0x13a
             rpcb_map_release+0x3f/0x44 [sunrpc]
             rpc_release_calldata+0x12/0x14 [sunrpc]
             rpc_free_task+0x59/0x61 [sunrpc]
             rpc_final_put_task+0x82/0x8a [sunrpc]
             __rpc_execute+0x23c/0x24b [sunrpc]
             rpc_async_schedule+0x10/0x12 [sunrpc]
             process_one_work+0x230/0x41d
             worker_thread+0x133/0x217
             kthread+0x7d/0x85
             kernel_thread_helper+0x4/0x10
      INFO: Slab 0xffffea00029aa470 objects=20 used=9 fp=0xffff8800be7830d8 flags=0x20000000004081
      INFO: Object 0xffff8800be7830d8 @offset=4312 fp=0xffff8800be7827a8
      
      Bytes b4 0xffff8800be7830c8:  87 a8 96 00 01 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a .�......ZZZZZZZZ
       Object 0xffff8800be7830d8:  6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
       Object 0xffff8800be7830e8:  6b 6b 6b 6b 01 08 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkk..kkkkkkkkkk
       Object 0xffff8800be7830f8:  6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
       Object 0xffff8800be783108:  6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b a5 kkkkkkkkkkkkkkk�
       Redzone 0xffff8800be783118:  bb bb bb bb bb bb bb bb                         �������������
       Padding 0xffff8800be783258:  5a 5a 5a 5a 5a 5a 5a 5a                         ZZZZZZZZ
      Pid: 29049, comm: kworker/2:2 Not tainted 3.0.0-rc4+ #8
      Call Trace:
       [<ffffffff811055c3>] print_trailer+0x131/0x13a
       [<ffffffff81105601>] object_err+0x35/0x3e
       [<ffffffff8110746f>] verify_mem_not_deleted+0x7a/0xb7
       [<ffffffffa02851b5>] rpcb_getport_done+0x23/0x126 [sunrpc]
       [<ffffffffa027d0ba>] rpc_exit_task+0x3f/0x6d [sunrpc]
       [<ffffffffa027d4ab>] __rpc_execute+0x78/0x24b [sunrpc]
       [<ffffffffa027d6c0>] ? rpc_execute+0x42/0x42 [sunrpc]
       [<ffffffffa027d6d0>] rpc_async_schedule+0x10/0x12 [sunrpc]
       [<ffffffff810611b7>] process_one_work+0x230/0x41d
       [<ffffffff81061102>] ? process_one_work+0x17b/0x41d
       [<ffffffff81063613>] worker_thread+0x133/0x217
       [<ffffffff810634e0>] ? manage_workers+0x191/0x191
       [<ffffffff81066e10>] kthread+0x7d/0x85
       [<ffffffff81485924>] kernel_thread_helper+0x4/0x10
       [<ffffffff8147eb18>] ? retint_restore_args+0x13/0x13
       [<ffffffff81066d93>] ? __init_kthread_worker+0x56/0x56
       [<ffffffff81485920>] ? gs_change+0x13/0x13
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarBen Greear <greearb@candelatech.com>
      Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
      d6543e39
    • Christoph Lameter's avatar
      slab allocators: Provide generic description of alignment defines · 90810645
      Christoph Lameter authored
      Provide description for alignment defines.
      Acked-by: default avatarDavid Rientjes <rientjes@google.com>
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
      90810645
  4. 16 Jun, 2011 1 commit
    • Christoph Lameter's avatar
      slab, slub, slob: Unify alignment definition · 3192b920
      Christoph Lameter authored
      Every slab has its on alignment definition in include/linux/sl?b_def.h. Extract those
      and define a common set in include/linux/slab.h.
      
      SLOB: As notes sometimes we need double word alignment on 32 bit. This gives all
      structures allocated by SLOB a unsigned long long alignment like the others do.
      
      SLAB: If ARCH_SLAB_MINALIGN is not set SLAB would set ARCH_SLAB_MINALIGN to
      zero meaning no alignment at all. Give it the default unsigned long long alignment.
      Signed-off-by: default avatarChristoph Lameter <cl@linux.com>
      Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
      3192b920
  5. 07 Jun, 2011 1 commit
    • Steven Rostedt's avatar
      slob/lockdep: Fix gfp flags passed to lockdep · bd50cfa8
      Steven Rostedt authored
      Doing a ktest.pl randconfig, I stumbled across the following bug
      on boot up:
      
      ------------[ cut here ]------------
      WARNING: at /home/rostedt/work/autotest/nobackup/linux-test.git/kernel/lockdep.c:2649 lockdep_trace_alloc+0xed/0x100()
      Hardware name:
      Modules linked in:
      Pid: 0, comm: swapper Not tainted 3.0.0-rc1-test-00054-g1d68b67 #1
      Call Trace:
       [<ffffffff810626ad>] warn_slowpath_common+0xad/0xf0
       [<ffffffff8106270a>] warn_slowpath_null+0x1a/0x20
       [<ffffffff810b537d>] lockdep_trace_alloc+0xed/0x100
       [<ffffffff81182fb0>] __kmalloc_node+0x30/0x2f0
       [<ffffffff81153eda>] pcpu_mem_alloc+0x13a/0x180
       [<ffffffff82be022c>] percpu_init_late+0x48/0xc2
       [<ffffffff82bd630c>] ? mem_init+0xd8/0xe3
       [<ffffffff82bbcc73>] start_kernel+0x1c2/0x449
       [<ffffffff82bbc35c>] x86_64_start_reservations+0x163/0x167
       [<ffffffff82bbc493>] x86_64_start_kernel+0x133/0x142^M
      ---[ end trace a7919e7f17c0a725 ]---
      
      Then I ran a ktest.pl config_bisect and it came up with this config
      as the problem:
      
        CONFIG_SLOB
      
      Looking at what is different between SLOB and SLAB and SLUB, I found
      that the gfp flags are masked against gfp_allowed_mask in
      SLAB and SLUB, but not SLOB.
      
      On boot up, interrupts are disabled and lockdep will warn if some flags
      are set in gfp and interrupts are disabled. But these flags are masked
      off with the gfp_allowed_mask during boot. Because SLOB does not
      mask the flags against gfp_allowed_mask it triggers the warn on.
      
      Adding this mask fixes the bug. I also found that kmem_cache_alloc_node()
      was missing both the mask and the lockdep check, and that was added too.
      Acked-by: default avatarMatt Mackall <mpm@selenic.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Nick Piggin <npiggin@kernel.dk>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
      bd50cfa8
  6. 30 May, 2011 1 commit
  7. 29 May, 2011 30 commits