[Ksummit-2008-discuss] topic proposal

Daniel Walker dwalker at mvista.com
Tue Aug 26 17:44:24 PDT 2008


On Tue, 2008-08-26 at 17:05 -0700, Greg KH wrote:
> On Tue, Aug 26, 2008 at 04:39:10PM -0700, Daniel Walker wrote:
> > 
> > Semaphores do we keep them or do we remove them?
> > 
> > I've had enough semaphore removal patches accepted that I think it's
> > already been decided .. However, it would seem at least Andi and Matthew
> > don't completely agree .. Which makes me wonder if there's other pockets
> > of people that either don't know about this, or have specific objections
> > to it..
> 
> Aren't there still a few places in the kernel that want a "counting
> mutex" that the semaphore code provides?  How is that going to be
> converted using mutexes?


I don't think anything is set in stone .. I had created a change to
completions where you would do something like this,

static inline void init_completion_nr(struct completion *x, int nr_done)
{
        x->done = nr_done;
        init_waitqueue_head(&x->wait);
}


Then you could initialize the completion with some number above zero..
You would then be able to have an arbitrary number of
"wait_for_completion()" calls which don't block ..

In drivers/usb/usb-skeleton.c,

static int skel_probe(struct usb_interface *interface, const struct usb_device_id *id)
{
        ...

        sema_init(&dev->limit_sem, WRITES_IN_FLIGHT);

This limit_sem semaphore is a place I was using the "counting"
completions .. There are a few other users like that, not very many.

Daniel



More information about the Ksummit-2008-discuss mailing list