Thread (97 messages) 97 messages, 14 authors, 2022-11-03

Re: [PATCH v8 1/8] mm/memfd: Introduce userspace inaccessible memfd

From: Fuad Tabba <hidden>
Date: 2022-09-23 15:21:30
Also in: kvm, linux-doc, linux-fsdevel, linux-mm, lkml, qemu-devel

Hi,

On Fri, Sep 23, 2022 at 1:53 AM Kirill A . Shutemov
[off-list ref] wrote:
On Thu, Sep 22, 2022 at 07:49:18PM +0000, Sean Christopherson wrote:
quoted
On Thu, Sep 22, 2022, Wang, Wei W wrote:
quoted
On Thursday, September 15, 2022 10:29 PM, Chao Peng wrote:
quoted
+int inaccessible_get_pfn(struct file *file, pgoff_t offset, pfn_t *pfn,
+                  int *order)
Better to remove "order" from this interface?
Hard 'no'.
quoted
Some callers only need to get pfn, and no need to bother with
defining and inputting something unused. For callers who need the "order",
can easily get it via thp_order(pfn_to_page(pfn)) on their own.
That requires (a) assuming the pfn is backed by struct page, and (b) assuming the
struct page is a transparent huge page.  That might be true for the current
implementation, but it most certainly will not always be true.

KVM originally did things like this, where there was dedicated code for THP vs.
HugeTLB, and it was a mess.  The goal here is very much to avoid repeating those
mistakes.  Have the backing store _tell_ KVM how big the mapping is, don't force
KVM to rediscover the info on its own.
I guess we can allow order pointer to be NULL to cover caller that don't
need to know the order. Is it useful?
I think that would be useful. In pKVM we don't need to know the order,
and I had to use a dummy variable when porting V7.

Cheers,
/fuad

--
  Kiryl Shutsemau / Kirill A. Shutemov
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help