Subject: more on exit performance
To: None <tech-perform@netbsd.org>
From: Chuck Silvers <chuq@chuq.com>
List: tech-perform
Date: 11/01/2003 18:18:05
with today's -current, here's what I see in the fork+exit benchmark:

  %   cumulative   self              self     total           
 time   seconds   seconds    calls  us/call  us/call  name    
 38.07     12.49    12.49                             mpidle
  9.75     15.69     3.20     3904   819.67   823.75  find_stopped_child
  7.07     18.01     2.32   155303    14.94    14.94  pool_do_put
  6.19     20.04     2.03   153086    13.26    13.33  pool_get
  2.96     21.01     0.97                             Xspllower
  2.44     21.81     0.80  1762987     0.45     0.45  pvtree_SPLAY
  1.98     22.46     0.65    33912    19.17    19.17  memcpy
  1.77     23.04     0.58    70476     8.23    12.45  pmap_clear_attrs
  1.74     23.61     0.57   372770     1.53     2.97  pmap_enter
  1.40     24.07     0.46    21585    21.31    21.31  memset
  1.01     24.40     0.33   105989     3.11    51.64  uvm_fault

find_stopped_child() walks a linked-list of the proc's children.
there are several ways to improve this:

 (1) for (pid > 0), we can just look the pid up in the pid_table
     instead of finding it via the parent.

 (2) for (pid == -1), we can keep the stopped and dead children on
     separate lists, and only look at the list(s) that we care about.

 (3) for (pid < -1), we can similarly look up the pgrp in pid_table
     and keep the stopped and dead children on separate lists in the pgrp.

anyone want to implement this?

-Chuck