lkml.org 
[lkml]   [2018]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 107/126] rhashtable: reorganize struct rhashtable layout
    Date
    4.14-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Eric Dumazet <edumazet@google.com>

    While under frags DDOS I noticed unfortunate false sharing between
    @nelems and @params.automatic_shrinking

    Move @nelems at the end of struct rhashtable so that first cache line
    is shared between all cpus, because almost never dirtied.

    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    (cherry picked from commit e5d672a0780d9e7118caad4c171ec88b8299398d)
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    include/linux/rhashtable.h | 8 ++++----
    1 file changed, 4 insertions(+), 4 deletions(-)

    --- a/include/linux/rhashtable.h
    +++ b/include/linux/rhashtable.h
    @@ -152,25 +152,25 @@ struct rhashtable_params {
    /**
    * struct rhashtable - Hash table handle
    * @tbl: Bucket table
    - * @nelems: Number of elements in table
    * @key_len: Key length for hashfn
    - * @p: Configuration parameters
    * @max_elems: Maximum number of elements in table
    + * @p: Configuration parameters
    * @rhlist: True if this is an rhltable
    * @run_work: Deferred worker to expand/shrink asynchronously
    * @mutex: Mutex to protect current/future table swapping
    * @lock: Spin lock to protect walker list
    + * @nelems: Number of elements in table
    */
    struct rhashtable {
    struct bucket_table __rcu *tbl;
    - atomic_t nelems;
    unsigned int key_len;
    - struct rhashtable_params p;
    unsigned int max_elems;
    + struct rhashtable_params p;
    bool rhlist;
    struct work_struct run_work;
    struct mutex mutex;
    spinlock_t lock;
    + atomic_t nelems;
    };

    /**

    \
     
     \ /
      Last update: 2018-09-18 01:06    [W:4.635 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site