[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFw7C3XYzwZ8F31EA4Svj1WZ8O--HV82qVg3t=JpxRy1Ww@mail.gmail.com>
Date: Fri, 2 Mar 2012 16:24:11 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: david@...g.hm
Cc: "Ted Ts'o" <tytso@....edu>, Andi Kleen <andi@...stfloor.org>,
"H. Peter Anvin" <hpa@...or.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: Word-at-a-time dcache name accesses (was Re: .. anybody know of
any filesystems that depend on the exact VFS 'namehash' implementation?)
On Fri, Mar 2, 2012 at 4:17 PM, <david@...g.hm> wrote:
>
> or did some CPUs have efficient char access, but inefficient unaligned word
> access?
Tons of CPU's have efficient char accesses but horrible unaligned word
accesses. Some are even outright buggy (ie at least some ARM cores)
and load crap. Others take a fault.
They just aren't x86, because x86 has traditionally had code with a
fair amount of unaligned loads and stores (and not just for historical
reasons either: even modern code replaces constant-sized memcpy() etc
with direct loads and stores)
For some other architectures, we could just use "get_unaligned()",
which fixes things up for them. I could have made that explicit, even
if it doesn't matter on x86.
So the bigger portability problem to some degree is the fact that it
is limited to little-endian, so even if you have a CPU with good
unaligned accesses (some POWER chips do ok, for example, although not
all), you'd have to also do something with the mask generation (which
currently uses the "(x-1)&~x" trick that means that it generates the
mask of the *low bits* - and then assumes that "low bits" means "first
bytes" - ie little endian).
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists