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:   Wed, 29 Mar 2023 02:49:43 -0700
From:   Luis Chamberlain <mcgrof@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     david@...hat.com, patches@...ts.linux.dev,
        linux-modules@...r.kernel.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, pmladek@...e.com,
        petr.pavlu@...e.com, prarit@...hat.com,
        torvalds@...ux-foundation.org, gregkh@...uxfoundation.org,
        rafael@...nel.org, christophe.leroy@...roup.eu, tglx@...utronix.de,
        song@...nel.org, rppt@...nel.org, willy@...radead.org,
        vbabka@...e.cz, mhocko@...e.com, dave.hansen@...ux.intel.com
Subject: Re: [PATCH 4/7] sempahore: add a helper for a concurrency limiter

On Wed, Mar 29, 2023 at 11:19:35AM +0200, Peter Zijlstra wrote:
> On Wed, Mar 29, 2023 at 12:51:48AM -0700, Luis Chamberlain wrote:
> > On Wed, Mar 29, 2023 at 09:21:12AM +0200, Peter Zijlstra wrote:
> > > On Tue, Mar 28, 2023 at 10:31:46PM -0700, Luis Chamberlain wrote:
> > > > While I looked at re-using the old kernel/kmod.c (now kernel/module/kmod.c)
> > > > concurrency delimiter methodology for another place in the kernel Linus
> > > > noted that this could be simply replaced with a sempahore [0].
> > > > 
> > > > So add that so we we don't re-invent the wheel and make it obvious to use.
> > > > 
> > > > [0] https://lore.kernel.org/all/CAHk-=whkj6=wyi201JXkw9iT_eTUTsSx+Yb9d4OgmZFjDJA18g@mail.gmail.com/
> > > > 
> > > > Suggested-by: Linus Torvalds <torvalds@...ux-foundation.org>
> > > > Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
> > > > ---
> > > >  include/linux/semaphore.h | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/include/linux/semaphore.h b/include/linux/semaphore.h
> > > > index 6694d0019a68..2ecdffdb9814 100644
> > > > --- a/include/linux/semaphore.h
> > > > +++ b/include/linux/semaphore.h
> > > > @@ -28,6 +28,9 @@ struct semaphore {
> > > >  #define DEFINE_SEMAPHORE(name)	\
> > > >  	struct semaphore name = __SEMAPHORE_INITIALIZER(name, 1)
> > > >  
> > > > +#define CONCURRENCY_LIMITER(name, n) \
> > > > +	struct semaphore name = __SEMAPHORE_INITIALIZER(name, n)
> > > > +
> > > 
> > > Why should this live in semaphore.h?
> > 
> > I have no preference, but sharing seems to have been better. Do you
> > have any recommendations?
> 
> Call is DEFINE_SEMAPHORE_N() ?
> 
> Arguably DEFINE_SEMAPHORE() should have the argument, as binary
> semaphores are a special case, but then we gotta go and fix up all
> users.
> 
> /me git-greps a little.. Hmm, not too bad.
> 
> How's this?

Seems OK to me. Either way works. Should I carry a patch from you for this
series?

  Luis

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ