[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zz2tzVqql2RMSFN4@infradead.org>
Date: Wed, 20 Nov 2024 01:37:17 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Brian Johannesmeyer <bjohannesmeyer@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org,
Raphael Isemann <teemperor@...il.com>,
Cristiano Giuffrida <giuffrida@...vu.nl>,
Herbert Bos <h.j.bos@...nl>, Greg KH <gregkh@...uxfoundation.org>,
Keith Busch <kbusch@...nel.org>
Subject: Re: [RFC v2 1/2] dmapool: Move pool metadata into non-DMA memory
On Tue, Nov 19, 2024 at 09:55:28PM +0100, Brian Johannesmeyer wrote:
> + page->blocks_per_page = pool->allocation / pool->size;
> + page->blocks = kmalloc_array(page->blocks_per_page,
> + sizeof(struct dma_block), GFP_KERNEL);
Given that you now need an array of the blocks anyway, it might make
sense to switch from a linked list to a bitmap for tracking free state,
which would be a lot more efficient as you only need a bit per block
as tracking overhead instead of a two pointers and a dma_addr_t.
e.g. do a find_first_zero_bit() to find the ffree slot, then calculate
the dma_addr and virt address by simple offseting into the dma_page
ones with bitnr * pool->size.
Powered by blists - more mailing lists