From: Andrea Arcangeli <andrea@suse.de>
To: Rik van Riel <riel@conectiva.com.br>
Cc: Peter Zaitsev <pz@spylog.ru>, Andrew Morton <akpm@zip.com.au>,
theowl@freemail.c3.hu, theowl@freemail.hu,
linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@transmeta.com>
Subject: Re: your mail on mmap() to the kernel list
Date: Tue, 4 Dec 2001 17:55:04 +0100 [thread overview]
Message-ID: <20011204175504.E3447@athlon.random> (raw)
In-Reply-To: <16498470022.20011204183624@spylog.ru> <Pine.LNX.4.33L.0112041439210.4079-100000@imladris.surriel.com>
In-Reply-To: <Pine.LNX.4.33L.0112041439210.4079-100000@imladris.surriel.com>; from riel@conectiva.com.br on Tue, Dec 04, 2001 at 02:42:28PM -0200
On Tue, Dec 04, 2001 at 02:42:28PM -0200, Rik van Riel wrote:
> On Tue, 4 Dec 2001, Peter Zaitsev wrote:
> > Tuesday, December 04, 2001, 5:15:49 PM, you wrote:
>
> > AA> You can fix the problem in userspace by using a meaningful 'addr' as
> > AA> hint to mmap(2), or by using MAP_FIXED from userspace, then the kernel
> > AA> won't waste time searching the first available mapping over
> > AA> TASK_UNMAPPED_BASE.
>
> > Well. Really you can't do this, because you can not really track all of
> > the mappings in user program as glibc and probably other libraries
> > use mmap for their purposes.
>
> There's no reason we couldn't do this hint in kernel space.
>
> In arch_get_unmapped_area we can simply keep track of the
> lowest address where we found free space, while on munmap()
> we can adjust this hint if needed.
>
> OTOH, I doubt it would help real-world workloads where the
> application maps and unmaps areas of different sizes and
> actually does something with the memory instead of just
> mapping and unmapping it ;)))
exactly, while that would be simple to implement and very lightweight at
runtime, that's not enough to mathematically drop the complexity of the
get_unmapped_area algorithm. It would optimize only the case where
there's no fragmentation of the mapped virtual address space.
For finding the best fit in the heap with O(log(N)) complexity (rather
than the current O(N) complexity of the linked list) one tree indexed by
the size of each hole would be necessary.
Andrea
next prev parent reply other threads:[~2001-12-04 16:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3C082244.8587.80EF082@localhost>
2001-12-01 8:31 ` Re[2]: your mail on mmap() to the kernel list Peter Zaitsev
2001-12-01 9:37 ` Andrew Morton
2001-12-02 23:07 ` Re[2]: " Peter Zaitsev
2001-12-02 23:34 ` Andrew Morton
2001-12-03 10:10 ` Re[2]: " Peter Zaitsev
2001-12-04 14:18 ` Andrea Arcangeli
2001-12-04 14:15 ` Andrea Arcangeli
2001-12-04 15:36 ` Re[2]: " Peter Zaitsev
2001-12-04 16:42 ` Rik van Riel
2001-12-04 16:55 ` Andrea Arcangeli [this message]
2001-12-05 14:38 ` Peter Zaitsev
2001-12-05 14:36 ` Re[3]: " Peter Zaitsev
2001-12-04 16:48 ` Andrea Arcangeli
2001-12-05 16:12 ` Re[2]: " Peter Zaitsev
2001-12-05 16:23 ` 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=20011204175504.E3447@athlon.random \
--to=andrea@suse.de \
--cc=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=pz@spylog.ru \
--cc=riel@conectiva.com.br \
--cc=theowl@freemail.c3.hu \
--cc=theowl@freemail.hu \
--cc=torvalds@transmeta.com \
/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