Subject: pmap_copy() is a lose
To: None <tech-kern@netbsd.org>
From: Charles M. Hannum <root@ihack.net>
List: tech-kern
Date: 06/15/2000 09:38:37
It seems that pmap_copy() causes a severe performance loss. When I
try the following:
sh -c 'for f in `jot 10000 0`; do (); done'
sh -c 'for f in `jot 1000000 0`; do (); done'
on a particular i386 system, I see ~485 forks/sec for 10000, and ~64
forks/sec for 1000000. The ONLY difference here is that the shell
that's forking has a larger heap.
If, OTOH, I disable pmap_copy() (by just changing the first
instruction of pmap_transfer() to a RET in DDB), I see ~513 and ~171
forks/sec, respectively.
That's down from nearly 8:1 to 3:1. Also, you can see that the change
has much less effect on the smaller shell.
It seems to me that this is probably a common case. In addition,
prefaulting should prevent most of the performance loss that you might
otherwise get from doing additional faults in the child -- and of
course if you're actually modifying data, you'd end up taking a fault
anyway.
So, I've disabled pmap_copy() on the i386 port. I suggest that
port-masters do the same for other ports which implement it.
That said, fork() still needs some more optimization.