From: Alexey Dobriyan <adobriyan@gmail.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Alexey Dobriyan <adobriyan@gmail.com>
Subject: [PATCH 3/3] net: dst: make dst->obsolete 8-bit
Date: Thu, 7 Dec 2017 00:35:05 +0300 [thread overview]
Message-ID: <20171206213505.17018-3-adobriyan@gmail.com> (raw)
In-Reply-To: <20171206213505.17018-1-adobriyan@gmail.com>
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 <adobriyan@gmail.com>
---
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
next prev parent reply other threads:[~2017-12-06 21:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 21:35 [PATCH 1/3] net: dst: add and use dst_flags_t Alexey Dobriyan
2017-12-06 21:35 ` [PATCH 2/3] net: dst: switch to 8-bit dst->flags Alexey Dobriyan
2017-12-06 21:35 ` Alexey Dobriyan [this message]
2017-12-06 21:39 ` [PATCH 1/3] net: dst: add and use dst_flags_t David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171206213505.17018-3-adobriyan@gmail.com \
--to=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).