[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8B561EC9A4D13649A62CF60D3A8E8CB28C2DC466@dggeml524-mbx.china.huawei.com>
Date: Tue, 1 Sep 2020 12:09:58 +0000
From: "Maoming (maoming, Cloud Infrastructure Service Product Dept.)"
<maoming.maoming@...wei.com>
To: Hugh Dickins <hughd@...gle.com>
CC: Matthew Wilcox <willy@...radead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"alex.williamson@...hat.com" <alex.williamson@...hat.com>,
"cohuck@...hat.com" <cohuck@...hat.com>,
"Zhoujian (jay)" <jianjay.zhou@...wei.com>,
"Huangweidong (C)" <weidong.huang@...wei.com>,
"peterx@...hat.com" <peterx@...hat.com>,
"aarcange@...hat.com" <aarcange@...hat.com>,
wangyunjian <wangyunjian@...wei.com>
Subject: 答复: [PATCH V3] vfio dma_map/unmap: optimized for hugetlbfs pages
>
> > In the original process of dma_map/unmap pages for VFIO-devices, to
> > make sure the pages are contiguous, we have to check them one by one.
> > As a result, dma_map/unmap could spend a long time.
> > Using the hugetlb pages, we can avoid this problem.
> > All pages in hugetlb pages are contiguous.And the hugetlb page should
> > not be split.So we can delete the for loops.
>
> I know nothing about VFIO, but I'm surprised that you're paying such attention
> to PageHuge hugetlbfs pages, rather than to PageCompound
> pages: which would also include Transparent Huge Pages, of the traditional
> anonymous kind, or the huge tmpfs kind, or the more general (not necessarily
> pmd-sized) kind that Matthew Wilcox is currently working on.
>
> It's true that hugetlbfs is peculiar enough that whatever you write for it may
> need some tweaks to cover the THP case too, or vice versa; but wouldn't your
> patch be a lot better for covering all cases?
>
> You mention above that "the hugetlb page should not be split":
> perhaps you have been worried that a THP could be split beneath you?
> That used to be a possibility some years ago, but nowadays a THP cannot be
> split while anyone is pinning it with an extra reference.
>
> Hugh
>
Thanks for your suggestions.
You mention that a THP cannot be split while anyone is pinning it.
Do you mean the check of can_split_huge_page()(in split_huge_page_to_list())?
When we want to pin pages, vfio_pin_pages_remote() always gets a normal page first.
In this case, a THP cannot be split because of the increased reference.
Is this right?
Maybe I can optimize for hugetlb pages as a first step, and then cover all compound pages.
Powered by blists - more mailing lists