Re: [dm-devel] [PATCH 2/4] mm: mempool: introduce page bulk allocator

2022-10-06 Thread Yang Shi
On Thu, Oct 6, 2022 at 7:47 AM Brian Foster wrote: > > On Wed, Oct 05, 2022 at 11:03:39AM -0700, Yang Shi wrote: > > Since v5.13 the page bulk allocator was introduced to allocate order-0 > > pages in bulk. There are a few mempool allocator callers which does > > order-0 page allocation in a loop

Re: [dm-devel] [PATCH 2/4] mm: mempool: introduce page bulk allocator

2022-10-06 Thread Brian Foster
On Wed, Oct 05, 2022 at 11:03:39AM -0700, Yang Shi wrote: > Since v5.13 the page bulk allocator was introduced to allocate order-0 > pages in bulk. There are a few mempool allocator callers which does > order-0 page allocation in a loop, for example, dm-crypt, f2fs compress, > etc. A mempool page

[dm-devel] [PATCH 4/4] md: dm-crypt: use mempool page bulk allocator

2022-10-06 Thread Yang Shi
When using dm-crypt for full disk encryption, dm-crypt would allocate an out bio and allocate the same amount of pages as in bio for encryption. It currently allocates one page at a time in a loop. This is not efficient. So using mempool page bulk allocator instead of allocating one page at a ti

[dm-devel] [PATCH 2/4] mm: mempool: introduce page bulk allocator

2022-10-06 Thread Yang Shi
Since v5.13 the page bulk allocator was introduced to allocate order-0 pages in bulk. There are a few mempool allocator callers which does order-0 page allocation in a loop, for example, dm-crypt, f2fs compress, etc. A mempool page bulk allocator seems useful. So introduce the mempool page bulk

[dm-devel] [RFC PATCH 0/4] Introduce mempool pages bulk allocator the use it in dm-crypt

2022-10-06 Thread Yang Shi
We have full disk encryption enabled, profiling shows page allocations may incur a noticeable overhead when writing. The dm-crypt creates an "out" bio for writing. And fill the "out" bio with the same amount of pages as "in" bio. But the driver allocates one page at a time in a loop. For 1M bi

[dm-devel] [PATCH 3/4] md: dm-crypt: move crypt_free_buffer_pages ahead

2022-10-06 Thread Yang Shi
With moving crypt_free_buffer_pages() before crypt_alloc_buffer(), we don't need an extra declaration anymore. Signed-off-by: Yang Shi --- drivers/md/dm-crypt.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-cryp

[dm-devel] [PATCH 1/4] mm: mempool: extract common initialization code

2022-10-06 Thread Yang Shi
Extract the common initialization code to __mempool_init() and __mempool_create(). This will make adding mempool bulk init code easier. Signed-off-by: Yang Shi --- mm/mempool.c | 57 ++-- 1 file changed, 37 insertions(+), 20 deletions(-) diff --g