mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Unaligend accesses nulldevname
@ 2004-01-07 23:00 Kurt Garloff
  2004-01-11 10:01 ` Harald Welte
  0 siblings, 1 reply; 2+ messages in thread
From: Kurt Garloff @ 2004-01-07 23:00 UTC (permalink / raw)
  To: Linux kernel list, netfilter-devel


[-- Attachment #1.1: Type: text/plain, Size: 1122 bytes --]

Hi,

I found an excessive amount of unaligned accesses on my AXP workstation
and tracked it down to ip_packet_match() in the ip_tables module.
indev and outdev are not properly aligned if set to nulldevname in
ipt_do_table().
This destroys the benefits of comparing names in units of (long) and
on architectures with expensive unaligned accesses (such as ia64 or
alpha), it even hurts a lot.

Find attached a patch against 2.6.0. A similar patch is needed for 2.4,
also attached.

Please consider merging them.

Looking at ip_packet_match(), I have two more thoughts:
* It should not be inlined. It's too large to benefit from inlining,
  IMHO. (OTOH, it's only called from one place, so it does not
  really matter.)
* There's a comment about the compiler being able to unroll the 2/4
  (64/32bit) iter loop which is not completely appropriate: We don't
  pass -funroll-loops, so gcc does not do it :-(
  It would be beneficial though.

Regards,
-- 
Kurt Garloff  <garloff@suse.de>                            Cologne, DE 
SUSE LINUX AG, Nuernberg, DE                          SUSE Labs (Head)

[-- Attachment #1.2: iptables-nulldevname-unaligned26.diff --]
[-- Type: text/plain, Size: 445 bytes --]

--- linux-2.6.0.ix86/net/ipv4/netfilter/ip_tables.c.orig	2003-12-18 03:58:28.000000000 +0100
+++ linux-2.6.0.ix86/net/ipv4/netfilter/ip_tables.c	2004-01-07 23:49:29.000000000 +0100
@@ -260,7 +260,7 @@
 	     struct ipt_table *table,
 	     void *userdata)
 {
-	static const char nulldevname[IFNAMSIZ];
+	static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long))));
 	u_int16_t offset;
 	struct iphdr *ip;
 	u_int16_t datalen;

[-- Attachment #1.3: iptables-nulldevname-unaligned24.diff --]
[-- Type: text/plain, Size: 449 bytes --]

--- linux-2.4.19/net/ipv4/netfilter/ip_tables.c	2002-02-25 20:38:14.000000000 +0100
+++ linux-2.4.19.AXP/net/ipv4/netfilter/ip_tables.c	2004-01-09 01:55:01.000000000 +0100
@@ -259,7 +264,7 @@
 	     struct ipt_table *table,
 	     void *userdata)
 {
-	static const char nulldevname[IFNAMSIZ] = { 0 };
+	static const char nulldevname[IFNAMSIZ] __attribute__((aligned(sizeof(long)))) = { 0 };
 	u_int16_t offset;
 	struct iphdr *ip;
 	void *protohdr;

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-11 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-07 23:00 [PATCH] Unaligend accesses nulldevname Kurt Garloff
2004-01-11 10:01 ` Harald Welte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®