Messages in this thread | | | Date | Wed, 19 Oct 2011 10:49:52 -0700 | From | Tejun Heo <> | Subject | Re: [PATCH 07/10] block: reorganize throtl_get_tg() and blk_throtl_bio() |
| |
Hello,
On Wed, Oct 19, 2011 at 01:45:56PM -0400, Vivek Goyal wrote: > > Hmmmm, yeah, right, switching itself would be racy. Maybe not sharing > > is the solution, I don't know. There's a way to make the switching > > safe tho. Sth like the following. > > > > lock_queue(q, flags) > > { > > spinlock_t *lock; > > > > local_irq_save(flags); > > lock = rcu_dereference_sched(q->queue_lock); > > spin_lock(lock); > > } > > > > and on cleanup, do synchronize_sched() after lock switching. But yeah > > it still stinks. > > rcu protected spinlocks. Interesting. :-)
:)
> IIUC, it still leaves the window open that two callers think they have > the spinlock. One is holding the driver provided lock and other is holding > the queue private lock.
On blk_cleanup_queue() completion, the two are disjoint, so that shouldn't be a problem. Block layer won't call into low level drivers and low level drivers aren't supposed to call into block layer either.
Thanks.
-- tejun
| |