Re: [PATCH v7 21/23] block: Avoid that flushing triggers a lockdep complaint

From: Ming Lei
Date: Wed Feb 27 2019 - 10:54:17 EST


On Wed, Feb 27, 2019 at 03:24:51PM +0100, Peter Zijlstra wrote:
> On Wed, Feb 27, 2019 at 09:35:56AM +0800, Ming Lei wrote:
> > On Tue, Feb 26, 2019 at 07:08:02PM +0100, Peter Zijlstra wrote:
> > > On Fri, Feb 15, 2019 at 10:26:59AM +0800, Ming Lei wrote:
> > > > There might be lots of blk_flush_queue instance which is allocated
> > > > for each hctx, then lots of class key slot may be wasted.
> > >
> > > What is 'lots' ? for someone who doesn't really know all that much about
> > > the block layer.
> >
> > Each hw queue has one instance of blk_flush_queue, and one device may
> > has lots of hw queues(may be > all possible cpus, such as nvme), and there
> > may be lots of block devices in one system.
> >
> > Suppose one system has 10 NVMe hosts, 8 disks attached to each host, and
> > 256 CPU cores in the system, there can be 10 * 8 * 256 = 20K instances of
> > blk_flush_queue.
> >
> > Not mention there are other block devices(loop, nbd, scsi, ...) in the system.
> >
> > That is why I suggest to use one single lock class for addressing this
> > nvme loop specific issue:
> >
> > https://marc.info/?l=linux-kernel&m=155019765724564&w=2
>
> Right; that is rather a lot. But what causes the recursion, and thus how
> is it specific to NVME ?

The recursion is nvme-loop specific, see the following link:

https://marc.info/?l=linux-block&m=155003205030566&w=2

Thanks,
Ming