[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <086a76c4-98da-d9d1-9f2f-6249c3d55fe9@redhat.com>
Date: Thu, 5 Sep 2024 20:21:46 +0200 (CEST)
From: Mikulas Patocka <mpatocka@...hat.com>
To: Eric Biggers <ebiggers@...nel.org>
cc: dm-devel@...ts.linux.dev, Alasdair Kergon <agk@...hat.com>,
Mike Snitzer <snitzer@...nel.org>, Tejun Heo <tj@...nel.org>,
Lai Jiangshan <jiangshanlai@...il.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Sami Tolvanen <samitolvanen@...gle.com>
Subject: Re: [PATCH] dm verity: don't use WQ_MEM_RECLAIM
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
> ---
> drivers/md/dm-verity-target.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
> index cf659c8feb29f..051e84ca401dc 100644
> --- a/drivers/md/dm-verity-target.c
> +++ b/drivers/md/dm-verity-target.c
> @@ -1488,11 +1488,11 @@ static int verity_ctr(struct dm_target *ti, unsigned int argc, char **argv)
> * Also as required for the "try_verify_in_tasklet" feature: WQ_HIGHPRI
> * allows verify_wq to preempt softirq since verification in BH workqueue
> * will fall-back to using it for error handling (or if the bufio cache
> * doesn't have required hashes).
> */
> - v->verify_wq = alloc_workqueue("kverityd", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
> + v->verify_wq = alloc_workqueue("kverityd", WQ_HIGHPRI, 0);
> if (!v->verify_wq) {
> ti->error = "Cannot allocate workqueue";
> r = -ENOMEM;
> goto bad;
> }
>
> base-commit: 88fac17500f4ea49c7bac136cf1b27e7b9980075
> --
> 2.46.0
>
Powered by blists - more mailing lists