[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200722004851.GV535743@xz-x1>
Date: Tue, 21 Jul 2020 20:48:51 -0400
From: Peter Xu <peterx@...hat.com>
To: Alex Williamson <alex.williamson@...hat.com>
Cc: Jay Zhou <jianjay.zhou@...wei.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, cohuck@...hat.com, maoming.maoming@...wei.com,
weidong.huang@...wei.com, Andrea Arcangeli <aarcange@...hat.com>
Subject: Re: [PATCH] vfio dma_map/unmap: optimized for hugetlbfs pages
On Mon, Jul 20, 2020 at 04:46:03PM -0600, Alex Williamson wrote:
> > + /*
> > + * We got a hugetlbfs page using vaddr_get_pfn alreadly.
> > + * In this case,we do not need to alloc pages and we can finish all
> > + * work by a single operation to the head page.
> > + */
> > + lock_acct += contiguous_npage;
> > + head = compound_head(pfn_to_page(*pfn_base));
> > + atomic_add(contiguous_npage, compound_pincount_ptr(head));
> > + page_ref_add(head, contiguous_npage);
> > + mod_node_page_state(page_pgdat(head), NR_FOLL_PIN_ACQUIRED, contiguous_npage);
> > + pinned += contiguous_npage;
> > + goto out;
>
> I'm hoping Peter or Andrea understand this, but I think we still have
> pfn_base pinned separately and I don't see that we've done an unpin
> anywhere, so are we leaking the pin of the first page??
I'm not very familiar with that either, however it seems to me most of above
chunk was already done in the gup core. For hugetlbfs, imho it should be where
follow_hugetlb_page() calls try_grab_page(). Thanks,
--
Peter Xu
Powered by blists - more mailing lists