Date: Mon, 21 Jun 1999 09:52:23 -0700 (PDT) From: John Polstra <jdp@polstra.com> To: alpha@freebsd.org Subject: ld-elf.so.1 performance fix for large programs on Alpha Message-ID: <XFMail.990621095223.jdp@polstra.com>
next in thread | raw e-mail | index | archive | help
Yesterday I implemented a fix for the problem reported by Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>, in which very large programs (e.g., gdb) ran very slowly on the Alpha due to a dynamic linker problem. It passed the make world test, but I'd feel better if somebody could review it before I commit it. If any of you are willing to do that, please drop me a line and I'll send you the diffs. A brief description of the problem: Large programs on the Alpha exceed the maximum GOT size of 64K. In that case, the linker uses multiple GOTs. Thus two or more GOT entries might point to the same lazy binding stub in the PLT. But on the first call to a lazily bound function, it is only possible for the dynamic linker to find the first GOT entry and fix it up to point directly at the target function. Calls through the other GOT entries still go to the stub code in the PLT. As a result, the dynamic linker goes through the entire lazy binding process on every call that goes through an auxiliary GOT entry. Since that involves searching a bunch of symbol tables, it's very slow. The fix was to rewrite the stubs in the PLT itself during lazy binding. The dynamic linker overwrites the original stub with code that jumps to the target function. With that change, even calls through the auxiliary GOT entries can bypass the lazy binding code. Each PLT entry has room for 3 instructions, and I was able to find a way to generate a jump to the target function in that amount of space, no matter how far away the function is. I believe the rewriting is done in a threadsafe and MP-safe manner, and an IMB instruction is executed after the rewriting is finished to flush the instruction cache. It was a major change, and breaking the dynamic linker is a one-way journey to the fixit floppy. I'd appreciate a review if any of you have the time. John --- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Self-interest is the aphrodisiac of belief." -- James V. DeLong 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?XFMail.990621095223.jdp>