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]
Message-ID: <20171003160610.GA32309@bombadil.infradead.org>
Date:   Tue, 3 Oct 2017 09:06:11 -0700
From:   Matthew Wilcox <willy@...radead.org>
To:     Jens Axboe <axboe@...nel.dk>
Cc:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        Johannes Weiner <hannes@...xchg.org>, Jan Kara <jack@...e.cz>
Subject: Re: [PATCH 10/12] writeback: only allow one inflight and pending
 full flush

On Fri, Sep 29, 2017 at 02:17:32AM +0200, Jens Axboe wrote:
> On 09/28/2017 11:44 PM, Linus Torvalds wrote:
> > On Thu, Sep 28, 2017 at 2:41 PM, Andrew Morton
> > <akpm@...ux-foundation.org> wrote:
> >>
> >> test_and_set_bit()?
> > 
> > If there aren't any atomicity concerns (either because of higher-level
> > locking, or because racing and having two people set the bit is fine),
> > it can be better to do them separately if the test_bit() is the common
> > case and you can avoid dirtying a cacheline that way.
> > 
> > But yeah, if that is the case, it might be worth documenting, because
> > test_and_set_bit() is the more obviously appropriate "there can be
> > only one" model.
> 
> It is documented though, but maybe not well enough...
> 
> I've actually had to document/explain it enough times now, that it
> might be worth making a general construct. Though it has to be
> used carefully, so perhaps it's better contained as separate use
> cases.

test_and_test_and_set_bit()?  It's an unusual name, so when either
reading it or writing it, people are going to say "something unusual
here", rather than "That Jens Axboe is such a n00b, he doesn't know how
to use test_and_set_bit()".  There are a few references out on the web
to test-and-test-and-set already, so it's not entirely unique to Linux.

Plus, some architectures might be able to optimise that, particularly
those which are ll/sc based.  It might be exactly the same as their
test_and_set().

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ