lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZtpATbuopBFAzl89@kernel.org>
Date: Thu, 5 Sep 2024 19:35:41 -0400
From: Mike Snitzer <snitzer@...nel.org>
To: Eric Biggers <ebiggers@...nel.org>
Cc: Mikulas Patocka <mpatocka@...hat.com>, dm-devel@...ts.linux.dev,
	Alasdair Kergon <agk@...hat.com>, Tejun Heo <tj@...nel.org>,
	Lai Jiangshan <jiangshanlai@...il.com>,
	linux-kernel@...r.kernel.org, linux-mm@...ck.org,
	Sami Tolvanen <samitolvanen@...gle.com>, linux-nfs@...r.kernel.org
Subject: sharing rescuer threads when WQ_MEM_RECLAIM needed? [was: Re: dm
 verity: don't use WQ_MEM_RECLAIM]

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@...gle.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@...gle.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ