Re: [PATCH] wait_on_bit: add an acquire memory barrier
From: Linus Torvalds
Date: Mon Aug 22 2022 - 13:10:19 EST
On Mon, Aug 22, 2022 at 2:39 AM Mikulas Patocka <mpatocka@xxxxxxxxxx> wrote:
>
> I'd like to ask what do you think about this patch?
I really don't like it. It adds a pointless read barrier only because
you didn't want to do it properly.
On x86, it doesn't matter, since rmb is a no-op and only a scheduling
barrier (and not noticeable in this case anyway).
On other architectures, it might.
But on all architectures it's just ugly.
I suggested in an earlier thread that you just do it right with an
explicit smp_load_acquire() and a manual bit test.
So why don't we just create a "test_bit_acquire()" and be done with
it? We literally created clear_bit_unlock() for the opposite reason,
and your comments about the new barrier hack even point to it.
Why is "clear_bit_unlock()" worthy of a real helper, but
"test_bit_acquire()" is not and people who want it have to use this
horrendous hack?
Please stop adding random barriers already. Just do it right. I've
said this before, why do you then keep doing this and asking for
comments?
My reply will remain the same: JUST DO IT RIGHT.
Linus