Re: [PATCH v2 5/5] vfio/type1: optimize vfio_unpin_pages_remote()
From: lizhe . 67
Date: Sun Jul 06 2025 - 23:44:42 EST
On Fri, 4 Jul 2025 14:11:23 -0300, jgg@xxxxxxxx wrote:
> On Fri, Jul 04, 2025 at 10:47:00AM +0200, David Hildenbrand wrote:
> > > static long vfio_unpin_pages_remote(struct vfio_dma *dma, dma_addr_t iova,
> > > unsigned long pfn, unsigned long npage,
> > > bool do_accounting)
> > > {
> > > long unlocked = 0, locked = vpfn_pages(dma, iova, npage);
> > > - long i;
> > > - for (i = 0; i < npage; i++)
> > > - if (put_pfn(pfn++, dma->prot))
> > > - unlocked++;
> > > + if (dma->has_rsvd) {
> > > + long i;
> >
> > No need to move "long i" here, but also doesn't really matter.
>
> It should also be unsigned long as npage is unsigned
Yes, unsigned long is a better choice.
Thanks,
Zhe