From: Eric Dumazet Subject: Re: [PATCH net-next] neighbor: Add protocol attribute Date: Fri, 7 Dec 2018 15:03:04 -0800 Message-ID: References: <20181207214952.11105-1-dsahern@kernel.org> <8c071e1e-0211-5e7b-a150-a5e942d8da96@gmail.com> <0e223b2f-0677-2450-c75d-1ce18a6c017b@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: davem@davemloft.net, roopa@cumulusnetworks.com To: David Ahern , Eric Dumazet , David Ahern , netdev@vger.kernel.org Return-path: Received: from mail-pl1-f195.google.com ([209.85.214.195]:37818 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726041AbeLGXDJ (ORCPT ); Fri, 7 Dec 2018 18:03:09 -0500 Received: by mail-pl1-f195.google.com with SMTP id b5so2470242plr.4 for ; Fri, 07 Dec 2018 15:03:09 -0800 (PST) In-Reply-To: <0e223b2f-0677-2450-c75d-1ce18a6c017b@gmail.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 12/07/2018 02:24 PM, David Ahern wrote: > On 12/7/18 3:20 PM, Eric Dumazet wrote: >> >> >> On 12/07/2018 01:49 PM, David Ahern wrote: >>> From: David Ahern >>> >>> Similar to routes and rules, add protocol attribute to neighbor entries >>> for easier tracking of how each was created. >>> >>> Signed-off-by: David Ahern >>> --- >>> include/net/neighbour.h | 2 ++ >>> include/uapi/linux/neighbour.h | 1 + >>> net/core/neighbour.c | 24 +++++++++++++++++++++++- >>> 3 files changed, 26 insertions(+), 1 deletion(-) >>> >>> diff --git a/include/net/neighbour.h b/include/net/neighbour.h >>> index 6c13072910ab..e93c59df9501 100644 >>> --- a/include/net/neighbour.h >>> +++ b/include/net/neighbour.h >>> @@ -149,6 +149,7 @@ struct neighbour { >>> __u8 nud_state; >>> __u8 type; >>> __u8 dead; >>> + u8 protocol; >>> seqlock_t ha_lock; >>> unsigned char ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; >> >> This looks like ha[] alignment would change, I am not sure how critical it is. > > Just adds 4 bytes to neighbour: > > ... > /* --- cacheline 2 boundary (128 bytes) --- */ > long unsigned int used; /* 128 8 */ > atomic_t probes; /* 136 4 */ > __u8 flags; /* 140 1 */ > __u8 nud_state; /* 141 1 */ > __u8 type; /* 142 1 */ > __u8 dead; /* 143 1 */ > u8 protocol; /* 144 1 */ > > /* XXX 3 bytes hole, try to pack */ > seqlock_t ha_lock; /* 148 8 */ > unsigned char ha[32]; /* 156 32 */ > /* XXX 4 bytes hole, try to pack */ > > /* --- cacheline 3 boundary (192 bytes) --- */ > struct hh_cache hh; /* 192 48 */ > > ... > > but does not change the actual allocation size which is rounded to 512. > I have not talked about the allocation size, but alignment of ->ha field, which is kind of assuming long alignment, in a strange way. As I said, I do not know how performance critical this might be.