kernel - lwkt_token revamp
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 6 Jun 2010 17:26:42 +0000 (10:26 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sun, 6 Jun 2010 17:26:42 +0000 (10:26 -0700)
commit3b998fa96afe52828957ea4f65d15320eb0fe240
treeea935d45405f5754fc32f27c018e00ed79293e4e
parentc5c7e96070840ae861de3ad987ffdebcb983f1e1
kernel - lwkt_token revamp

* Simplify the token API.  Hide the lwkt_tokref mechanics and simplify
  the lwkt_gettoken()/lwkt_reltoken() API to remove the need to declare
  and pass a lwkt_tokref along with the token.

  This makes tokens operate more like locks.  There is a minor restriction
  that tokens must be unlocked in exactly the reverse order they were locked
  in, and another restriction limiting the maximum number of tokens a thread
  can hold to defined value (32 for now).

  The tokrefs are now an array embedded in the thread structure.

* Improve performance when blocking and unblocking threads with recursively
  held tokens.

* Improve performance when acquiring the same token recursively.  This
  operation is now O(1) and requires no locks or critical sections of any
  sort.

  This will allow us to acquire redundant tokens in deep call paths
  without having to worry about performance issues.

* Add a flags field to the lwkt_token and lwkt_tokref structures and add
  a flagged feature which will acquire the MP lock along with a particular
  token.  This will be used as a transitory mechanism in upcoming MPSAFE
  work.

  The mplock feature in the token structure can be directly connected
  to a mpsafe sysctl without being vulnerable to state-change races.
45 files changed:
sys/ddb/db_ps.c
sys/emulation/linux/i386/linprocfs/linprocfs_subr.c
sys/emulation/ndis/kern_ndis.c
sys/emulation/ndis/subr_ntoskrnl.c
sys/kern/kern_lockf.c
sys/kern/lwkt_thread.c
sys/kern/lwkt_token.c
sys/kern/subr_disk.c
sys/kern/subr_kobj.c
sys/kern/subr_rman.c
sys/kern/sys_pipe.c
sys/kern/vfs_bio.c
sys/kern/vfs_lock.c
sys/kern/vfs_mount.c
sys/kern/vfs_subr.c
sys/kern/vfs_sync.c
sys/kern/vfs_vm.c
sys/kern/vfs_vopops.c
sys/netproto/smb/smb_subr.h
sys/platform/pc32/i386/busdma_machdep.c
sys/platform/pc64/x86_64/busdma_machdep.c
sys/platform/vkernel/platform/busdma_machdep.c
sys/platform/vkernel64/platform/busdma_machdep.c
sys/sys/mount.h
sys/sys/rman.h
sys/sys/thread.h
sys/sys/thread2.h
sys/vfs/fifofs/fifo_vnops.c
sys/vfs/gnu/ext2fs/ext2_ihash.c
sys/vfs/gnu/ext2fs/ext2_vnops.c
sys/vfs/hammer/hammer_vnops.c
sys/vfs/hpfs/hpfs_hash.c
sys/vfs/hpfs/hpfs_vfsops.c
sys/vfs/isofs/cd9660/cd9660_node.c
sys/vfs/msdosfs/msdosfs_denode.c
sys/vfs/nfs/nfs_subs.c
sys/vfs/nfs/nfs_vnops.c
sys/vfs/ntfs/ntfs_ihash.c
sys/vfs/ntfs/ntfs_vfsops.c
sys/vfs/udf/udf_vfsops.c
sys/vfs/udf/udf_vnops.c
sys/vfs/ufs/ffs_rawread.c
sys/vfs/ufs/ffs_softdep.c
sys/vfs/ufs/ufs_ihash.c
sys/vfs/ufs/ufs_vnops.c