Jeff Mahoney <jeffm@suse.com> writes:
> I did kick around the idea of making those macros the default accessors for
> the deh_state member (which is the only place they're used), but it unfairly
> penalizes arches that don't need them.
On archs that don't need them {get,put}_unaligned should be just normal
assignments. They are certainly on i386.
I can also almost guarentee you that the x86 will sometimes not
execute these bitops atomically on SMP.
We had some obscure bug on SMP/x86 years ago, and Linus discovered
that removing an unaligned spinlock or bitop made the problem go away.
Reiserfs is broken and needs to be fixed.
If you make the unaligned accessors there the default for everyone,
you solve the problem _AND_ there is no penalization. Look at what
the compiler makes of the code generated, it is going to be almost
entirely identical. The compiler should be able to compute it all
via constants. If not, oh you get 1 or 2 instructions here or
there, and that is MINISCULE compared to the cost of the atomic
operation itself.
What's more, you will have less QA'ing to do, since this code will
always be in use and thus tested.
FACT: Doing bitops on something not "long" aligned is a bug and
will always be a bug. You must fix it.
Later,
David S. Miller
davem@redhat.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/