From: "Petr Vandrovec" <VANDROVE@vc.cvut.cz>
To: Wayne Whitney <whitney@math.berkeley.edu>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: Repost: could ia32 mmap() allocations grow downward?
Date: Thu, 13 Dec 2001 18:36:43 MET-1 [thread overview]
Message-ID: <BE42B9D5208@vcnet.vc.cvut.cz> (raw)
On 13 Dec 01 at 8:22, Wayne Whitney wrote:
> > So maybe MAGMA uses some API which it should not use under any
> > circumstances... Such as that you linked it with libc6 stdio.
>
> Indeed. How can I avoid the map at 0x40000000? Must I avoid using
> certain glibc2 functions, and then link the executable carefully to leave
> out their initialization routines? Or can I set some magic environment
It is caused by (I think that stupid...) code in
glibc-2.2.4/libio/libioP.h:ALLOC_BUF(), which unconditionally does
'mmap(0, ROUND_TO_PAGE(size), PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0)' instead of 'malloc(size)' when it finds that underlying system
supports malloc.
If you linked Magma yourself, try adding:
---
#include <malloc.h>
void* malloc(size_t len) { return sbrk(len); }
void* __mmap(void* start, size_t len, int prot, int flags, int fd,
unsigned long offset) {
if (start == 0 && fd == -1) { return malloc(len); }
return NULL;
}
---
into your project. It forces my 'void main() { printf("X\n"); pause(); }'
to use brk() instead of mmap() for stdio buffers. Maybe we should move
to bug-glibc instead, as there is no way to force stdio to not ignore
mallopt() parameters, it still insist on using mmap, and I think that it
is a glibc2.2 bug.
Petr Vandrovec
vandrove@vc.cvut.cz
P.S.: I did some testing, and about 95% of mremap() allocations is
targeted to last VMA, so no VMA move is needed for them. But no Java
was part of picture, only c/c++ programs I use - gcc, mc, perl.
next reply other threads:[~2001-12-13 17:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-13 18:36 Petr Vandrovec [this message]
2001-12-13 18:03 ` Repost: could ia32 mmap() allocations grow downward? Wayne Whitney
-- strict thread matches above, loose matches on Subject: below --
2001-12-13 20:13 Petr Vandrovec
2001-12-13 11:27 Petr Vandrovec
2001-12-13 16:22 ` Wayne Whitney
2001-12-13 16:54 ` Wayne Whitney
2001-12-13 17:10 ` Hugh Dickins
2001-12-13 17:38 ` Wayne Whitney
2001-12-13 18:02 ` Hugh Dickins
2001-12-12 21:47 Petr Vandrovec
2001-12-13 6:28 ` Wayne Whitney
2001-12-12 20:02 Wayne Whitney
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=BE42B9D5208@vcnet.vc.cvut.cz \
--to=vandrove@vc.cvut.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=whitney@math.berkeley.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.