Re: [PATCH 3/3] block/loop: make loop cgroup aware

From: Tejun Heo
Date: Fri Sep 08 2017 - 13:54:23 EST


Hello, Shaohua.

On Fri, Sep 08, 2017 at 10:07:15AM -0700, Shaohua Li wrote:
> > The fact that we're forwarding explicitly in loop still bothers me a
> > bit. Can you please elaborate why we don't want to do this
> > generically through aio?
>
> I think we must forward in loop, because each cmd could come from different
> cgroup, so we must explicitly forward for each cmd.
>
> The main reason not to do the forward in aio is complexity. We at least have 3
> different implementations for dio:
> - __blockdev_direct_IO for ext4 and btrfs
> - iomap dio for xfs
> - blockdev dio implementation
>
> Forwarding in dio means hooking the cgroup association for each bio dispatched
> in the implementations, which is a little messy. I'd like to avoid this if
> there is no strong reason to do it.

I see. I think the important questions is whether we're failing to
forward io cgroup membership propagation on some aios? If we are,
that is an obvious bug which should be addressed one way or the other,
and there's a fair chance that we wouldn't need to do anything special
for loop.

Given how simple the loop changes are, we sure can go with loop
specific changes for now; however, I'm a bit unconvinced that aio
changes would be that much more complex. Can you please look into it?
If it is actually complex, we sure can do it later but I'd much prefer
to plug the hole as soon as possible.

Thanks.

--
tejun