lkml.org 
[lkml]   [2016]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls for FETCH-OP flavors
On Fri, 24 Jun 2016, James Bottomley wrote:

>On Mon, 2016-06-20 at 13:05 -0700, Davidlohr Bueso wrote:
>> Hi,
>>
>> The series is really straightforward and based on Peter's work that
>> introduces[1] the atomic_fetch_$op machinery. Only patch 1 implements
>> the actual atomic_fetch_{inc,dec} calls based on
>> atomic_fetch_{add,sub}.
>
>Could I just ask why? atomic_inc_return(x) - 1 seems a reasonable
>thing to do to me.

For one restoring the old state like that can be racy and looses the notion
of atomicity. The new family of atomic_fetch_$ops also better express the
purpose of the call imo. Finally, the added machinery (considering it came
from fetch_op() NOHZ needs), was mainly suggested by Linus (although yes, we
don't have users for all the calls): https://lkml.org/lkml/2016/3/15/352.

Thanks,
Davidlohr

\
 
 \ /
  Last update: 2016-06-24 20:01    [W:0.260 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site