Messages in this thread | | | Date | Mon, 23 Jan 2012 10:36:48 -0500 | From | Vivek Goyal <> | Subject | Re: [PATCH 08/17] blkcg: shoot down blkio_groups on elevator switch |
| |
On Mon, Jan 23, 2012 at 10:20:55AM -0500, Vivek Goyal wrote: > On Sat, Jan 21, 2012 at 07:25:16PM -0800, Tejun Heo wrote: > > [..] > > diff --git a/block/elevator.c b/block/elevator.c > > index 078a491..5e371e4 100644 > > --- a/block/elevator.c > > +++ b/block/elevator.c > > @@ -38,6 +38,7 @@ > > #include <trace/events/block.h> > > > > #include "blk.h" > > +#include "blk-cgroup.h" > > > > static DEFINE_SPINLOCK(elv_list_lock); > > static LIST_HEAD(elv_list); > > @@ -939,6 +940,7 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) > > > > spin_lock_irq(q->queue_lock); > > ioc_clear_queue(q); > > + blkcg_clear_queue(q); > > What happens to per device rules (per device weight and per device > throttling rules)? IIUC, in new scheme of things, upon elevator switch > these rules will be gone. > > I can understand per device weight rules disappearing but what about > throttling rules. They are independent of IO scheduler and change of > io scheduler should not cause per device throttling rules to get lost. > > This just gets worse if elevator switch fails and we fall back to old > elevator. But now we have lost of the rules as rules were part of > blkg.conf and old groups are gone.
IIUC, above is racy w.r.t cgroup removal and elevator switch. Assume that elevator swtich is taking place and we have queue lock held and we try to clear the groups on the queue. Parallely somebody is trying to delete a cgroup and has been partially successful in doing so by taking off the group from blkcg list (blkiocg_destroy()).
Now clear_queue() will complete with one or more groups possibly still left on cfqd list because of cgroup deletion race and that can cause problmes.
Thanks Vivek
| |