• Michal Hocko's avatar
    mm, vmalloc: properly track vmalloc users · 1f5307b1
    Michal Hocko authored
    __vmalloc_node_flags used to be static inline but this has changed by
    "mm: introduce kv[mz]alloc helpers" because kvmalloc_node needs to use
    it as well and the code is outside of the vmalloc proper.  I haven't
    realized that changing this will lead to a subtle bug though.  The
    function is responsible to track the caller as well.  This caller is
    then printed by /proc/vmallocinfo.  If __vmalloc_node_flags is not
    inline then we would get only direct users of __vmalloc_node_flags as
    callers (e.g.  v[mz]alloc) which reduces usefulness of this debugging
    feature considerably.  It simply doesn't help to see that the given
    range belongs to vmalloc as a caller:
    
      0xffffc90002c79000-0xffffc90002c7d000   16384 vmalloc+0x16/0x18 pages=3 vmalloc N0=3
      0xffffc90002c81000-0xffffc90002c85000   16384 vmalloc+0x16/0x18 pages=3 vmalloc N1=3
      0xffffc90002c8d000-0xffffc90002c91000   16384 vmalloc+0x16/0x18 pages=3 vmalloc N1=3
      0xffffc90002c95000-0xffffc90002c99000   16384 vmalloc+0x16/0x18 pages=3 vmalloc N1=3
    
    We really want to catch the _caller_ of the vmalloc function.  Fix this
    issue by making __vmalloc_node_flags static inline again.
    
    Link: http://lkml.kernel.org/r/20170502134657.12381-1-mhocko@kernel.orgSigned-off-by: default avatarMichal Hocko <mhocko@suse.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    1f5307b1
vmalloc.c 69.3 KB