Re: [PATCH V4 1/2] vfio dma_map/unmap: optimized for hugetlbfs pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 09, 2020 at 09:01:14AM +0100, Christoph Hellwig wrote:
>  (1) a FOLL_HUGEPAGE flag for the pin_user_pages API family that returns
>      a single struct page for any kind of huge page, which would also
>      benefit all kinds of other users rather than adding these kinds of
>      hacks to vfio.
>  (2) add a bvec version of the API that returns a variable size
>      "extent"
> 
> I had started on (2) a while ago, and here is branch with my code (which
> is broken and fails test, but might be a start):
> 
> http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/gup-bvec
> 
> But for now I wonder if (1) is the better start, which could still be
> reused to (2) later.

(1) doesn't work.  Suppose you have a 16kB MAP_PRIVATE of a file which happens
to have a THP in the page cache.  When you write a byte, that base page gets
copied and your bvec for that 16kB needs to look something like:

{ page A, offset 0, length 4096 },
{ page B, offset 0, length 4096 },
{ page A, offset 8192, length 8192 },

You can come up with other scenarios, like partial mappings of THPs with
an adjacent VMA of a different THP, but I think we just need to make
(2) work.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux