[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZfGtVLkO6T-0n7fMBTvR84Ji8GhTO5==u9v+8f+dRkJhFHMA@mail.gmail.com>
Date: Tue, 19 Jul 2022 14:53:09 +0800
From: Muchun Song <songmuchun@...edance.com>
To: Jinke Han <hanjinke.666@...edance.com>
Cc: Jens Axboe <axboe@...nel.dk>, Tejun Heo <tj@...nel.org>,
"open list:BLOCK LAYER" <linux-block@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Cgroups <cgroups@...r.kernel.org>
Subject: Re: [PATCH] block: don't allow the same type rq_qos add more than once
On Mon, Jul 18, 2022 at 4:37 PM Jinke Han <hanjinke.666@...edance.com> wrote:
>
> From: hanjinke <hanjinke.666@...edance.com>
>
> In our test of iocost, we encounttered some list add/del corrutions of
> inner_walk list in ioc_timer_fn.
> The resean can be descripted as follow:
>
> cpu 0 cpu 1
> ioc_qos_write ioc_qos_write
>
> ioc = q_to_ioc(bdev_get_queue(bdev));
> if (!ioc) {
> ioc = kzalloc(); ioc = q_to_ioc(bdev_get_queue(bdev));
> if (!ioc) {
> ioc = kzalloc();
> ...
> rq_qos_add(q, rqos);
> }
> ...
> rq_qos_add(q, rqos);
> ...
> }
>
> When the io.cost.qos file is written by two cpu concurrently, rq_qos may
> be added to one disk twice. In that case, there will be two iocs enabled
> and running on one disk. They own different iocgs on their active list.
> In the ioc_timer_fn function, because of the iocgs from two ioc have the
> same root iocg, the root iocg's walk_list may be overwritten by each
> other and this lead to list add/del corrutions in building or destorying
> the inner_walk list.
>
> And so far, the blk-rq-qos framework works in case that one instance for
> one type rq_qos per queue by default. This patch make this explicit and
> also fix the crash above.
>
> Signed-off-by: hanjinke <hanjinke.666@...edance.com>
The change LGTM. Maybe it is better to add a Fixes tag here so that
others can easily know what Linux versions should be backported.
Reviewed-by: Muchun Song <songmuchun@...edance.com>
Thanks.
Powered by blists - more mailing lists