From: "David S. Miller" <davem@redhat.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: mincore on anon mappings
Date: Sat, 19 Jun 2004 11:54:11 -0700 [thread overview]
Message-ID: <20040619115411.736cf787.davem@redhat.com> (raw)
In-Reply-To: <20040619162503.GC12019@dualathlon.random>
On Sat, 19 Jun 2004 18:25:03 +0200
Andrea Arcangeli <andrea@suse.de> wrote:
> here a first (untested) attempt to allow mincore on anon vmas too.
>
> I heard you need this from gcc, right?
Sort of. What I think we really need is a new MAP_FIXED that
doesn't wipe out existing mappings.
The issue is that architectures make decisions about passed in
"hint" addresses based upon cache aliasing concerns sometimes.
You can bypass that by using MAP_FIXED, but MAP_FIXED has the nasty
side effect of zapping existing mappings. That's not what the user
wants in this case, the user here wants to tell the cache aliasing
virtual address hint changing logic to just go away.
mincore() is a really inefficient way to accomplish what GCC wants.
What gcc would do with this is basically:
addr = mmap(request_address, ..., len, ...);
if (addr == MMAP_FAIL) {
use_mincore_to_see_if_area_free(request_address, len);
if (really_is_free)
addr = mmap( ... | MAP_FIXED );
}
See? That's terribly inefficient.
Basically what GCC is trying to do is mmap a file at a fixed location.
Per-architecture get_unmapped_area() implementations will change the
requested address, unless MAP_FIXED is set, in order to more efficiently
handle cache aliasing issues in data caches. Using MAP_FIXED has the
unwanted side-effect of munmap()'ing any existing things in that range,
which is not what GCC wants.
Therefore I propose we add a MAP_FORCE which does exactly what GCC wants
which is:
1) The passed in 'hint' address is treated as mandatory, if exactly that
address cannot be used, we fail.
2) Existing areas get in the way, and cause failure.
3) get_unmapped_area() implementations shut off any 'hint' address
modification logic they may have.
I think the mincore() fix is important independant of how GCC eventually
deals with the thing it wants to accomplish.
next prev parent reply other threads:[~2004-06-19 18:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-19 16:25 mincore on anon mappings Andrea Arcangeli
2004-06-19 18:54 ` David S. Miller [this message]
2004-06-19 21:55 ` William Lee Irwin III
[not found] <28R2T-8ld-13@gated-at.bofh.it>
[not found] ` <28Tev-1Bm-23@gated-at.bofh.it>
2004-06-20 0:05 ` Andi Kleen
2004-06-19 22:50 ` David S. Miller
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=20040619115411.736cf787.davem@redhat.com \
--to=davem@redhat.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