Re: [PATCH 2/2] blk-throttle: Take blkcg->lock while traversingblkcg->policy_list

From: Vivek Goyal
Date: Thu Oct 20 2011 - 17:20:24 EST


On Thu, Oct 20, 2011 at 02:11:40PM -0700, Tejun Heo wrote:
> Hello,
>
> On Thu, Oct 20, 2011 at 05:08:26PM -0400, Vivek Goyal wrote:
> > blkcg->policy_list is protected by blkcg->lock. Its not rcu protected
> > list. So even for readers, they need to take blkcg->lock. There are
> > few functions which were reading the list without taking lock. Fix it.
> >
> > Signed-off-by: Vivek Goyal <vgoyal@xxxxxxxxxx>
>
> Acked-by: Tejun Heo <tj@xxxxxxxxxx>
>
> And yeap, some of rcu usages in cfq/iocg seem either incorrect or
> unnecessary. Trying to clean up that now too.

Cool. I am waiting for the patches as I am curious to know what's incorrect
or unnecessary.

I noticed above two problems while trying to figure out how can we cleanup
the device rules when devices goes away. One place could be.

blk_throtl_exit() {
blkiocg_del_blkio_group() {
delete_any_policy_nodes_associated_with_this device;
}
}

The only problem with this approach is that it will cleanup per device
weight rules also at elevator_exit() time which is not same as device
removal and one might device to bring CFQ back on device and we will
need the rules again.

cfq_exit_queue()
cfq_release_cfq_groups
cfq_blkiocg_del_blkio_group()
blkiocg_del_blkio_group()

Thanks
Vivek
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/