Re: [PATCH] hidraw: fix list->buffer race condition

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

 



> > [snip]
> > 
> > list_lock does not appear to be a good solution for this, since it is
> > currently an IRQ-safe spinlock on the device. Using it would cause 
> > _read() to have unnecessary lock contention if the device is opened 
> > and read simultaneously from multiple fds, and every loop iteration would 
> > need to acquire the spinlock / disable interrupts at least once.
> 
> We could make the spinlock per struct file *, which'd remove the 
> contention bottleneck when the same device is accessed from through 
> multiple fds, but still maintain the correctness (as the list itself is a 
> per-fd thing anyway).
> 
> Probably introducing new spinlock would make more sense, as list_lock is 
> currently being used mostly to protect accessing of the dev->list linked 
> list.

I've got a patch I'm testing that follows Dmitry's suggestion to add
a per-struct file spinlock and change dev->list to use RCU.

Thanks,

- Gary
--
To unsubscribe from this list: send the line "unsubscribe linux-input" 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 Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux