From: Pavel Tatashin <pasha.tatashin@soleen.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
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, John Hubbard <jhubbard@nvidia.com>
Subject: Re: Pinning ZONE_MOVABLE pages
Date: Mon, 23 Nov 2020 11:31:59 -0500 [thread overview]
Message-ID: <CA+CK2bBuEhH7cSEZUKTYE_g9mw_rwEG-v1Jk4BL6WuLWK824Aw@mail.gmail.com> (raw)
In-Reply-To: <d668b0f2-2644-0f5e-a8c1-a6b8f515e9ab@suse.cz>
> Makes sense, as this means no userspace change.
>
> > 2. Add an internal move_pages_zone() similar to move_pages() syscall
> > but instead of migrating to a different NUMA node, migrate pages from
> > ZONE_MOVABLE to another zone.
> > Call move_pages_zone() on demand prior to pinning pages from
> > vfio_pin_map_dma() for instance.
>
> As others already said, migrating away before the longterm pin should be
> the solution. IIRC it was one of the goals of long term pinning api
> proposed long time ago by Peter Ziljstra I think? The implementation
> that was merged relatively recently doesn't do that (yet?) for all
> movable pages, just CMA, but it could.
From what I can tell, CMA is not solving exactly this problem. It
migrates pages from CMA before pinning, but it migrates them to
ZONE_MOVABLE. Also, we still need to take care of the fault scenario.
>
> > 3. Perhaps, it also makes sense to add madvise() flag, to allocate
> > pages from non-movable zone. When a user application knows that it
> > will do DMA mapping, and pin pages for a long time, the memory that it
> > allocates should never be migrated or hot-removed, so make sure that
> > it comes from the appropriate place.
> > The benefit of adding madvise() flag is that we won't have to deal
> > with slow page migration during pin time, but the disadvantage is that
> > we would need to change the user interface.
>
> It's best if we avoid involving userspace until it's shown that's it's
> insufficient.
Agree.
Thank you,
Pasha
next prev parent reply other threads:[~2020-11-23 16:33 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
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 [this message]
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+CK2bBuEhH7cSEZUKTYE_g9mw_rwEG-v1Jk4BL6WuLWK824Aw@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=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--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).