diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-11-27 14:58:59 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:30:48 -0500 |
commit | 46ca5f5dc4f1c9b5ac02c0090ae8ff4ac8560446 (patch) | |
tree | 314b4ec3bfb52d536dff6e9cb201b76571e0d502 /include | |
parent | d5c42c0ec4f7fd5a4e19e33a2d561758b67c55c8 (diff) |
[XFRM]: Pack struct xfrm_policy
[acme@newtoy net-2.6.20]$ pahole net/ipv4/tcp.o xfrm_policy
/* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/linux/security.h:67 */
struct xfrm_policy {
struct xfrm_policy * next; /* 0 4 */
struct hlist_node bydst; /* 4 8 */
struct hlist_node byidx; /* 12 8 */
rwlock_t lock; /* 20 36 */
atomic_t refcnt; /* 56 4 */
struct timer_list timer; /* 60 24 */
u8 type; /* 84 1 */
/* XXX 3 bytes hole, try to pack */
u32 priority; /* 88 4 */
u32 index; /* 92 4 */
struct xfrm_selector selector; /* 96 56 */
struct xfrm_lifetime_cfg lft; /* 152 64 */
struct xfrm_lifetime_cur curlft; /* 216 32 */
struct dst_entry * bundles; /* 248 4 */
__u16 family; /* 252 2 */
__u8 action; /* 254 1 */
__u8 flags; /* 255 1 */
__u8 dead; /* 256 1 */
__u8 xfrm_nr; /* 257 1 */
/* XXX 2 bytes hole, try to pack */
struct xfrm_sec_ctx * security; /* 260 4 */
struct xfrm_tmpl xfrm_vec[6]; /* 264 360 */
}; /* size: 624, sum members: 619, holes: 2, sum holes: 5 */
So lets have just one hole instead of two, by moving 'type' to just before 'action',
end result:
[acme@newtoy net-2.6.20]$ codiff -s /tmp/tcp.o.before net/ipv4/tcp.o
/pub/scm/linux/kernel/git/acme/net-2.6.20/net/ipv4/tcp.c:
struct xfrm_policy | -4
1 struct changed
[acme@newtoy net-2.6.20]$
[acme@newtoy net-2.6.20]$ pahole -c 64 net/ipv4/tcp.o xfrm_policy
/* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/linux/security.h:67 */
struct xfrm_policy {
struct xfrm_policy * next; /* 0 4 */
struct hlist_node bydst; /* 4 8 */
struct hlist_node byidx; /* 12 8 */
rwlock_t lock; /* 20 36 */
atomic_t refcnt; /* 56 4 */
struct timer_list timer; /* 60 24 */
u32 priority; /* 84 4 */
u32 index; /* 88 4 */
struct xfrm_selector selector; /* 92 56 */
struct xfrm_lifetime_cfg lft; /* 148 64 */
struct xfrm_lifetime_cur curlft; /* 212 32 */
struct dst_entry * bundles; /* 244 4 */
u16 family; /* 248 2 */
u8 type; /* 250 1 */
u8 action; /* 251 1 */
u8 flags; /* 252 1 */
u8 dead; /* 253 1 */
u8 xfrm_nr; /* 254 1 */
/* XXX 1 byte hole, try to pack */
struct xfrm_sec_ctx * security; /* 256 4 */
struct xfrm_tmpl xfrm_vec[6]; /* 260 360 */
}; /* size: 620, sum members: 619, holes: 1, sum holes: 1 */
Are there any fugly data dependencies here? None that I know.
In the process changed the removed the __ prefixed types, that are just for
userspace visible headers.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/xfrm.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 3878a88ff618..984e5c45265c 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -340,18 +340,19 @@ struct xfrm_policy | |||
340 | atomic_t refcnt; | 340 | atomic_t refcnt; |
341 | struct timer_list timer; | 341 | struct timer_list timer; |
342 | 342 | ||
343 | u8 type; | ||
344 | u32 priority; | 343 | u32 priority; |
345 | u32 index; | 344 | u32 index; |
346 | struct xfrm_selector selector; | 345 | struct xfrm_selector selector; |
347 | struct xfrm_lifetime_cfg lft; | 346 | struct xfrm_lifetime_cfg lft; |
348 | struct xfrm_lifetime_cur curlft; | 347 | struct xfrm_lifetime_cur curlft; |
349 | struct dst_entry *bundles; | 348 | struct dst_entry *bundles; |
350 | __u16 family; | 349 | u16 family; |
351 | __u8 action; | 350 | u8 type; |
352 | __u8 flags; | 351 | u8 action; |
353 | __u8 dead; | 352 | u8 flags; |
354 | __u8 xfrm_nr; | 353 | u8 dead; |
354 | u8 xfrm_nr; | ||
355 | /* XXX 1 byte hole, try to pack */ | ||
355 | struct xfrm_sec_ctx *security; | 356 | struct xfrm_sec_ctx *security; |
356 | struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; | 357 | struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; |
357 | }; | 358 | }; |