On Mon, 2011-08-15 at 00:48 -0500, Jonathan Nieder wrote: > Hi, > > Jonathan Nieder wrote: > > > I wonder how this should be dealt with wrt squeeze. > > For your amusement, here's an ugly proof-of-concept patch (against > 2.6.32.y) that just does unaligned reads from struct taskstats. The > only redeeming feature is that it doesn't break ABI. I'd be curious > to hear whether it works and the effect on performance. > > If it were to make sense to actually apply something like this, it > would only be on 64-bit arches that do not have efficient unaligned > access.
get_unaligned() and put_unaligned() will be 'free' on the architectures
that do have efficient unaligned access; i.e. the compiler should expand
the various inline functions and macros to a simple load or store
instruction. So these functions should be sufficient:
static inline u64 get_misaligned_64(const u64 *ptr)
{
if (sizeof(long) == 8)
return get_unaligned(ptr);
else
return *ptr;
}
static inline void put_misaligned_64(u64 value, u64 *ptr)
{
if (sizeof(long) == 8)
put_unaligned(value, ptr);
else
*ptr = value;
}
Ben.
signature.asc
Description: This is a digitally signed message part

