From: Pavel Tatashin <pasha.tatashin@soleen.com>
To: David Rientjes <rientjes@google.com>
Cc: linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Vlastimil Babka <vbabka@suse.cz>,
LKML <linux-kernel@vger.kernel.org>,
Michal Hocko <mhocko@suse.com>,
David Hildenbrand <david@redhat.com>,
Oscar Salvador <osalvador@suse.de>,
Dan Williams <dan.j.williams@intel.com>,
Sasha Levin <sashal@kernel.org>,
Tyler Hicks <tyhicks@linux.microsoft.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
sthemmin@microsoft.com
Subject: Re: Pinning ZONE_MOVABLE pages
Date: Mon, 23 Nov 2020 10:31:16 -0500 [thread overview]
Message-ID: <CA+CK2bBkRmm+ex5pfD7s8LGQLYCwO1EHPNeQ+pGW=ztb6AfVqA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.23.453.2011221300100.2830030@chino.kir.corp.google.com>
> > I've spoken with Stephen Hemminger, and he said that DPDK is moving in
> > the direction of using transparent huge pages instead of HugeTLBs,
> > which means that we need to allow at least anonymous, and anonymous
> > transparent huge pages to come from non-movable zones on demand.
> >
>
> I'd like to know more about this use case, ZONE_MOVABLE is typically a
> great way to optimize for thp availability because, absent memory pinning,
> this memory can always be defragmented. So the idea is that DPDK will now
> allocate all of its thp from ZONE_NORMAL or only a small subset? Seems
> like an invitation for oom kill if the sizing of ZONE_NORMAL is
> insufficient.
The idea is to allocate only those THP and anon pages that are long
term pinned from ZONE_NORMAL, the rest can still be allocated from
ZONE_MOVABLE.
>
> > Here is what I am proposing:
> > 1. Add a new flag that is passed through pin_user_pages_* down to
> > fault handlers, and allow the fault handler to allocate from a
> > non-movable zone.
> >
> > Sample function stacks through which this info needs to be passed is this:
> >
> > pin_user_pages_remote(gup_flags)
> > __get_user_pages_remote(gup_flags)
> > __gup_longterm_locked(gup_flags)
> > __get_user_pages_locked(gup_flags)
> > __get_user_pages(gup_flags)
> > faultin_page(gup_flags)
> > Convert gup_flags into fault_flags
> > handle_mm_fault(fault_flags)
> >
> > From handle_mm_fault(), the stack diverges into various faults,
> > examples include:
> >
> > Transparent Huge Page
> > handle_mm_fault(fault_flags)
> > __handle_mm_fault(fault_flags)
> > Create: struct vm_fault vmf, use fault_flags to specify correct gfp_mask
> > create_huge_pmd(vmf);
> > do_huge_pmd_anonymous_page(vmf);
> > mm_get_huge_zero_page(vma->vm_mm); -> flag is lost, so flag from
> > vmf.gfp_mask should be passed as well.
> >
> > There are several other similar paths in a transparent huge page, also
> > there is a named path where allocation is based on filesystems, and
> > the flag should be honored there as well, but it does not have to be
> > added at the same time.
> >
> > Regular Pages
> > handle_mm_fault(fault_flags)
> > __handle_mm_fault(fault_flags)
> > Create: struct vm_fault vmf, use fault_flags to specify correct gfp_mask
> > handle_pte_fault(vmf)
> > do_anonymous_page(vmf);
> > page = alloc_zeroed_user_highpage_movable(vma, vmf->address); ->
> > replace change this call according to gfp_mask.
> >
>
> This would likely be useful for AMD SEV as well, which requires guest
> pages to be pinned because the encryption algorithm depends on the host
> physical address. This ensures that plaintext memory for two pages don't
> result in the same ciphertext.
next prev parent reply other threads:[~2020-11-23 15:32 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-20 20:27 Pinning ZONE_MOVABLE pages Pavel Tatashin
2020-11-20 20:59 ` David Hildenbrand
2020-11-20 21:17 ` Matthew Wilcox
2020-11-20 21:34 ` David Hildenbrand
2020-11-20 21:53 ` Pavel Tatashin
2020-11-20 21:58 ` Pavel Tatashin
2020-11-20 22:06 ` David Hildenbrand
2020-11-22 21:06 ` David Rientjes
2020-11-23 15:31 ` Pavel Tatashin [this message]
2020-11-23 9:01 ` Michal Hocko
2020-11-23 16:06 ` Pavel Tatashin
2020-11-23 17:15 ` Jason Gunthorpe
2020-11-23 17:54 ` Pavel Tatashin
2020-11-23 18:34 ` Jason Gunthorpe
2020-11-24 8:20 ` Michal Hocko
2020-11-23 15:04 ` Vlastimil Babka
2020-11-23 16:31 ` Pavel Tatashin
2020-11-24 8:24 ` Michal Hocko
2020-11-24 8:43 ` Michal Hocko
2020-11-24 8:44 ` David Hildenbrand
2020-11-24 6:49 ` John Hubbard
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='CA+CK2bBkRmm+ex5pfD7s8LGQLYCwO1EHPNeQ+pGW=ztb6AfVqA@mail.gmail.com' \
--to=pasha.tatashin@soleen.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=david@redhat.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=rientjes@google.com \
--cc=sashal@kernel.org \
--cc=sthemmin@microsoft.com \
--cc=tyhicks@linux.microsoft.com \
--cc=vbabka@suse.cz \
/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).