linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh@veritas.com>
To: Thayne Harbaugh <thayne@c2.net>
Cc: Andi Kleen <andi@firstfloor.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	discuss@x86-64.org
Subject: Re: [PATCH] Inconsistent mmap()/mremap() flags
Date: Tue, 2 Oct 2007 13:19:15 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0710021304230.26719@blonde.wat.veritas.com> (raw)
In-Reply-To: <1191308772.5200.66.camel@phantasm.home.enterpriseandprosperity.com>

On Tue, 2 Oct 2007, Thayne Harbaugh wrote:
> On Tue, 2007-10-02 at 07:15 +0200, Andi Kleen wrote:
> 
> > For mmap you can emulate it by passing a low hint != 0 (e.g. getpagesize()) 
> > in address but without MAP_FIXED and checking if the result is not beyond
> > your range.
> 
> Cool.  That's a much better solution for multiple reasons - like you
> mention, MAP_32BIT is only 2GB as well as it's only available on x86_64.
> 
> > > > Given for mremap() it is not that easy because there is no "hint" argument
> > > > without MREMAP_FIXED; but unless someone really needs it i would prefer
> > > > to not propagate the hack. If it's really needed it's probably better
> > > > to implement a start search hint for mremap()

I think you can do it already, without us complicating mremap further
with such a start search hint.

First call mmap with a low hint address, the new size you'll be wanting
from the mremap, PROT_NONE, MAP_ANONYMOUS, -1, 0.  Then call mremap with
old address, old size, new size, MREMAP_MAYMOVE|MREMAP_FIXED, and new
address as returned by the preparatory mmap.

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-10-02 12:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-28  5:46 Thayne Harbaugh
2007-10-01 11:13 ` Andi Kleen
2007-10-02  2:57   ` Thayne Harbaugh
2007-10-02  5:15     ` Andi Kleen
2007-10-02  7:06       ` Thayne Harbaugh
2007-10-02 12:19         ` Hugh Dickins [this message]
2007-10-02 13:45           ` [discuss] " Andi Kleen
2007-10-02 14:16             ` Hugh Dickins
2007-10-02 15:21               ` Thayne Harbaugh

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.64.0710021304230.26719@blonde.wat.veritas.com \
    --to=hugh@veritas.com \
    --cc=andi@firstfloor.org \
    --cc=discuss@x86-64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=thayne@c2.net \
    /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