Re: [PATCH v2 4/4] usb: hub: rename khubd to hub_wq in documentation and comments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 18 Sep 2014, Tejun Heo wrote:

> Hello, Alan, Petr.
> 
> On Wed, Sep 17, 2014 at 01:36:26PM -0400, Alan Stern wrote:
> > > -	/* If khubd ever becomes multithreaded, this will need a lock */
> > > +	/* If hub_wq ever becomes multithreaded, this will need a lock */
> > >  	if (udev->wusb) {
> > >  		devnum = udev->portnum + 1;
> > >  		BUG_ON(test_bit(devnum, bus->devmap.devicemap));
> > 
> > You probably didn't notice when changing this comment.  But in fact,
> > workqueues _are_ multithreaded.  Therefore you need to add a lock to 
> > this routine.
> 
> Haven't read the code but if this function is called from a single
> work_struct, workqueue guarantees that there's only single thread of
> execution at any given time.  A work item is never executed
> concurrently no matter what.

This routine can be called from multiple work_structs, because a USB 
bus can have multiple hubs.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux