From owner-freebsd-alpha Tue Nov 27 6:15:37 2001 Delivered-To: freebsd-alpha@freebsd.org Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) by hub.freebsd.org (Postfix) with ESMTP id 0F9E637B416 for ; Tue, 27 Nov 2001 06:15:31 -0800 (PST) Received: from grasshopper.cs.duke.edu (grasshopper.cs.duke.edu [152.3.145.30]) by duke.cs.duke.edu (8.9.3/8.9.3) with ESMTP id JAA03279 for ; Tue, 27 Nov 2001 09:15:26 -0500 (EST) Received: (from gallatin@localhost) by grasshopper.cs.duke.edu (8.11.3/8.9.1) id fAREF0m76764; Tue, 27 Nov 2001 09:15:00 -0500 (EST) (envelope-from gallatin@cs.duke.edu) From: Andrew Gallatin MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15363.40932.514960.451222@grasshopper.cs.duke.edu> Date: Tue, 27 Nov 2001 09:15:00 -0500 (EST) To: freebsd-alpha@freebsd.org Subject: Re: mprotect() takes quite long -- anyone knows this? In-Reply-To: <20011126132537.A10631@kiste.thiemo.net> References: <20011126132537.A10631@kiste.thiemo.net> X-Mailer: VM 6.75 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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