From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH net-next 2/2] net/sched: act_police: don't use spinlock in the data path Date: Fri, 16 Nov 2018 06:55:34 -0800 Message-ID: <2bfef133-8dbf-728c-f815-929291b4c68e@gmail.com> References: <6d287f706fdcff76eb1e9a1c85ea6ce188db11d8.1536852493.git.dcaratti@redhat.com> <45d88e35-43f8-d9ae-4da4-de61c3591a62@gmail.com> <6ef73ea1-2f0e-b1c5-3a0a-1742db67b59a@gmail.com> <7ba53062-de84-a8f1-14dc-3c49a2480925@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "netdev@vger.kernel.org" To: David Laight , 'Eric Dumazet' , Davide Caratti , Jamal Hadi Salim , Cong Wang , Jiri Pirko , "David S. Miller" Return-path: Received: from mail-pg1-f193.google.com ([209.85.215.193]:41468 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728079AbeKQBIT (ORCPT ); Fri, 16 Nov 2018 20:08:19 -0500 Received: by mail-pg1-f193.google.com with SMTP id 70so10710738pgh.8 for ; Fri, 16 Nov 2018 06:55:37 -0800 (PST) In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 11/16/2018 06:41 AM, David Laight wrote: > From: Eric Dumazet >> Sent: 16 November 2018 14:35 > ... >> I suggest to use a single cache line with a dedicated spinlock and these three s64 >> >> spinlock_t tcfp_lock ____cacheline_aligned_in_smp; >> s64 ... >> s64 ... >> s64 ... > > Doesn't this do something really stupid when cache lines are big. > If the spinlock is 8 bytes you never want more than 32 byte alignment. > If cache lines are 256 bytes you don't even need that. We do want that, even if cache lines are 256 bytes, thank you. > > Also ISTR that the kmalloc() only guarantees 8 byte alignment on x86_64. > So aligning structure members to larger offsets is rather pointless. No it is not, we use these hints all the time. Just double check and report a bug to mm teams if you disagree. Please do not send feedback if you are not sure.