Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Nov 2001 09:15:00 -0500 (EST)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        freebsd-alpha@freebsd.org
Subject:   Re: mprotect() takes quite long -- anyone knows this?
Message-ID:  <15363.40932.514960.451222@grasshopper.cs.duke.edu>
In-Reply-To: <20011126132537.A10631@kiste.thiemo.net>
References:  <20011126132537.A10631@kiste.thiemo.net>

next in thread | previous in thread | raw e-mail | index | archive | help

Thiemo Nordenholz writes:
 > -=======================================================================-
 > 
 > 74[thiemo@myg:~]> time w
 >  1:15PM  up 2 days, 12:16, 1 user, load averages: 0.04, 0.07, 0.02
 >  USER             TTY      FROM              LOGIN@  IDLE WHAT
 >  thiemo           p0       somewhere         11:28AM     - w
 >  0.882u 0.094s 0:00.99 97.9%     29+199k 0+0io 0pf+0w
 > 
 > then, from a "ktrace w":
 > 
 > 77[thiemo@myg:~]> kdump -R | grep mprotect
 >  52860 w        0.004988 CALL  mprotect(0x160062000,0xc2000,0x7)
 >  52860 w        0.000581 RET   mprotect 0
 >  52860 w        0.865540 CALL  mprotect(0x160062000,0xc2000,0x5)
 >  52860 w        0.001066 RET   mprotect 0
 > 
 > -=======================================================================-
 > 
 > Isn't this a bit long for a syscall? What's going on here? Defective memory?

I think you might be interpreting this incorrectly.  The time of
nearly a second is spent in userland.  This is almost certainly in the
function relocate_objects() in rtld_elf().  More specifically, its
probably in reloc_non_plt() (which is in between the calls to
mprotect().


Coincidentally, Doug Rabson fixed a bug in the rtld in October:

  The support for accelerating find_symdef() with a cache was
  broken. This fixes the problem and improves startup times for large
  applications such as KDE2 considerably.

This was MFC'ed to -stable on Oct 17th -- I'd suggest that you update
src/libexec/rtld-elf/alpha/reloc.c to 1.10.2.3 and rebuild your rtld.

It has made a big difference for KDE for me on a 21264, it may improve
normal apps on your (painfully slow) 21066.

FWIW, I don't pretend to understand the rtld, but I do know that when
I start w (on a recent -STABLE system), I do not see any mprotects, so
perhaps no relocations are being done:

% ktrace /usr/bin/w
 9:06AM  up 58 mins, 1 user, load averages: 0.10, 0.06, 0.01
USER             TTY      FROM              LOGIN@  IDLE WHAT
gallatin         v0       -                 8:10AM    55 xinit /home/gallatin/.
% kdump | grep mprotect
%


 > Other flaws? Just me being too impatioent? A week ago, the Alpha ran just
 > fine under OpenBSD 2.3 (old and bah) -- but I want to make it running
 > FreeBSD as well...

Does OpenBSD 2.3 even support shared libs?  If it does, its rtld is
almost certain to be simpler..

Drew

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15363.40932.514960.451222>