Re: [PATCH -next 3/4] block/rq_qos: use a global mutex to protect rq_qos apis

From: Tejun Heo
Date: Thu Jan 05 2023 - 13:35:25 EST


Hello,

On Thu, Jan 05, 2023 at 09:35:21AM +0800, Yu Kuai wrote:
> > Can you please take a look at the following patchset I just posted:
> >
> > https://lkml.kernel.org/r/20230105002007.157497-1-tj@xxxxxxxxxx
> >
> > After that, all these configuration operations are wrapped between
> > blkg_conf_init() and blkg_conf_exit() which probably are the right place to
> > implement the synchronization.
>
> I see that, blkg_conf_init() and blkg_conf_exit() is good, however there
> are some details I want to confirm:
>
> 1) rq_qos_add() can be called from iocost/iolatency, where
> blkg_conf_init() will be called first, while rq_qos_add() can also be
> called from wbt, where there is no blkg_conf_init(). Hence it seems to
> me we need two locks here, one to protect rq_qos apis; one to
> synchronize policy configuration and device removal.

wbt's lazy init is tied to one of the block device sysfs files, right? So,
it *should* already be protected against device removal.

Thanks.

--
tejun