• Vlastimil Babka's avatar
    mm, slab: don't wrap internal functions with alloc_hooks() · a0a44d91
    Vlastimil Babka authored
    The functions __kmalloc_noprof(), kmalloc_large_noprof(),
    kmalloc_trace_noprof() and their _node variants are all internal to the
    implementations of kmalloc_noprof() and kmalloc_node_noprof() and are
    only declared in the "public" slab.h and exported so that those
    implementations can be static inline and distinguish the build-time
    constant size variants. The only other users for some of the internal
    functions are slub_kunit and fortify_kunit tests which make very
    short-lived allocations.
    
    Therefore we can stop wrapping them with the alloc_hooks() macro.
    Instead add a __ prefix to all of them and a comment documenting these
    as internal. Also rename __kmalloc_trace() to __kmalloc_cache() which is
    more descriptive - it is a variant of __kmalloc() where the exact
    kmalloc cache has been already determined.
    
    The usage in fortify_kunit can be removed completely, as the internal
    functions should be tested already through kmalloc() tests in the
    test variant that passes non-constant allocation size.
    Reported-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    Cc: Suren Baghdasaryan <surenb@google.com>
    Cc: Kees Cook <keescook@chromium.org>
    Reviewed-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    Acked-by: default avatarDavid Rientjes <rientjes@google.com>
    Signed-off-by: default avatarVlastimil Babka <vbabka@suse.cz>
    a0a44d91
slub_kunit.c 4.35 KB