From: Andrea Arcangeli <andrea@suse.de>
To: Hugh Dickins <hugh@veritas.com>
Cc: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: anon-vma (and now filebacked-mappings too) mprotect vma merging [Re: 2.6.5-rc2-aa vma merging]
Date: Sat, 3 Apr 2004 19:24:26 +0200 [thread overview]
Message-ID: <20040403172426.GJ2307@dualathlon.random> (raw)
In-Reply-To: <Pine.LNX.4.44.0404031727320.10197-100000@localhost.localdomain>
On Sat, Apr 03, 2004 at 06:06:49PM +0100, Hugh Dickins wrote:
> It does look more complicated than I'd hoped, a lot of that coming from
> the file-backed merging: which I like, but, we could have done it at
> any point over the last couple of years if someone had a need for it.
> Fair enough, you've discovered a need, at the same time that you have
> to attend to vm_pgoff for anons, so it makes sense to do them together.
the point is that *nobody* has a need for it, nor for the anonymous, nor
for the filebacked mappings. It's just an "optimization", not a real
need.
You're right it's not trivial, but as you can see 95% of the complexity
comes from the filebacked merging, the anon-vma merging adds up to 5% of
the complexity (i.e. calling is_mergeable_anon_vma before proceeding and
then calling anon_vma_merge while nuking the superflous vma).
> Do you realize that you could allocate just a single anon_vma to
> the mm at fork time, for all the pure anon vmas created in it later?
> And then no need for propagating anon_vma from adjacent vma, they'd
> all have the right one already and be mergeable anyway. But I think
> you'll reject that on two grounds: you want to merge the file-backed
> vmas as much as is reasonable, so you need the code anyway for them;
> and you'd prefer your anon_vma lists to be as short as possible, to
> minimize searching at page_referenced/try_to_unmap time.
>
> Clearly there's a tension between keeping the anon_vma lists short,
> and leaving the vmas mergable: it's natural that we should differ on
> where to strike that balance, having come to it from opposite ends.
exactly. the cost of the anonvmas is absolutely non measurable, so while
it makes sense to share the sane anon_vma for adiancent mappings that
differs only for the page protection flags, I don't want to share
anything else to boost the reverse lookup performance. I want it as
finegrined as possible, not just to have few vmas, but also to track
_only_ the interesting MM in the group, something anonmm will never be
able to do, except when the page has mapcount == 1. Sharing the same
anon_vma for everything would just slowdown the lookup, in practice
there would be no more merging at all. I believe being as finegrined as
possible will payoff, maybe one day we may even be ok to pay for some
more byte in the vma for a prio_tree on top of the anon_vma, to speedup
the lookup as much as possible (today it would only waste ram IMO). Plus
I love being able to handle mremap trasparently by-design. The ugliness
of doing a swapin + copy and calling handle_mm_fault in mremap is pretty
bad IMO. some more byte per-vma is not a problem and it'll never be
noticeable, just like not merging non adiacent mappings will never be
noticeable. So I believe the few bytes per vma are worth it, plus now it
does filebacked mprotect merging too.
next prev parent reply other threads:[~2004-04-03 17:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Pine.LNX.4.44.0403291957240.19124-100000@localhost.localdomain>
2004-03-29 19:45 ` 2.6.5-rc2-aa vma merging Hugh Dickins
2004-04-02 11:34 ` Hugh Dickins
2004-04-02 15:35 ` Andrea Arcangeli
2004-04-03 1:26 ` anon-vma (and now filebacked-mappings too) mprotect vma merging [Re: 2.6.5-rc2-aa vma merging] Andrea Arcangeli
2004-04-03 17:06 ` Hugh Dickins
2004-04-03 17:24 ` Andrea Arcangeli [this message]
2004-04-03 18:46 ` Andrea Arcangeli
2004-04-03 19:29 ` Hugh Dickins
2004-04-04 1:01 ` Andrea Arcangeli
2004-04-04 1:13 ` Andrew Morton
2004-04-04 1:32 ` Andrea Arcangeli
2004-04-04 1:43 ` Andrew Morton
2004-04-04 1:55 ` Andrea Arcangeli
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=20040403172426.GJ2307@dualathlon.random \
--to=andrea@suse.de \
--cc=akpm@osdl.org \
--cc=hugh@veritas.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.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