kernel - More many-cores SMP work
authorMatthew Dillon <dillon@apollo.backplane.com>
Fri, 28 Oct 2011 06:50:51 +0000 (23:50 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Fri, 28 Oct 2011 06:50:51 +0000 (23:50 -0700)
commitd2d8515bfb3ec54e781aeef674516e513bfbb8cb
tree3e009ecc5d566190ff3568dd0111ec2d69a3c5ca
parentf42f98b1866706fcf651d32e22c0f7e4244b5b75
kernel - More many-cores SMP work

* Add lwkt_yield() calls in a few critical places which can hog the cpu
  on large many-cores boxes during periods of very heavy contention.  This
  allows other kernel threads on the same cpu to run and reduces symptoms
  of e.g. high ping times under certain load conditions.

* Run the callout kernel threads at the same priority as other kernel
  threads so cpu-hogging operations run from callouts can yield to
  other kernel threads (e.g. yield to the netisr threads).

* Change the vm_page_alloc() API to catch situations where the allocation
  races an insertion due to potentially blocking when dealing with
  PQ_CACHE pages.  VM_ALLOC_NULL_OK allows vm_page_alloc() to return NULL
  in this case (otherwise it will panic).

* Change vm_page_insert() to return TRUE if the insertion succeeded and
  FALSE if it didn't due to a race against another thread.

* Change the meaning of the cpuid argument to lwkt_alloc_thread() and
  lwkt_create().  A cpuid of -1 will cause the kernel to choose a cpu
  to run the thread on (instead of choosing the current cpu).

  Eventually this specification will allow dynamic migration (but not at
  the moment).

  Adjust lwp_fork() to specify the current cpu, required for initial
  LWKT calls when setting the forked thread up.

  Numerous kernel threads will now be spread around available cpus for
  now.  devfs core threads, NFS socket threads, etc.

  Interrupt threads are still fixed on cpu 0 awaiting additional work from
  Sephe.

  Put the emergency interrupt thread on the last cpu.

* Change the vm_page_grab() API.  When VM_ALLOC_ZERO is specified the
  vm_page_grab() code will automatically set an invalid page valid and
  zero it (using the PG_ZERO optimization if possible).  Pages which are
  already valid are not zero'd.

  This simplies several use cases.

* Change vm_fault_page() to enter the page into the pmap while the vm_map
  is still locked, instead of after unlocking it.  For now anyhow.

* Minor change to ensure that a deterministic value is stored in *freebuf
  in vn_fullpath().

* Minor debugging features added to help track down a x86-64 sge-fault
  issue.
29 files changed:
sys/dev/agp/agp.c
sys/dev/agp/agp_i810.c
sys/kern/kern_fork.c
sys/kern/kern_intr.c
sys/kern/kern_kthread.c
sys/kern/kern_synch.c
sys/kern/kern_timeout.c
sys/kern/lwkt_thread.c
sys/kern/subr_disk.c
sys/kern/uipc_syscalls.c
sys/kern/vfs_cache.c
sys/platform/pc32/i386/pmap.c
sys/platform/pc64/x86_64/trap.c
sys/platform/vkernel/platform/pmap.c
sys/platform/vkernel64/platform/pmap.c
sys/sys/kthread.h
sys/vfs/devfs/devfs_core.c
sys/vfs/nfs/nfs_vfsops.c
sys/vm/device_pager.c
sys/vm/swap_pager.c
sys/vm/vm_contig.c
sys/vm/vm_fault.c
sys/vm/vm_kern.c
sys/vm/vm_map.c
sys/vm/vm_object.c
sys/vm/vm_page.c
sys/vm/vm_page.h
sys/vm/vm_pageout.c
sys/vm/vm_swapcache.c