All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Ingo Oeser <ioe-lkml@rameria.de>,
	Daniel Walker <dwalker@mvista.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@osdl.org>
Subject: Re: [PATCH] Replace completions with semaphores
Date: Sat, 12 Apr 2008 21:16:50 +0200	[thread overview]
Message-ID: <1208027810.6230.64.camel@lappy> (raw)
In-Reply-To: <20080412190423.GM11962@parisc-linux.org>

On Sat, 2008-04-12 at 13:04 -0600, Matthew Wilcox wrote:
> On Sat, Apr 12, 2008 at 08:05:49PM +0200, Peter Zijlstra wrote:
> > On Sat, 2008-04-12 at 11:26 -0600, Matthew Wilcox wrote:
> > >  We can continue the
> > > discussion about eliminating one or the other API, but my opinion is that
> > > eliminating either is a mistake.  The choice of API indicates how the
> > > author thinks about the code, which is crucial for those reading the code.
> > 
> > Which is exactly the point, semaphores are rarely the right tool for the
> > job (I'm currently only aware of XFS that actually uses them as actual
> > semaphores, and the driver model that uses it to get around lockdep -
> > still need to come up with a good solution for that).
> 
> I guess you haven't grepped the tree recently then.  We have 11 places
> which call sema_init with a number other than 0 or 1 as the second
> argument:
> 
> ../fs/xfs/linux-2.6/sema.h:#define initnsema(sp, val, name)      sema_init(sp, val)
> ../drivers/net/mlx4/cmd.c:       sema_init(&priv->cmd.event_sem, priv->cmd.max_cmds);
> ../drivers/char/viotape.c:       sema_init(&reqSem, VIOTAPE_MAXREQ);
> ../drivers/infiniband/hw/mthca/mthca_cmd.c:      sema_init(&dev->cmd.event_sem, dev->cmd.max_cmds);
> ../drivers/acpi/osl.c:   sema_init(sem, initial_units);
> ../drivers/scsi/megaraid/megaraid_sas.c: sema_init(&instance->ioctl_sem, MEGASAS_INT_CMDS);
> ../drivers/scsi/megaraid/megaraid_mm.c:  sema_init(&adapter->kioc_semaphore, lld_adp->max_kioc);
> ../drivers/video/omap/hwa742.c:  sema_init(&hwa742.req_sema, i - IRQ_REQ_POOL_SIZE);
> ../drivers/video/omap/blizzard.c:        sema_init(&blizzard.req_sema, i - IRQ_REQ_POOL_SIZE);
> ../drivers/usb/misc/usblcd.c:    sema_init(&dev->limit_sem, USB_LCD_CONCURRENT_WRITES);
> ../drivers/usb/usb-skeleton.c:   sema_init(&dev->limit_sem, WRITES_IN_FLIGHT);
> 
> It's nice to know that nobody is using __DECLARE_SEMAPHORE_GENERIC or
> __SEMAPHORE_INITIALIZER at this time.  I'll delete those from my semaphore
> tree soon.

Luckily those are mostly drivers, but yeah - I haven't actually grepped
the tree I just know the few sem users I've ran into myself.

Still doesn't make it a good idea to have semaphores. 


  reply	other threads:[~2008-04-12 19:17 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-11 21:00 [PATCH] Replace completions with semaphores Matthew Wilcox
2008-04-12  6:43 ` Daniel Walker
2008-04-12 10:31   ` Ingo Oeser
2008-04-12 12:24 ` Peter Zijlstra
2008-04-12 17:26   ` Matthew Wilcox
2008-04-12 18:01     ` Daniel Walker
2008-04-12 18:05     ` Peter Zijlstra
2008-04-12 19:04       ` Matthew Wilcox
2008-04-12 19:16         ` Peter Zijlstra [this message]
2008-04-12 19:53     ` Roland Dreier
2008-04-12 20:47       ` Matthew Wilcox
2008-04-13  7:08         ` Ingo Molnar
2008-04-13 12:57           ` Matthew Wilcox
2008-04-14 15:39             ` Ingo Molnar
2008-04-14 15:58               ` Roland Dreier
2008-04-14 16:32                 ` Peter Zijlstra
2008-04-14 16:56                   ` Arjan van de Ven
2008-04-14 17:50                     ` Matthew Wilcox
2008-04-14 17:46                   ` Andi Kleen
2008-04-14 17:54                     ` Peter Zijlstra
2008-04-14 18:09                       ` Daniel Walker
2008-04-14 19:16                       ` Andi Kleen
2008-04-15  6:18                         ` Bart Van Assche
2008-04-15  6:46                           ` Peter Zijlstra
2008-04-15  7:17                             ` Bart Van Assche
2008-04-15  8:44                               ` Peter Zijlstra
2008-04-15 13:15                                 ` Bart Van Assche
2008-04-15 16:09                                 ` Linus Torvalds
2008-04-15 16:27                                   ` Andi Kleen
2008-04-15 16:57                                     ` Linus Torvalds
2008-04-15 17:05                                       ` Ingo Molnar
2008-04-15 18:50                                         ` Matthew Wilcox
2008-04-16 12:37                                           ` Ingo Molnar
2008-04-16 12:50                                             ` Andi Kleen
2008-04-16 12:59                                               ` Killable stat/readdir Matthew Wilcox
2008-04-15 17:15                                       ` [PATCH] Replace completions with semaphores Andi Kleen
2008-04-15 17:26                                         ` Linus Torvalds
2008-04-15 17:41                                           ` Matthew Wilcox
2008-04-15 18:14                                             ` Linus Torvalds
2008-04-16 16:07                                               ` Ingo Oeser
2008-04-16 16:16                                                 ` Matthew Wilcox
2008-04-16 16:31                                                   ` Oliver Neukum
2008-04-16 16:34                                                     ` Matthew Wilcox
2008-04-16 16:42                                                       ` Oliver Neukum
2008-04-16 16:44                                                         ` Matthew Wilcox
2008-04-16 16:47                                                           ` Roland Dreier
2008-04-16 16:50                                                     ` Arjan van de Ven
2008-04-16 16:58                                                       ` Matthew Wilcox
2008-04-16 17:08                                                         ` Arjan van de Ven
2008-04-16 17:12                                                           ` Matthew Wilcox
2008-04-16 18:10                                                           ` Matthew Wilcox
2008-04-14 19:16                       ` Alan Cox
2008-04-13 14:55           ` Bart Van Assche
2008-04-14 17:12             ` API documentation (was [PATCH] Replace completions with semaphores) Jonathan Corbet
2008-04-14 17:33               ` Peter Zijlstra
2008-04-14 18:38                 ` Bart Van Assche
2008-04-13 13:55       ` [PATCH] Replace completions with semaphores Bart Van Assche
2008-04-13 14:22         ` Matthew Wilcox
2008-04-13  7:05   ` Ingo Molnar
2008-04-13 12:52     ` Matthew Wilcox
2008-04-14 15:41       ` Ingo Molnar
2008-04-14 17:46         ` Matthew Wilcox
2008-04-14 16:54       ` Jens Axboe
     [not found] <ahyFC-2bu-25@gated-at.bofh.it>
     [not found] ` <ahUPJ-8rN-1@gated-at.bofh.it>
     [not found]   ` <ai4vO-2Rp-19@gated-at.bofh.it>
     [not found]     ` <ai9Yw-5uh-7@gated-at.bofh.it>
     [not found]       ` <aiz6z-OZ-31@gated-at.bofh.it>
     [not found]         ` <aizgp-151-25@gated-at.bofh.it>
     [not found]           ` <aizSW-2Ar-17@gated-at.bofh.it>
     [not found]             ` <aiAYF-5e7-19@gated-at.bofh.it>
     [not found]               ` <aiB8o-5A7-17@gated-at.bofh.it>
     [not found]                 ` <aiCnR-7k-39@gated-at.bofh.it>
     [not found]                   ` <aiMGu-7f0-7@gated-at.bofh.it>
2008-04-16 10:22                     ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1208027810.6230.64.camel@lappy \
    --to=peterz@infradead.org \
    --cc=dwalker@mvista.com \
    --cc=ioe-lkml@rameria.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=mingo@elte.hu \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.