[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251217174131.GA2944334@google.com>
Date: Wed, 17 Dec 2025 17:41:31 +0000
From: Sami Tolvanen <samitolvanen@...gle.com>
To: Eric Biggers <ebiggers@...nel.org>
Cc: dm-devel@...ts.linux.dev, Alasdair Kergon <agk@...hat.com>,
Mike Snitzer <snitzer@...nel.org>,
Mikulas Patocka <mpatocka@...hat.com>,
Benjamin Marzinski <bmarzins@...hat.com>,
Eran Messeri <eranm@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/7] dm-verity: move dm_verity_fec_io to mempool
On Tue, Dec 16, 2025 at 03:06:08PM -0800, Eric Biggers wrote:
> Currently, struct dm_verity_fec_io is allocated in the front padding of
> struct bio using dm_target::per_io_data_size. Unfortunately, struct
> dm_verity_fec_io is very large: 3096 bytes when CONFIG_64BIT=y &&
> PAGE_SIZE == 4096, or 9240 bytes when CONFIG_64BIT=y && PAGE_SIZE ==
> 16384. This makes the bio size very large.
>
> Moreover, most of dm_verity_fec_io gets iterated over up to three times,
> even on I/O requests that don't require any error correction:
>
> 1. To zero the memory on allocation, if init_on_alloc=1. (This happens
> when the bio is allocated, not in dm-verity itself.)
>
> 2. To zero the buffers array in verity_fec_init_io().
>
> 3. To free the buffers in verity_fec_finish_io().
>
> Fix all of these inefficiencies by moving dm_verity_fec_io to a mempool.
> Replace the embedded dm_verity_fec_io with a pointer
> dm_verity_io::fec_io. verity_fec_init_io() initializes it to NULL,
> verity_fec_decode() allocates it on the first call, and
> verity_fec_finish_io() cleans it up. The normal case is that the
> pointer simply stays NULL, so the overhead becomes negligible.
>
> Signed-off-by: Eric Biggers <ebiggers@...nel.org>
Reviewed-by: Sami Tolvanen <samitolvanen@...gle.com>
Sami
Powered by blists - more mailing lists