On Sun, Jul 31, 2022 at 1:43 PM Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote: > > + > +static __always_inline int buffer_locked(const struct buffer_head *bh) > +{ > + unsigned long state = smp_load_acquire(&bh->b_state); > + return test_bit(BH_Lock, &state); This should not use 'test_bit()'. I suspect that generates horrendous code, because it's a volatile access, so now you'll load it into a register, and I suspect it will generate s pointless spill just to do a volatile load. I didn't check. So once you've loaded b_state, just test the bit directly with return (state & (1u << BH_Lock)) != 0; or whatever. Linus