[PATCH] introduce HAVE_EFFICIENT_UNALIGNED_ACCESS Kconfig symbol

Previous thread: pull request: wireless-next-2.6 2008-05-07 by John W. Linville on Wednesday, May 7, 2008 - 4:30 pm. (2 messages)

Next thread: Re: NIU - Sun Neptune 10g - Transmit timed out reset (2.6.24) by David Miller on Wednesday, May 7, 2008 - 5:15 pm. (52 messages)
To: Andrew Morton <akpm@...>
Cc: <linux-arch@...>, netdev <netdev@...>, Linux Kernel list <linux-kernel@...>, Ingo Molnar <mingo@...>, Sam Ravnborg <sam@...>
Date: Wednesday, May 7, 2008 - 5:05 pm

In many cases, especially in networking, it can be beneficial to
know at compile time whether the architecture can do unaligned
accesses efficiently. This patch introduces a new Kconfig symbol
HAVE_EFFICIENT_UNALIGNED_ACCESS
for that purpose and adds it to the powerpc and x86 architectures.
Also add some documentation about alignment and networking, and
especially one intended use of this symbol.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Ingo Molnar <mingo@elte.hu> [x86 architecture part]
---
v5: rename to HAVE_EFFICIENT_UNALIGNED_ACCESS
v6: small text fixes

I have opted to not introduce any symbol associated with the cost
of unaligned accesses, David Woodhouse once suggested that such a
cost should be combined with a probability of (un-)alignment even
in the get_unaligned/put_unaligned macros and I think this should
be combined with a patch introducing a global cost constant.

Also, this would require architecture changes because if some code
knew the likelihood of unaligned accesses was small enough over
the cost of them, architectures that complain in the trap handle
would still complain in that unlikely case although the code
explicitly made a trade-off based on the cost/probability.

I can roll more architectures that want this into this patch, or you can
merge extra patches once this is in, I don't care either way but the
latter might be quicker/easier.

Documentation/unaligned-memory-access.txt | 32 +++++++++++++++++++++++++++---
arch/Kconfig | 19 +++++++++++++++++
arch/powerpc/Kconfig | 1
arch/x86/Kconfig | 1
4 files changed, 50 insertions(+), 3 deletions(-)

--- everything.orig/Documentation/unaligned-memory-access.txt 2008-05-07 21:50:09.000000000 +0200
+++ everything/Documentation/unaligned-memory-access.txt 2008-05-07 21:53:01.000000000 +0200
@@ -218,9 +218,35 @@ If use of such macros i...

Previous thread: pull request: wireless-next-2.6 2008-05-07 by John W. Linville on Wednesday, May 7, 2008 - 4:30 pm. (2 messages)

Next thread: Re: NIU - Sun Neptune 10g - Transmit timed out reset (2.6.24) by David Miller on Wednesday, May 7, 2008 - 5:15 pm. (52 messages)