From: Hugh Dickins <hugh@veritas.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: 2.6.5-rc2-aa vma merging
Date: Mon, 29 Mar 2004 20:45:35 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.44.0403292044530.19124-100000@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.44.0403291957240.19124-100000@localhost.localdomain>
Andrea,
Again I beg you to attend to vma merging in your anon_vma tree.
Still you have #if VMA_MERGING_FIXUP throughout mm/mprotect.c
(and much less seriously in mremap.c), and that's just masking
the real problem: that when you do enable vma merging there, your
anon_vmas will get in the way of merging in significant cases.
Try the example below, on mainline and on anonmm and on anon_vma,
even when you've done the VMA_MERGING_FIXUP: you're limited by the
MAX_MAP_COUNT of vmas, one per page. Now, I know there's a move
afoot to have /proc/sys/vm/max_map_count tunable, but I don't
think that's the right answer for you ;)
If I remember rightly, Linus tried to do away with a lot of the
vma merging about three years ago, but some had to be reinstated.
So I assume that what's there is needed, and the example below
does looks plausible enough: add page, fill it, protect it, ...
How to fix this? Clearly you could walk the pages, reassigning
their anon_vmas; but if you're reduced to doing that in the
common mprotect case, you're still worse off than anonmm which
only has to do it in the unusal mremap move case, while it has
to walk the pages anyway.
Until you can deal with this, I believe that the simpler
anonmm method in my anobjrmap patches does the job better:
less change, less overhead, more to the point.
Your anon_vma is good at connecting pages directly to their
vma groups in swapout, where my anonmm has to use find_vma (and
your anon_vma will fit more neatly with Andrew's vision of per-vma
spinlocks, where mine will probably need to down_read_trylock).
But the cost to vma merging seems too high. And besides,
wasn't the point of this objrmap exercise, to move away from
the memory and processing load of pte_chains on the fast paths,
to using more cpu to solve it in the swapout paths?
anonmm does that better.
Hugh
#include <stdio.h>
#include <stdlib.h>
#include <sys/mman.h>
#define PAGE_SIZE 4096
int main(int argc, char *argv[])
{
unsigned long *ptr;
unsigned long pageno = 0;
while (1) {
ptr = mmap(NULL, PAGE_SIZE, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (ptr == MAP_FAILED) {
fflush(stdout);
perror("mmap");
printf("Type <Return> to exit ");
getchar();
exit(1);
}
*ptr = pageno++;
if (mprotect(ptr, PAGE_SIZE, PROT_READ) == -1) {
fflush(stdout);
perror("mprotect");
printf("Type <Return> to exit ");
getchar();
exit(1);
}
printf("%7lu kB\n", (PAGE_SIZE/1024) * pageno);
}
}
next parent reply other threads:[~2004-03-29 19:45 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 ` Hugh Dickins [this message]
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
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=Pine.LNX.4.44.0403292044530.19124-100000@localhost.localdomain \
--to=hugh@veritas.com \
--cc=andrea@suse.de \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®