From: David Hildenbrand <david@redhat.com>
To: "Kasireddy, Vivek" <vivek.kasireddy@intel.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Hugh Dickins <hughd@google.com>
Cc: "Hocko, Michal" <mhocko@suse.com>,
"jmarchan@redhat.com" <jmarchan@redhat.com>,
"Kim, Dongwon" <dongwon.kim@intel.com>,
"Chang, Junxiao" <junxiao.chang@intel.com>,
"muchun.song@linux.dev" <muchun.song@linux.dev>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
James Houghton <jthoughton@google.com>,
Gerd Hoffmann <kraxel@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
"kirill.shutemov@linux.intel.com"
<kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH] udmabuf: revert 'Add support for mapping hugepages (v4)'
Date: Thu, 15 Jun 2023 11:48:34 +0200 [thread overview]
Message-ID: <015062b6-2d4a-7b91-8f64-1695f526f794@redhat.com> (raw)
In-Reply-To: <IA0PR11MB71850D8A446FE1342B428EA1F85AA@IA0PR11MB7185.namprd11.prod.outlook.com>
>> Skimming over at shmem_read_mapping_page() users, I assume most of
>> them
>> use a VM_PFNMAP mapping (or don't mmap them at all), where we won't be
>> messing with the struct page at all.
>>
>> (That might even allow you to mmap hugetlb sub-pages, because the struct
>> page -- and mapcount -- will be ignored completely and not touched.)
> Oh, are you suggesting that if we do vma->vm_flags |= VM_PFNMAP
> in the mmap handler (mmap_udmabuf) and also do
> vmf_insert_pfn(vma, vmf->address, page_to_pfn(page))
> instead of
> vmf->page = ubuf->pages[pgoff];
> get_page(vmf->page);
>
> in the vma fault handler (udmabuf_vm_fault), we can avoid most of the
> pitfalls you have identified -- including with the usage of hugetlb subpages?
Yes, that's my thinking, but I have to do my homework first to see if
that would really work for hugetlb.
The thing is, I kind-of consider what udmabuf does a layer violation: we
have a filesystem (shmem/hugetlb) that should handle mappings to user
space. Yet, a driver decides to bypass that and simply map the pages
ordinarily to user space. (revealed by the fact that hugetlb does never
map sub-pages but udmabuf decides to do so)
In an ideal world everybody would simply mmap() the original memfd, but
thinking about offset+size configuration within the memfd that might not
always be desirable. As a workaround, we could mmap() only the PFNs,
leaving the struct page unaffected.
I'll have to look closer into that.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-06-15 9:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-08 20:49 [PATCH] udmabuf: revert 'Add support for mapping hugepages (v4)' Mike Kravetz
2023-06-09 6:09 ` Greg Kroah-Hartman
2023-06-12 7:10 ` Kasireddy, Vivek
2023-06-12 7:46 ` David Hildenbrand
2023-06-13 8:26 ` Kasireddy, Vivek
2023-06-13 12:25 ` David Laight
2023-06-13 17:51 ` David Hildenbrand
2023-06-14 3:40 ` Hugh Dickins
2023-06-14 7:51 ` Kasireddy, Vivek
2023-06-15 9:48 ` David Hildenbrand [this message]
2023-06-19 12:35 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=015062b6-2d4a-7b91-8f64-1695f526f794@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dongwon.kim@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=hughd@google.com \
--cc=jmarchan@redhat.com \
--cc=jthoughton@google.com \
--cc=junxiao.chang@intel.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=muchun.song@linux.dev \
--cc=qemu-devel@nongnu.org \
--cc=stable@vger.kernel.org \
--cc=vivek.kasireddy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).