From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexey Dobriyan Subject: [PATCH 3/3] net: dst: make dst->obsolete 8-bit Date: Thu, 7 Dec 2017 00:35:05 +0300 Message-ID: <20171206213505.17018-3-adobriyan@gmail.com> References: <20171206213505.17018-1-adobriyan@gmail.com> Cc: netdev@vger.kernel.org, Alexey Dobriyan To: davem@davemloft.net Return-path: Received: from mail-wr0-f194.google.com ([209.85.128.194]:33689 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752142AbdLFVfb (ORCPT ); Wed, 6 Dec 2017 16:35:31 -0500 Received: by mail-wr0-f194.google.com with SMTP id v22so5403715wrb.0 for ; Wed, 06 Dec 2017 13:35:31 -0800 (PST) In-Reply-To: <20171206213505.17018-1-adobriyan@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: All values are small integers. Space savings on x86_64: add/remove: 0/0 grow/shrink: 1/34 up/down: 1/-60 (-59) Function old new delta dst_alloc 124 125 +1 xfrm_negative_advice 23 22 -1 xfrm_dst_check 27 26 -1 udp_v6_early_demux 845 844 -1 ... xfrm_resolve_and_create_bundle 2816 2812 -4 dst_dev_put 104 99 -5 xfrm_lookup 2027 2021 -6 update_or_create_fnhe 1339 1329 -10 Signed-off-by: Alexey Dobriyan --- include/net/dst.h | 8 ++++---- net/core/dst.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/net/dst.h b/include/net/dst.h index 25decfa4e14a..77143ee9139c 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -55,7 +55,6 @@ struct dst_entry { #define DST_XFRM_TUNNEL ((dst_flags_t __force)0x20) #define DST_XFRM_QUEUE ((dst_flags_t __force)0x40) #define DST_METADATA ((dst_flags_t __force)0x80) - u8 __pad2; /* A non-zero value of dst->obsolete forces by-hand validation * of the route entry. Positive values are set by the generic @@ -65,11 +64,12 @@ struct dst_entry { * Negative values are used by the implementation layer code to * force invocation of the dst_ops->check() method. */ - short obsolete; + s8 obsolete; #define DST_OBSOLETE_NONE 0 #define DST_OBSOLETE_DEAD 2 #define DST_OBSOLETE_FORCE_CHK -1 #define DST_OBSOLETE_KILL -2 + u16 __pad2; unsigned short header_len; /* more space at head required */ unsigned short trailer_len; /* space to reserve at tail */ @@ -390,9 +390,9 @@ static inline int dst_discard(struct sk_buff *skb) return dst_discard_out(&init_net, skb->sk, skb); } void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref, - int initial_obsolete, dst_flags_t flags); + s8 initial_obsolete, dst_flags_t flags); void dst_init(struct dst_entry *dst, struct dst_ops *ops, - struct net_device *dev, int initial_ref, int initial_obsolete, + struct net_device *dev, int initial_ref, s8 initial_obsolete, dst_flags_t flags); struct dst_entry *dst_destroy(struct dst_entry *dst); void dst_dev_put(struct dst_entry *dst); diff --git a/net/core/dst.c b/net/core/dst.c index d7cce39c3552..dba03bf26da7 100644 --- a/net/core/dst.c +++ b/net/core/dst.c @@ -60,7 +60,7 @@ const struct dst_metrics dst_default_metrics = { }; void dst_init(struct dst_entry *dst, struct dst_ops *ops, - struct net_device *dev, int initial_ref, int initial_obsolete, + struct net_device *dev, int initial_ref, s8 initial_obsolete, dst_flags_t flags) { dst->dev = dev; @@ -92,7 +92,7 @@ void dst_init(struct dst_entry *dst, struct dst_ops *ops, EXPORT_SYMBOL(dst_init); void *dst_alloc(struct dst_ops *ops, struct net_device *dev, - int initial_ref, int initial_obsolete, dst_flags_t flags) + int initial_ref, s8 initial_obsolete, dst_flags_t flags) { struct dst_entry *dst; -- 2.13.6