17 Aug, 2018

1 commit

  • Previously, alloc_ila_locks() and bucket_table_alloc() call
    spin_lock_init() separately, therefore they have two different
    lock names and lock class keys. However, after commit b893281715ab
    ("ila: Call library function alloc_bucket_locks") they both call
    helper alloc_bucket_spinlocks() which now only has one lock
    name and lock class key. This causes a few bogus lockdep warnings
    as reported by syzbot.

    Fix this by making alloc_bucket_locks() a macro and pass declaration
    name as lock name and a static lock class key inside the macro.

    Fixes: b893281715ab ("ila: Call library function alloc_bucket_locks")
    Reported-by:
    Cc: Tom Herbert
    Signed-off-by: Cong Wang
    Signed-off-by: David S. Miller

    Cong Wang
     

08 Jun, 2018

1 commit

  • kvmalloc warned about incompatible gfp_mask to catch abusers (mostly
    GFP_NOFS) with an intention that this will motivate authors of the code
    to fix those. Linus argues that this just motivates people to do even
    more hacks like

    if (gfp == GFP_KERNEL)
    kvmalloc
    else
    kmalloc

    I haven't seen this happening much (Linus pointed to bucket_lock special
    cases an atomic allocation but my git foo hasn't found much more) but it
    is true that we can grow those in future. Therefore Linus suggested to
    simply not fallback to vmalloc for incompatible gfp flags and rather
    stick with the kmalloc path.

    Link: http://lkml.kernel.org/r/20180601115329.27807-1-mhocko@kernel.org
    Signed-off-by: Michal Hocko
    Suggested-by: Linus Torvalds
    Cc: Tom Herbert
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Hocko
     

11 Dec, 2017

1 commit

  • Add two new library functions: alloc_bucket_spinlocks and
    free_bucket_spinlocks. These are used to allocate and free an array
    of spinlocks that are useful as locks for hash buckets. The interface
    specifies the maximum number of spinlocks in the array as well
    as a CPU multiplier to derive the number of spinlocks to allocate.
    The number allocated is rounded up to a power of two to make the
    array amenable to hash lookup.

    Signed-off-by: Tom Herbert
    Signed-off-by: David S. Miller

    Tom Herbert