public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zaitsev <pz@spylog.ru>
To: Andrea Arcangeli <andrea@suse.de>
Cc: 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[2]: your mail on mmap() to the kernel list
Date: Wed, 5 Dec 2001 19:12:03 +0300	[thread overview]
Message-ID: <41187009255.20011205191203@spylog.ru> (raw)
In-Reply-To: <20011204174824.D3447@athlon.random>
In-Reply-To: <3C082244.8587.80EF082@localhost>, <3C082244.8587.80EF082@localhost> <61437219298.20011201113130@spylog.ru> <3C08A4BD.1F737E36@zip.com.au> <20011204151549.U3447@athlon.random> <16498470022.20011204183624@spylog.ru> <20011204174824.D3447@athlon.random>

Hello Andrea,

Tuesday, December 04, 2001, 7:48:24 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

AA> I can do this sometime, I did it in the patch I posted for example.
Well. You're really easy may do this only in such dumb test example
then you do something real between mmaps even memory allocation in
multi threaded program you will not able to track it.

AA>  If
AA> you want transparency and genericity you can still do it in userspace
AA> with an LD_LIBRARY_PATH that loads a libc that builds the hole-lookup
AA> data structure (tree?) internally, and then passes the hint to the
AA> kernel if the program suggests 0.

Well but it's not really easy and right thing to do as you will also
need to write your own memory allocator (as standard one uses mmap so
you can get in recursive loop).  And also it will be really
platform/kernel dependent as different kernels may use different
addresses there user part of address space available for mmaping
starts.

AA> OTOH I prefer those kind of algorithms (if needed) to be in the kernel
AA> so they're faster/cleaner and also a lib would need some magic knowledge
AA> about kernel internals virtual addresses to do it right.
Yes. I'm quite agree with that.  Also if you have one tree implemented
it should not be too hard to have a second tree indexed by other
field.

>> AA> the common case should matter more I guess, and of course userspace can
>> AA> just fix this without any kernel modification by passing an helpful
>> AA> "addr", to the mmap syscall with very very little effort.  Untested
>> AA> patch follows:
>> 
>> Could you please explain a bit how this the hint works ? Does it tries

AA> man 2 mmap, then search for 'start'

I've read it of course :)

>> only specified address or also tries to look up the free space from
>> this point ?

AA> in short it checks if there's 'len' free space at address 'start', and
AA> if there is, it maps it there, without having to search for the first
AA> large enough hole in the heap.

I understand it but does it start so search standard way from the low
addresses or it looks it above the hint address before looking at
lower addresses ?


-- 
Best regards,
 Peter                            mailto:pz@spylog.ru


  reply	other threads:[~2001-12-05 16:12 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
2001-12-05 14:38             ` Re[2]: " Peter Zaitsev
2001-12-05 14:36           ` Re[3]: " Peter Zaitsev
2001-12-04 16:48         ` Andrea Arcangeli
2001-12-05 16:12           ` Peter Zaitsev [this message]
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=41187009255.20011205191203@spylog.ru \
    --to=pz@spylog.ru \
    --cc=akpm@zip.com.au \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --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