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.