Subject: shared library slowdown workaround
To: None <port-sparc@netbsd.org>
From: Theo de Raadt <deraadt@fsa.ca>
List: port-sparc
Date: 11/26/1994 16:43:40
Ok, I've got a workaround for the shared library slowdown.  (I
understand it now, and will come up with a cleaner fix soon.)

Apply this and build a new kernel. If you are doing compiles at the
same time, you should notice that vi runs faster. vi is one of those
programs that maps libc later on, therefore libc was getting a
different address, and many times that address was cache-unfriendly.

vi:
        -lcurses.2 => /usr/lib/libcurses.so.2.1 (0x40a2000)
        -ltermlib.0 => /usr/lib/libtermlib.so.0.0 (0x40b0000)
        -lutil.3 => /usr/lib/libutil.so.3.1 (0x40b4000)
        -lc.12 => /usr/lib/libc.so.12.0 (0x40b8000)

now everything is mapped on a cache-friendly address, which the
pmap/cache code no longer thinks to be BADALIAS()'ed

*** vm_mmap.c~	Sun Oct 30 11:00:34 1994
--- vm_mmap.c	Sat Nov 26 16:34:53 1994
***************
*** 237,244 ****
  	 * There should really be a pmap call to determine a reasonable
  	 * location.
  	 */
! 	else if (addr < round_page(p->p_vmspace->vm_daddr + MAXDSIZ))
  		addr = round_page(p->p_vmspace->vm_daddr + MAXDSIZ);
  	if (flags & MAP_ANON) {
  		/*
  		 * Mapping blank space is trivial.
--- 237,248 ----
  	 * There should really be a pmap call to determine a reasonable
  	 * location.
  	 */
! 	else if (addr < round_page(p->p_vmspace->vm_daddr + MAXDSIZ)) {
  		addr = round_page(p->p_vmspace->vm_daddr + MAXDSIZ);
+ #ifdef sparc
+ 		addr = roundup(addr, 0x10000);
+ #endif
+ 	}
  	if (flags & MAP_ANON) {
  		/*
  		 * Mapping blank space is trivial.