public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Yu Kuai <yukuai@fnnas.com>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org, tj@kernel.org,
	nilay@linux.ibm.com
Subject: Re: [PATCH v7 09/16] blk-throttle: fix possible deadlock for fs reclaim under rq_qos_mutex
Date: Fri, 9 Jan 2026 10:18:50 +0800	[thread overview]
Message-ID: <aWBliob1SiDv9NZa@fedora> (raw)
In-Reply-To: <e2054693-7100-4bdc-95eb-9e70d9d3231e@fnnas.com>

On Fri, Jan 09, 2026 at 12:56:33AM +0800, Yu Kuai wrote:
> Hi,
> 
> 在 2026/1/7 20:04, Ming Lei 写道:
> > On Wed, Dec 31, 2025 at 04:51:19PM +0800, Yu Kuai wrote:
> >> blk_throtl_init() can be called with rq_qos_mutex held from blkcg
> >> configuration, and fs reclaim can be triggered because GFP_KERNEL is used
> >> to allocate memory. This can deadlock because rq_qos_mutex can be held
> >> with queue frozen.
> >>
> >> Fix the problem by using blkg_conf_open_bdev_frozen(), also remove
> >> useless queue frozen from blk_throtl_init().
> >>
> >> Signed-off-by: Yu Kuai <yukuai@fnnas.com>
> >> ---
> > I think this patch goes toward wrong direction by enlarging queue freeze
> > scope, and blkg_conf_prep() may run into percpu allocation, then new
> > lockdep warning could be triggered.
> >
> > IMO, we should try to reduce blkg_conf_open_bdev_frozen() uses, instead of
> > adding more.
> 
> Fortunately, blk_throtl_init() doesn't have percpu allocation, so this is
> safe now. Unfortunately, blk-iocost and blk-iolatency do have percpu allocation
> and they're already problematic for a long time. The queue is already frozen from
> blkcg_activate_policy() and then the pd_alloc_fn() will try percpu allocation.
> 
> To be honest, I feel it's too complicated to move all the percpu allocation out of
> queue frozen, will it be possible to fix this the other way by passing another gfp
> into pcpu_alloc_noprof() that it'll be atomic to work around the pcpu_alloc_mutex.

The first question is why blkg_conf_open_bdev_frozen() is used by io-cost
only? I hope it can be removed, then the dependency against percpu
allocation can be killed.

Thanks,
Ming


  reply	other threads:[~2026-01-09  2:19 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-31  8:51 [PATCH v7 00/16] blk-mq: fix possible deadlocks Yu Kuai
2025-12-31  8:51 ` [PATCH v7 01/16] blk-wbt: factor out a helper wbt_set_lat() Yu Kuai
2025-12-31  8:51 ` [PATCH v7 02/16] blk-wbt: fix possible deadlock to nest pcpu_alloc_mutex under q_usage_counter Yu Kuai
2026-01-07  9:30   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 03/16] blk-mq-debugfs: factor out a helper to register debugfs for all rq_qos Yu Kuai
2025-12-31  8:51 ` [PATCH v7 04/16] blk-rq-qos: fix possible debugfs_mutex deadlock Yu Kuai
2026-01-07  9:41   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 05/16] blk-mq-debugfs: make blk_mq_debugfs_register_rqos() static Yu Kuai
2026-01-07  9:42   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 06/16] blk-mq-debugfs: remove blk_mq_debugfs_unregister_rqos() Yu Kuai
2026-01-04 16:37   ` Nilay Shroff
2026-01-07  9:48   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 07/16] blk-mq-debugfs: add missing debugfs_mutex in blk_mq_debugfs_register_hctxs() Yu Kuai
2026-01-04 16:37   ` Nilay Shroff
2026-01-07  9:51   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 08/16] blk-mq-debugfs: warn about possible deadlock Yu Kuai
2026-01-04 16:38   ` Nilay Shroff
2026-01-07  9:56   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 09/16] blk-throttle: fix possible deadlock for fs reclaim under rq_qos_mutex Yu Kuai
2026-01-04 16:38   ` Nilay Shroff
2026-01-07 12:04   ` Ming Lei
2026-01-08 16:56     ` Yu Kuai
2026-01-09  2:18       ` Ming Lei [this message]
2026-01-09  2:22         ` Yu Kuai
2026-01-09  2:26           ` Ming Lei
2026-01-09  9:09       ` Nilay Shroff
2026-02-11  2:07         ` Yu Kuai
2025-12-31  8:51 ` [PATCH v7 10/16] block/blk-rq-qos: add a new helper rq_qos_add_frozen() Yu Kuai
2026-01-04 16:39   ` Nilay Shroff
2026-01-07 12:14   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 11/16] blk-wbt: fix incorrect lock order for rq_qos_mutex and freeze queue Yu Kuai
2026-01-04 16:39   ` Nilay Shroff
2026-01-07 12:14   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 12/16] blk-iocost: " Yu Kuai
2026-01-04 16:39   ` Nilay Shroff
2026-01-07 12:17   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 13/16] blk-iolatency: " Yu Kuai
2026-01-04 16:40   ` Nilay Shroff
2026-01-07 12:20   ` Ming Lei
2025-12-31  8:51 ` [PATCH v7 14/16] block/blk-rq-qos: cleanup rq_qos_add() Yu Kuai
2026-01-04 16:40   ` Nilay Shroff
2025-12-31  8:51 ` [PATCH v7 15/16] blk-rq-qos: remove queue frozen from rq_qos_del() Yu Kuai
2026-01-04 16:40   ` Nilay Shroff
2025-12-31  8:51 ` [PATCH v7 16/16] blk-cgroup: remove queue frozen from blkcg_activate_policy() Yu Kuai
2026-01-04 16:41   ` Nilay Shroff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aWBliob1SiDv9NZa@fedora \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    --cc=nilay@linux.ibm.com \
    --cc=tj@kernel.org \
    --cc=yukuai@fnnas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox