Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1430850

RE: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls for FETCH-OP flavors

From KY Srinivasan <kys@microsoft.com>
Newsgroups linux.kernel
Subject RE: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls for FETCH-OP flavors
Date 2016-06-24 20:10 +0200
Message-ID <rNDIe-3c2-13@gated-at.bofh.it> (permalink)
References <rMdG9-4no-3@gated-at.bofh.it> <rNCsN-28b-7@gated-at.bofh.it> <rNDfb-2Hg-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



> -----Original Message-----
> From: Davidlohr Bueso [mailto:dave@stgolabs.net]
> Sent: Friday, June 24, 2016 10:30 AM
> To: James Bottomley <James.Bottomley@HansenPartnership.com>
> Cc: peterz@infradead.org; mingo@kernel.org; davem@davemloft.net;
> cw00.choi@samsung.com; dougthompson@xmission.com; bp@alien8.de;
> mchehab@osg.samsung.com; gregkh@linuxfoundation.org; pfg@sgi.com;
> jikos@kernel.org; hans.verkuil@cisco.com; awalls@md.metrocast.net;
> dledford@redhat.com; sean.hefty@intel.com; KY Srinivasan
> <kys@microsoft.com>; heiko.carstens@de.ibm.com;
> sumit.semwal@linaro.org; schwidefsky@de.ibm.com; linux-
> kernel@vger.kernel.org
> Subject: Re: [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
How so? Can you expand on the racy part. The subtraction is done on a local copy of
the value.

K. Y

> 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://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2flkml.org%
> 2flkml%2f2016%2f3%2f15%2f352&data=01%7c01%7ckys%40microsoft.com%
> 7c5c7cfad67568440f6e2108d39c5546e0%7c72f988bf86f141af91ab2d7cd011
> db47%7c1&sdata=uZrdmvDCuTp%2bMNHAXzMPT68w%2bVGtvH2V99nUEBr6
> 1ro%3d.
> 
> Thanks,
> Davidlohr

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls  for FETCH-OP flavors James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-06-24 18:50 +0200
  Re: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls  for FETCH-OP flavors Davidlohr Bueso <dave@stgolabs.net> - 2016-06-24 19:40 +0200
    Re: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls  for FETCH-OP flavors James Bottomley <James.Bottomley@HansenPartnership.com> - 2016-06-24 19:50 +0200
      Re: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls  for FETCH-OP flavors Davidlohr Bueso <dave@stgolabs.net> - 2016-06-24 22:40 +0200
    RE: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls for  FETCH-OP flavors KY Srinivasan <kys@microsoft.com> - 2016-06-24 20:10 +0200
      Re: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls  for FETCH-OP flavors Davidlohr Bueso <dave@stgolabs.net> - 2016-06-24 21:40 +0200
  Re: [PATCH -tip 00/12] locking/atomics: Add and use inc,dec calls  for FETCH-OP flavors Peter Zijlstra <peterz@infradead.org> - 2016-06-24 21:20 +0200

csiph-web