From: Philip Craig <philipc@snapgear.com>
To: David Miller <davem@davemloft.net>
Cc: kaber@trash.net, netfilter-devel@vger.kernel.org, rmk@arm.linux.org.uk
Subject: Re: [NETFILTER 42/69]: nf_conntrack: optimize hash_conntrack()
Date: Tue, 29 Apr 2008 16:50:56 +1000 [thread overview]
Message-ID: <4816C550.6080602@snapgear.com> (raw)
In-Reply-To: <20080428.231414.193695218.davem@davemloft.net>
David Miller wrote:
>> eg what does it do for this:
>> struct t {
>> struct s {
>> u16 a;
>> u16 b;
>> } __attribute__(packed);
>> };
>
> 'a' and 'b' cannot be assumed to be aligned in any particular way,
> and thus byte-at-a-time accesses will be made to them.
Does it ever do anything besides byte access for words on sparc?
Here's my results on ARM, which show that including the packed
struct in another struct allows gcc to assume alignment.
I'm not saying this results in pretty code though :-)
typedef unsigned short u16;
typedef unsigned long u32;
static struct a {
struct {
u32 w;
u16 x;
} m;
u16 y;
u32 z;
} a;
static struct b {
struct {
u32 w;
u16 x;
} __attribute__ ((packed)) m;
u16 y;
u32 z;
} b;
static struct c {
struct {
u32 w;
u16 x;
} __attribute__ ((packed)) m;
u16 y;
u32 z;
} __attribute__ ((packed)) c;
u32 aw(struct a *p)
{
return p->m.w;
}
u16 ax(struct a *p)
{
return p->m.x;
}
u16 ay(struct a *p)
{
return p->y;
}
u32 az(struct a *p)
{
return p->z;
}
u32 bw(struct b *p)
{
return p->m.w;
}
u16 bx(struct b *p)
{
return p->m.x;
}
u16 by(struct b *p)
{
return p->y;
}
u32 bz(struct b *p)
{
return p->z;
}
u32 cw(struct c *p)
{
return p->m.w;
}
u16 cx(struct c *p)
{
return p->m.x;
}
u16 cy(struct c *p)
{
return p->y;
}
u32 cz(struct c *p)
{
return p->z;
}
00000000 <aw>:
0: e5900000 ldr r0, [r0]
4: e1a0f00e mov pc, lr
00000008 <ax>:
8: e5d03005 ldrb r3, [r0, #5]
c: e5d00004 ldrb r0, [r0, #4]
10: e1800403 orr r0, r0, r3, lsl #8
14: e1a0f00e mov pc, lr
00000018 <ay>:
18: e5d03009 ldrb r3, [r0, #9]
1c: e5d00008 ldrb r0, [r0, #8]
20: e1800403 orr r0, r0, r3, lsl #8
24: e1a0f00e mov pc, lr
00000028 <az>:
28: e590000c ldr r0, [r0, #12]
2c: e1a0f00e mov pc, lr
00000030 <bw>:
30: e5900000 ldr r0, [r0]
34: e1a0f00e mov pc, lr
00000038 <bx>:
38: e5d03005 ldrb r3, [r0, #5]
3c: e5d00004 ldrb r0, [r0, #4]
40: e1800403 orr r0, r0, r3, lsl #8
44: e1a0f00e mov pc, lr
00000048 <by>:
48: e5d03007 ldrb r3, [r0, #7]
4c: e5d00006 ldrb r0, [r0, #6]
50: e1800403 orr r0, r0, r3, lsl #8
54: e1a0f00e mov pc, lr
00000058 <bz>:
58: e5900008 ldr r0, [r0, #8]
5c: e1a0f00e mov pc, lr
00000060 <cw>:
60: e5d03000 ldrb r3, [r0]
64: e5d02001 ldrb r2, [r0, #1]
68: e5d01002 ldrb r1, [r0, #2]
6c: e1833402 orr r3, r3, r2, lsl #8
70: e5d00003 ldrb r0, [r0, #3]
74: e1833801 orr r3, r3, r1, lsl #16
78: e1830c00 orr r0, r3, r0, lsl #24
7c: e1a0f00e mov pc, lr
00000080 <cx>:
80: e5d03005 ldrb r3, [r0, #5]
84: e5d00004 ldrb r0, [r0, #4]
88: e1800403 orr r0, r0, r3, lsl #8
8c: e1a0f00e mov pc, lr
00000090 <cy>:
90: e5d03007 ldrb r3, [r0, #7]
94: e5d00006 ldrb r0, [r0, #6]
98: e1800403 orr r0, r0, r3, lsl #8
9c: e1a0f00e mov pc, lr
000000a0 <cz>:
a0: e5d03008 ldrb r3, [r0, #8]
a4: e5d02009 ldrb r2, [r0, #9]
a8: e5d0100a ldrb r1, [r0, #10]
ac: e1833402 orr r3, r3, r2, lsl #8
b0: e5d0000b ldrb r0, [r0, #11]
b4: e1833801 orr r3, r3, r1, lsl #16
b8: e1830c00 orr r0, r3, r0, lsl #24
bc: e1a0f00e mov pc, lr
next prev parent reply other threads:[~2008-04-29 6:50 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-30 20:16 [NETFILTER 00/69]: Netfilter Update Patrick McHardy
2008-01-30 20:16 ` [NETFILTER 01/69]: Supress some sparse warnings Patrick McHardy
2008-01-30 20:16 ` [NETFILTER 02/69]: Use const in struct xt_match, xt_target, xt_table Patrick McHardy
2008-01-30 20:16 ` linux/types.h: Use __u64 for aligned_u64 Patrick McHardy
2008-01-30 20:16 ` [NETFILTER 04/69]: nf_nat: remove double bysource hash initialization Patrick McHardy
2008-01-30 20:16 ` [NETFILTER 05/69]: bridge netfilter: remove nf_bridge_info read-only netoutdev member Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 06/69]: nfnetlink_log: fix typo Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 07/69]: xt_conntrack: add port and direction matching Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 08/69]: nf_log: add netfilter gcc printf format checking Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 09/69]: ebtables: remove casts, use consts Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 10/69]: ebtables: Update modules' descriptions Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 11/69]: ebtables: mark matches, targets and watchers __read_mostly Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 12/69]: x_tables: change xt_table_register() return value convention Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 13/69]: x_tables: per-netns xt_tables Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 14/69]: x_tables: return new table from {arp,ip,ip6}t_register_table() Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 15/69]: ip_tables: propagate netns from userspace Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 16/69]: ip_tables: per-netns FILTER, MANGLE, RAW Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 17/69]: ip6_tables: netns preparation Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 18/69]: ip6_tables: per-netns IPv6 FILTER, MANGLE, RAW Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 19/69]: arp_tables: netns preparation Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 20/69]: arp_tables: per-netns arp_tables FILTER Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 21/69]: netns: put table module on netns stop Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 22/69]: xt_TCPMSS: consider reverse route's MTU in clamp-to-pmtu Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 23/69]: xt_owner: allow matching UID/GID ranges Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 24/69]: nf_nat_snmp: sparse warning Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 25/69]: nf_conntrack: sparse warnings Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 26/69]: nfnetlink_log: sparse warning fixes Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 27/69]: conntrack: get rid of sparse warnings Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 28/69]: more sparse fixes Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 29/69]: nf_conntrack_h3223: " Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 30/69]: ipt_recent: fix sparse warnings Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 31/69]: {ip,arp,ip6}_tables: fix sparse warnings in compat code Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 32/69]: nf_conntrack_ipv6: fix sparse warnings Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 33/69]: nf_conntrack_netlink: fix unbalanced locking Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 34/69]: nf_conntrack: fix accounting with fixed timeouts Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 35/69]: nf_conntrack: use RCU for conntrack helpers Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 36/69]: nf_conntrack_core: avoid taking nf_conntrack_lock in nf_conntrack_alter_reply Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 37/69]: nf_conntrack_expect: use RCU for expectation hash Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 38/69]: nf_conntrack: use RCU for conntrack hash Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 39/69]: nf_conntrack: switch rwlock to spinlock Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 40/69]: nf_conntrack: optimize __nf_conntrack_find() Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 41/69]: nf_conntrack: avoid duplicate protocol comparison in nf_ct_tuple_equal() Patrick McHardy
2008-01-30 20:17 ` [NETFILTER 42/69]: nf_conntrack: optimize hash_conntrack() Patrick McHardy
2008-04-28 8:24 ` Philip Craig
2008-04-28 13:59 ` Patrick McHardy
2008-04-29 4:48 ` Philip Craig
2008-04-29 5:44 ` David Miller
2008-04-29 6:00 ` Philip Craig
2008-04-29 6:14 ` David Miller
2008-04-29 6:50 ` Philip Craig [this message]
2008-04-29 6:56 ` David Miller
2008-04-29 7:00 ` Philip Craig
2008-04-29 5:44 ` Philip Craig
2008-04-29 5:54 ` Patrick McHardy
2008-04-29 8:40 ` Philip Craig
2008-04-29 10:20 ` David Miller
2008-04-29 10:22 ` Patrick McHardy
2008-04-29 10:35 ` David Miller
2008-01-30 20:18 ` [NETFILTER 43/69]: nf_conntrack: reorder struct nf_conntrack_l4proto Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 44/69]: nf_conntrack: don't inline early_drop() Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 45/69]: nf_conntrack: naming unification Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 46/69]: nf_nat: use RCU for bysource hash Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 47/69]: nf_nat: switch rwlock to spinlock Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 48/69]: nf_conntrack_h323: clean up code a bit Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 49/69]: nf_conntrack_netlink: transmit mark during all events Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 50/69]: ipt_CLUSTERIP: kill clusterip_config_entry_get Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 51/69]: nf_conntrack: kill unused static inline (do_iter) Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 52/69]: xt_hashlimit match, revision 1 Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 53/69]: x_tables: semi-rewrite of /proc/net/foo_tables_* Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 54/69]: x_tables: netns propagation for /proc/net/*_tables_names Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 55/69]: x_tables: create per-netns /proc/net/*_tables_* Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 56/69]: nf_conntrack_h323: constify and annotate H.323 helper Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 57/69]: nf_{conntrack,nat}_sip: annotate SIP helper with const Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 58/69]: nf_{conntrack,nat}_tftp: annotate TFTP " Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 59/69]: nf_{conntrack,nat}_pptp: annotate PPtP " Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 60/69]: nf_conntrack_sane: annotate SANE " Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 61/69]: nf_{conntrack,nat}_proto_tcp: constify and annotate TCP modules Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 62/69]: nf_{conntrack,nat}_proto_udp{,lite}: annotate with const Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 63/69]: nf_{conntrack,nat}_proto_gre: " Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 64/69]: nf_{conntrack,nat}_icmp: constify and annotate Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 65/69]: nf_conntrack: annotate l3protos with const Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 66/69]: {ip,ip6}_queue: fix build error Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 67/69]: nf_conntrack: fix sparse warning Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 68/69]: nf_nat: " Patrick McHardy
2008-01-30 20:18 ` [NETFILTER 69/69]: xt_iprange: fix sparse warnings Patrick McHardy
2008-01-30 20:20 ` [NETFILTER 00/69]: Netfilter Update Jan Engelhardt
2008-01-30 20:22 ` Patrick McHardy
2008-01-30 20:26 ` Jan Engelhardt
2008-01-30 20:55 ` Jan Engelhardt
2008-01-30 21:27 ` Patrick McHardy
2008-01-30 21:30 ` Jan Engelhardt
2008-01-30 21:31 ` Patrick McHardy
2008-01-30 21:34 ` Patrick McHardy
2008-01-31 0:54 ` David Miller
2008-01-31 12:56 ` 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=4816C550.6080602@snapgear.com \
--to=philipc@snapgear.com \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.