2017-10-24 13:51:14

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] buffer: Avoid setting buffer bits that are already set

On 10/23/2017 07:25 PM, kemi wrote:
>
>
> On 2017年10月24日 09:21, Andi Kleen wrote:
>> kemi <[email protected]> writes:
>>>
>>> I'll see if I can find some
>>>> time to implement the above in a nice way.
>>>
>>> Agree. Maybe something like test_and_set_bit() would be more suitable.
>>
>> test_and_set_bit is a very different operation for the CPU because
>> it is atomic for both. But we want the initial read to not
>> be atomic.
>>
>
> I meant to express the meaning of test before setting bit.
> Apologize to make you confused.

That's why I suggested something like set_bit_if_not_set(),
test_and_set_bit() is both already used and has entirely
different semantics.

--
Jens Axboe


From 1582100376205892851@xxx Tue Oct 24 01:28:14 +0000 2017
X-GM-THRID: 1582062716863867471
X-Gmail-Labels: Inbox,Category Forums