From: Mike Snitzer <snitzer@kernel.org>
To: Eric Biggers <ebiggers@kernel.org>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
dm-devel@lists.linux.dev, Alasdair Kergon <agk@redhat.com>,
Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Sami Tolvanen <samitolvanen@google.com>,
linux-nfs@vger.kernel.org
Subject: sharing rescuer threads when WQ_MEM_RECLAIM needed? [was: Re: dm verity: don't use WQ_MEM_RECLAIM]
Date: Thu, 5 Sep 2024 19:35:41 -0400 [thread overview]
Message-ID: <ZtpATbuopBFAzl89@kernel.org> (raw)
In-Reply-To: <20240905223555.GA1512@sol.localdomain>
On Thu, Sep 05, 2024 at 03:35:55PM -0700, Eric Biggers wrote:
> On Thu, Sep 05, 2024 at 08:21:46PM +0200, Mikulas Patocka wrote:
> >
> >
> > On Tue, 3 Sep 2024, Eric Biggers wrote:
> >
> > > From: Eric Biggers <ebiggers@google.com>
> > >
> > > Since dm-verity doesn't support writes, the kernel's memory reclaim code
> > > will never wait on dm-verity work. That makes the use of WQ_MEM_RECLAIM
> > > in dm-verity unnecessary. WQ_MEM_RECLAIM has been present from the
> > > beginning of dm-verity, but I could not find a justification for it;
> > > I suspect it was just copied from dm-crypt which does support writes.
> > >
> > > Therefore, remove WQ_MEM_RECLAIM from dm-verity. This eliminates the
> > > creation of an unnecessary rescuer thread per dm-verity device.
> > >
> > > Signed-off-by: Eric Biggers <ebiggers@google.com>
> >
> > Hmm. I can think about a case where you have read-only dm-verity device,
> > on the top of that you have dm-snapshot device and on the top of that you
> > have a writable filesystem.
> >
> > When the filesystem needs to write data, it submits some write bios. When
> > dm-snapshot receives these write bios, it will read from the dm-verity
> > device and write to the snapshot's exception store device. So, dm-verity
> > needs WQ_MEM_RECLAIM in this case.
> >
> > Mikulas
> >
>
> Yes, unfortunately that sounds correct.
>
> This means that any workqueue involved in fulfilling block device I/O,
> regardless of whether that I/O is read or write, has to use WQ_MEM_RECLAIM.
>
> I wonder if there's any way to safely share the rescuer threads.
Oh, I like that idea, yes please! (would be surprised if it exists,
but I love being surprised!). Like Mikulas pointed out, we have had
to deal with fundamental deadlocks due to resource sharing in DM.
Hence the need for guaranteed forward progress that only
WQ_MEM_RECLAIM can provide.
All said, I'd like the same for NFS LOCALIO, we unfortunately have to
enable WQ_MEM_RECLAIM for LOCALIO writes:
https://git.kernel.org/pub/scm/linux/kernel/git/snitzer/linux.git/commit/?h=nfs-localio-for-next&id=85cdb98067c1c784c2744a6624608efea2b561e7
But in general LOCALIO's write path is a prime candidate for further
optimization -- I look forward to continue that line of development
once LOCALIO lands upstream.
Mike
next prev parent reply other threads:[~2024-09-05 23:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-04 4:04 [PATCH] dm verity: don't use WQ_MEM_RECLAIM Eric Biggers
2024-09-05 14:32 ` Mike Snitzer
2024-09-05 18:21 ` [PATCH] " Mikulas Patocka
2024-09-05 22:35 ` Eric Biggers
2024-09-05 23:35 ` Mike Snitzer [this message]
2024-09-06 1:34 ` sharing rescuer threads when WQ_MEM_RECLAIM needed? [was: Re: dm verity: don't use WQ_MEM_RECLAIM] Tejun Heo
2024-09-06 11:23 ` Mikulas Patocka
2024-09-06 10:59 ` [PATCH] dm verity: don't use WQ_MEM_RECLAIM Mikulas Patocka
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=ZtpATbuopBFAzl89@kernel.org \
--to=snitzer@kernel.org \
--cc=agk@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=ebiggers@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nfs@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=samitolvanen@google.com \
--cc=tj@kernel.org \
/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