• Sasha Levin's avatar
    slab: prevent warnings when allocating with __GFP_NOWARN · 907985f4
    Sasha Levin authored
    Sasha Levin noticed that the warning introduced by commit 6286ae97
    ("slab: Return NULL for oversized allocations) is being triggered:
    
      WARNING: CPU: 15 PID: 21519 at mm/slab_common.c:376 kmalloc_slab+0x2f/0xb0()
      can: request_module (can-proto-4) failed.
      mpoa: proc_mpc_write: could not parse ''
      Modules linked in:
      CPU: 15 PID: 21519 Comm: trinity-child15 Tainted: G W    3.10.0-rc4-next-20130607-sasha-00011-gcd78395-dirty #2
       0000000000000009 ffff880020a95e30 ffffffff83ff4041 0000000000000000
       ffff880020a95e68 ffffffff8111fe12 fffffffffffffff0 00000000000082d0
       0000000000080000 0000000000080000 0000000001400000 ffff880020a95e78
      Call Trace:
       [<ffffffff83ff4041>] dump_stack+0x4e/0x82
       [<ffffffff8111fe12>] warn_slowpath_common+0x82/0xb0
       [<ffffffff8111fe55>] warn_slowpath_null+0x15/0x20
       [<ffffffff81243dcf>] kmalloc_slab+0x2f/0xb0
       [<ffffffff81278d54>] __kmalloc+0x24/0x4b0
       [<ffffffff8196ffe3>] ? security_capable+0x13/0x20
       [<ffffffff812a26b7>] ? pipe_fcntl+0x107/0x210
       [<ffffffff812a26b7>] pipe_fcntl+0x107/0x210
       [<ffffffff812b7ea0>] ? fget_raw_light+0x130/0x3f0
       [<ffffffff812aa5fb>] SyS_fcntl+0x60b/0x6a0
       [<ffffffff8403ca98>] tracesys+0xe1/0xe6
    
    Andrew Morton writes:
    
      __GFP_NOWARN is frequently used by kernel code to probe for "how big
      an allocation can I get".  That's a bit lame, but it's used on slow
      paths and is pretty simple.
    
    However, SLAB would still spew a warning when a big allocation happens
    if the __GFP_NOWARN flag is _not_ set to expose kernel bugs.
    Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
    [ penberg@kernel.org: improve changelog ]
    Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
    907985f4
slab_common.c 15 KB