linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: David Hildenbrand <david@redhat.com>
Cc: lsf-pc@lists.linux-foundation.org,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Michal Hocko <mhocko@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>
Subject: Re: [LSF/MM/BPF TOPIC] MM: Mapcount Madness
Date: Mon, 29 Jan 2024 13:49:30 +0000	[thread overview]
Message-ID: <Zbes6l0zn7gzu216@casper.infradead.org> (raw)
In-Reply-To: <049e4674-44b6-4675-b53b-62e11481a7ce@redhat.com>

On Mon, Jan 29, 2024 at 01:05:04PM +0100, David Hildenbrand wrote:
> As PTE-mapped large folios become more relevant (mTHP [1]) and there is the
> desire to shrink the metadata allocated for such large folios as well
> (memdesc [2]), how we track folio mappings gets more relevant. Over the
> years, we used folio mapping information to answer various questions: is
> this folio mapped by somebody else? do we have to COW on write fault? how do
> we adjust memory statistics? ...
> 
> Let's talk about ongoing work in the mapcount area, get a common
> understanding of what the users of the different mapcounts are and what the
> implications of removing some would be: which questions could we answer
> differently, which questions would we not be able to answer precisely
> anymore, and what would be the implications of such changes?
> 
> For example, can we tolerate some imprecise memory statistics? How
> expressive is the PSS when large folios are only partially mapped? Would we
> need a transition period and glue changes to a new CONFIG_ option? Do we
> really have to support THP and friends on 32bit?

Excellent topics to cover.  I have some of my own questions ...

Are we in danger of overflowing page refcount too easily?  Pincount
isn't an issue here; we're talking about large folios, so pincount gets
its own field.  But with tracking one mapcount per PTE mapping of a
folio, we can easily increment a PMD-sized folio's refcount by 512
per VMA.  Now we only need 2^22 VMAs to hit the 2^31 limit before the
page->refcount protections go into effect and operations start failing.

How / do we need to track mapcount for pages mapped to userspace which
are neither file-backed, nor anonymous mappings?  eg drivers pass
vmalloc memory to vmf_insert_page() in their ->mmap handler.

What do VM_PFNMAP and VM_MIXEDMAP really imply?  The documentation here
is a little sparse.  And that's sad, because I think we expect device
driver writers to use them, and without clear documentation of what
they actually do, they're going to be misused.


  reply	other threads:[~2024-01-29 13:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 12:05 [LSF/MM/BPF TOPIC] MM: Mapcount Madness David Hildenbrand
2024-01-29 13:49 ` Matthew Wilcox [this message]
2024-01-29 14:09   ` David Hildenbrand
2024-02-01 16:17   ` Jason Gunthorpe

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=Zbes6l0zn7gzu216@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=dan.j.williams@intel.com \
    --cc=david@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=lsf-pc@lists.linux-foundation.org \
    --cc=mhocko@kernel.org \
    /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).