Re: [PATCH v3 24/32] iommufd: use iova_to_phys_length for efficient unmap

From: Jason Gunthorpe

Date: Thu Jun 04 2026 - 10:41:40 EST


On Wed, Jun 03, 2026 at 11:17:56PM +0800, Guanghui Feng wrote:
> Use iommu_iova_to_phys_length() to get PTE page size in
> + for (i = 0; i < npages; i++) {
> + if (!batch_add_pfn(batch, PHYS_PFN(phys) + i))
> + return;

batch_add_pfn_num()

Be mindful that the num is purposfully a u32 so that will need some
attention.

Jason