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


Groups > linux.kernel > #1502416

Re: [PATCH 0/8] infiniband: Remove semaphores

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH 0/8] infiniband: Remove semaphores
Date 2016-10-17 22:10 +0200
Message-ID <stmop-8jb-1@gated-at.bofh.it> (permalink)
References <stj7b-5TV-3@gated-at.bofh.it> <stmop-8jb-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Monday, October 17, 2016 9:57:34 AM CEST Bart Van Assche wrote:
> On 10/17/2016 09:30 AM, Binoy Jayan wrote:
> > These are a set of patches which removes semaphores from infiniband.
> > These are part of a bigger effort to eliminate all semaphores from the
> > linux kernel.
> 
> Hello Binoy,
> 
> Why do you think it would be a good idea to eliminate all semaphores 
> from the Linux kernel? I don't know anyone who doesn't consider 
> semaphores a useful abstraction.

There are a several reasons why the semaphores as defined in the
kernel are bad and we should get rid of them:

- semaphores cannot be analysed using lockdep, since they don't
  always fit in the simpler 'mutex' semantics

- those that are basically mutexes should be converted to mutexes
  for efficiency and consistency anyway

- the semaphores that are not just used as mutexes are typically
  used as completions and should just be converted to completions
  for simplicity

- when running a preempt-rt kernel, semaphores suffer from priority
  inversion problems, while mutexes use use priority inheritance
  as a countermeasure

There are very few remaining semaphores in the kernel and generally
speaking we'd be better off removing them all so no new users
show up in the future. Most of them are trivial to replace with
mutexes or completions. For the ones that are not trivially replaced,
we have to look at each one and decide what to do about them,
there usually is some solution that actually improves the code.

Using an open-coded semaphore as a replacement is probably just
the last resort that we can consider once we are down to the
last handful of users. I haven't looked at drivers/infiniband/
yet for this, but I believe that drivers/acpi/ is a case for
which I see no better alternative (the AML bytecode requires
counting semaphore semantics).

	Arnd

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


Thread

[PATCH 0/8] infiniband: Remove semaphores Binoy Jayan <binoy.jayan@linaro.org> - 2016-10-17 18:40 +0200
  [PATCH 1/8] IB/core: iwpm_nlmsg_request: Replace semaphore with completion Binoy Jayan <binoy.jayan@linaro.org> - 2016-10-17 18:40 +0200
  [PATCH 6/8] IB/hns: Replace counting semaphore event_sem with wait condition Binoy Jayan <binoy.jayan@linaro.org> - 2016-10-17 18:40 +0200
    Re: [PATCH 6/8] IB/hns: Replace counting semaphore event_sem with wait condition Arnd Bergmann <arnd@arndb.de> - 2016-10-17 22:40 +0200
      Re: [PATCH 6/8] IB/hns: Replace counting semaphore event_sem with  wait condition Binoy Jayan <binoy.jayan@linaro.org> - 2016-10-18 07:20 +0200
        Re: [PATCH 6/8] IB/hns: Replace counting semaphore event_sem with wait condition Arnd Bergmann <arnd@arndb.de> - 2016-10-19 17:20 +0200
  [PATCH 4/8] IB/mthca: Replace semaphore poll_sem with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2016-10-17 18:40 +0200
  [PATCH 3/8] IB/hns: Replace semaphore poll_sem with mutex Binoy Jayan <binoy.jayan@linaro.org> - 2016-10-17 18:40 +0200
  [PATCH 2/8] IB/core: Replace semaphore sm_sem with completion Binoy Jayan <binoy.jayan@linaro.org> - 2016-10-17 18:40 +0200
  [PATCH 5/8] IB/isert: Replace semaphore sem with completion Binoy Jayan <binoy.jayan@linaro.org> - 2016-10-17 18:40 +0200
  Re: [PATCH 0/8] infiniband: Remove semaphores Arnd Bergmann <arnd@arndb.de> - 2016-10-17 22:10 +0200
    Re: [PATCH 0/8] infiniband: Remove semaphores Arnd Bergmann <arnd@arndb.de> - 2016-10-17 22:40 +0200

csiph-web