Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dma-remap: drop nth_page() in dma_common_contiguous_remap()

dma_common_contiguous_remap() is used to remap an "allocated contiguous
region". Within a single allocation, there is no need to use nth_page()
anymore.

Neither the buddy, nor hugetlb, nor CMA will hand out problematic page
ranges.

Link: https://lkml.kernel.org/r/20250901150359.867252-24-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

David Hildenbrand and committed by
Andrew Morton
a16c46c2 6972706f

+1 -1
+1 -1
kernel/dma/remap.c
··· 49 49 if (!pages) 50 50 return NULL; 51 51 for (i = 0; i < count; i++) 52 - pages[i] = nth_page(page, i); 52 + pages[i] = page++; 53 53 vaddr = vmap(pages, count, VM_DMA_COHERENT, prot); 54 54 kvfree(pages); 55 55