[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y+PymbdtPVONbQAq@slm.duckdns.org>
Date: Wed, 8 Feb 2023 09:06:01 -1000
From: Tejun Heo <tj@...nel.org>
To: Yu Kuai <yukuai1@...weicloud.com>
Cc: josef@...icpanda.com, axboe@...nel.dk, cgroups@...r.kernel.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
yukuai3@...wei.com, yi.zhang@...wei.com, yangerkun@...wei.com
Subject: Re: [PATCH -next] blk-iocost: fix sleeping in atomic warning for
wbt_enable_default()
On Wed, Feb 08, 2023 at 11:48:03AM +0800, Yu Kuai wrote:
> diff --git a/block/blk-iocost.c b/block/blk-iocost.c
> index 7a2dc9dc8e3b..03bfe1dda07c 100644
> --- a/block/blk-iocost.c
> +++ b/block/blk-iocost.c
> @@ -3279,11 +3279,9 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
> blk_stat_enable_accounting(disk->queue);
> blk_queue_flag_set(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
> ioc->enabled = true;
> - wbt_disable_default(disk);
> } else {
> blk_queue_flag_clear(QUEUE_FLAG_RQ_ALLOC_TIME, disk->queue);
> ioc->enabled = false;
> - wbt_enable_default(disk);
> }
>
> if (user) {
> @@ -3296,6 +3294,10 @@ static ssize_t ioc_qos_write(struct kernfs_open_file *of, char *input,
> ioc_refresh_params(ioc, true);
> spin_unlock_irq(&ioc->lock);
>
> + if (enable)
> + wbt_disable_default(disk);
> + else
> + wbt_enable_default(disk);
Wouldn't this allow two competiting config attempts to race each other and
leave wbt in an unexpected state?
task1 task2
ioc_qos_write() ioc_qos_write()
lock()
enable
unlock()
lock()
disable
unlock()
wbt_enable_default()
wbt_disable_default()
Thanks.
--
tejun
Powered by blists - more mailing lists