public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
From: raeburn@cygnus.com
To: gas2@cygnus.com
Cc: bfd@cygnus.com
Subject: mmap changes, mostly for aout right now
Date: Mon, 06 Nov 1995 03:20:00 -0000	[thread overview]
Message-ID: <199511061119.GAA06769@kr-laptop.cygnus.com> (raw)

I've just checked in now some changes to bfd to use mmap for reading
files under certain circumstances.  A snapshot file should be available
within the next hour or so.  Please try it out and let me know of any
problems.

Currently the "certain circumstances" are limited to string and symbol
table reading for a.out formats, but the interfaces are available to
eventually be used by other formats as well.  There's some preliminary
code to support reading section contents via mmap, but it's not really
tested, and not used anywhere at the moment.  It's also not quite set up
right for optimal use by the linker; that'll take a little bit more work.

These changes add new interfaces for accessing file contents, where the
memory management is under the control of the BFD library rather than the
application.  This lets BFD determine whether mmap can be used or if
malloc/seek/read must be used, transparently to the application.

My tests on sun4 and linux(aout), using local disk, indicate some small
improvement using mmap compared with the old code, even though only
symbol and string tables are accessed this way.

Under NetBSD (on i386), I saw no significant change in CPU time used
(though my test case was different -- many more small files in and out of
libraries).  The linker does seem to work now, after a linker change I
checked in yesterday, based on some changes from Niklas Hallqvist; please
exercise that too.  The linker still takes about half again as much CPU
time as the system (pre-BFD) one, though the system one took more
wall-clock time in my tests than the BFD one, and the mmap changes
reduced the wall-clock time further still.  (I *think* the system was
otherwise idle, but there may have been some cron jobs running, so I
don't consider those last observations to necessarily be significant.)
The BFD linker can generate smaller `-g' executables than the pre-BFD one
due to the string table massaging it does.

Under Linux, using (a.out) object files read and stored over NFS, the
performance got worse using mmap.  My guess is that this is a Linux
problem.  I'm told the Linux NFS client code isn't particularly
spectacular, and I don't know what the mmap support is like.  Maybe some
use of madvise would help?

On host systems where mmap is not available, you'll get a slight
performance degradation compared with the older code.  But I think mmap
is likely to be available on most of the systems we care about these
days, so the tradeoff seems reasonable.

If mmap isn't available or doesn't work right on your system, and the
bfd/configure script doesn't detect that, please try to come up with a
test that does detect the problem.

There's still plenty of room for improving this code.  Using it in more
places, more efficient handling of mapping, perhaps mapping the entire
file in read-only, maybe using madvise, not modifying data in place after
it's mapped in, etc.

Like I said, let me know of any problems....

Ken


             reply	other threads:[~1995-11-06  3:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-11-06  3:20 raeburn [this message]
1995-11-07  9:39 ` Richard Stallman
1995-11-07 17:10 Arne H. Juul
1995-11-08 12:47 ` Ken Raeburn

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=199511061119.GAA06769@kr-laptop.cygnus.com \
    --to=raeburn@cygnus.com \
    --cc=bfd@cygnus.com \
    --cc=gas2@cygnus.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).