lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 31 Jan 2017 21:55:08 +0100 (CET)
From:   Fabian Frederick <fabf@...net.be>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/14] locking/atomic: import atomic_dec_not_zero()



> On 31 January 2017 at 20:17 Peter Zijlstra <peterz@...radead.org> wrote:
>
>
> On Tue, Jan 31, 2017 at 06:41:28PM +0100, Fabian Frederick wrote:
> >
> >
> > > On 31 January 2017 at 11:41 Peter Zijlstra <peterz@...radead.org> wrote:
> > >
> > >
> > > On Mon, Jan 30, 2017 at 07:39:38PM +0100, Fabian Frederick wrote:
> > > > complementary definition to atomic_inc_not_zero() featured in
> > > > lib/fault-inject.c
> > >
> > > Why?
> >
> > Maybe this commit message should be ok ?
> >
> > complementary definition to atomic_inc_not_zero() featured in
> > lib/fault-inject.c
> > and is more readable than atomic_add_unless((v), -1, 0) used in different
> > places.
>
> I still don't see why such a primitive makes sense. Yes there's a few
> usage sites, but from them I don't see a sensible pattern.
>
> What sane pattern desires this?

Once again it's just about readability:

"add -1 unless value is zero" looks more complex in code than "dec not zero"
but maybe it's just a matter of taste :) It it's not the case why would there be
more sense about having
atomic_inc_not_zero() globally ?

Regards,
Fabian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ