Re: [PATCH v3 net-next 3/5] tcp: Access &tcp_hashinfo via net.
From: Kuniyuki Iwashima <hidden>
Date: 2022-09-03 03:25:57
From: Eric Dumazet <edumazet@google.com> Date: Fri, 2 Sep 2022 20:16:11 -0700
On Fri, Sep 2, 2022 at 7:50 PM Kuniyuki Iwashima [off-list ref] wrote:quoted
Ah, exactly. Then I will add ____cacheline_aligned_in_smp to tw_refcount, instead of keeping the original order, to avoid invalidation by sysctl_max_tw_buckets change, which wouldn't be so frequently done though. struct inet_timewait_death_row { - refcount_t tw_refcount; - - struct inet_hashinfo *hashinfo ____cacheline_aligned_in_smp; + struct inet_hashinfo *hashinfo; + refcount_t tw_refcount ____cacheline_aligned_in_smp; int sysctl_max_tw_buckets;This would move sysctl_max_tw_buckets in a separate/dedicated cache line :/ --> { refcount_t tw_refcount; /* Padding to avoid false sharing, tw_refcount can be often written */ struct inet_hashinfo *hashinfo ____cacheline_aligned_in_smp; int sysctl_max_tw_buckets; .. other read only fields could fit here.quoted
};Explicit alignment of the structure or first field is not needed, they will already be cache line aligned.
I got it. I'll add that change. Thank you so much!