[Ksummit-2008-discuss] topic proposal

Daniel Walker dwalker at mvista.com
Tue Aug 26 22:27:26 PDT 2008


On Tue, 2008-08-26 at 18:32 -0700, Roland Dreier wrote:
> > I've seen loads semaphores used as mutexes, and loads used as regular
>  > signaling completions. What remains outside of those two is the wild
>  > un-maintainable stuff that , I think, we really don't want..
> 
> Take a look at, say, drivers/net/mlx4/cmd.c.  That uses a semaphore to
> count how many firmware commands are outstanding, and block until a
> command completes when the maximum number of commands are already
> queued.  Which of your cases does that fall into?  It's not a mutex,
> it's not a completion, and I really don't think it's anything that's
> wild or un-maintainable.

The poll_sem looks like a mutex, and the event_sem falls into the same
case as what I outlined to Greg, which would be a completion (with some
modifications to completions) ..

> I think it would be fine if we wanted to introduce a new primitive for
> cases such as this (queue up to N of some operation, and allow another
> operation to start when one completes), and I believe there were some
> ideas about that floating around.  But I'm not sure I buy the assertion
> that there are no legitimate uses for semaphores other than for
> implementing mutexes and completions.

This case you brought up is fairly rare .. Maybe 5-10 like this in the
whole kernel. I do think it's a sane usage with mutexes, and other
completions .

Daniel



More information about the Ksummit-2008-discuss mailing list