This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Last data page not being filled
- From: "D. J. Bernstein" <djb at cr dot yp dot to>
- To: binutils at sources dot redhat dot com
- Date: 27 Jun 2003 11:27:26 -0000
- Subject: Last data page not being filled
- Automatic-legal-notices: See http://cr.yp.to/mailcopyright.html.
- References: <20030627070845.6759.qmail@cr.yp.to>
When a program has (to take a real example) 220 bytes of initialized
data and 444 bytes of zero-filled data, the GNU tools put the 220 bytes
into the data segment and the 444 bytes into the bss segment, frittering
away a page of memory per process. They should instead put all 664 bytes
into the data segment.
The general rule is simple: as long as there's something in bss that
fits into the last page of data, move it to the last page of data and
repeat, unless the user explicitly asks for different behavior.
(The reason I care about a page per process is that I'm building systems
on the scale of ten thousand processes. Each process has its own uid,
and memory protection is crucial, so please don't suggest threads.)
---D. J. Bernstein, Associate Professor, Department of Mathematics,
Statistics, and Computer Science, University of Illinois at Chicago