Re: [PATCH 09/17] m68k: Implement xor_unlock_is_negative_byte

From: Matthew Wilcox
Date: Tue Sep 19 2023 - 11:47:35 EST


On Tue, Sep 19, 2023 at 03:22:25PM +0000, David Laight wrote:
> > Anyway, that's not the brief. We're looking to (eg) clear bit 0
> > and test whether bit 7 was set. So it's the sign bit of the byte,
> > not the sign bit of the int.
>
> Use the address of the byte as an int and xor with 1u<<24.
> The xor will do a rmw on the three bytes following, but I
> doubt that matters.

Bet you a shiny penny that Coldfire takes an unaligned access trap ...
and besides, this is done on _every_ call to unlock_page(). That might
cross not only a cacheline boundary but also a page boundary. I cannot
believe that would be a high-performing solution. It might be just fine
on m68000 but I bet even by the 030 it's lower performing.