git: kernel - lwkt_token revamp

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Jun 6 10:39:26 PDT 2010


commit 3b998fa96afe52828957ea4f65d15320eb0fe240
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Jun 6 10:26:42 2010 -0700

    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.

Summary of changes:
 sys/ddb/db_ps.c                                    |    4 +-
 .../linux/i386/linprocfs/linprocfs_subr.c          |   19 +-
 sys/emulation/ndis/kern_ndis.c                     |   50 ++---
 sys/emulation/ndis/subr_ntoskrnl.c                 |   57 ++---
 sys/kern/kern_lockf.c                              |    6 +-
 sys/kern/lwkt_thread.c                             |   11 +-
 sys/kern/lwkt_token.c                              |  244 ++++++++++----------
 sys/kern/subr_disk.c                               |   21 +-
 sys/kern/subr_kobj.c                               |   14 +-
 sys/kern/subr_rman.c                               |   52 ++---
 sys/kern/sys_pipe.c                                |  144 +++++-------
 sys/kern/vfs_bio.c                                 |    5 +-
 sys/kern/vfs_lock.c                                |    2 +-
 sys/kern/vfs_mount.c                               |   62 ++---
 sys/kern/vfs_subr.c                                |   83 +++----
 sys/kern/vfs_sync.c                                |   22 +-
 sys/kern/vfs_vm.c                                  |    5 +-
 sys/kern/vfs_vopops.c                              |   19 ++-
 sys/netproto/smb/smb_subr.h                        |    1 -
 sys/platform/pc32/i386/busdma_machdep.c            |    9 +-
 sys/platform/pc64/x86_64/busdma_machdep.c          |    9 +-
 sys/platform/vkernel/platform/busdma_machdep.c     |    9 +-
 sys/platform/vkernel64/platform/busdma_machdep.c   |    9 +-
 sys/sys/mount.h                                    |    8 +-
 sys/sys/rman.h                                     |    5 +-
 sys/sys/thread.h                                   |   48 +++--
 sys/sys/thread2.h                                  |   12 -
 sys/vfs/fifofs/fifo_vnops.c                        |   93 ++++----
 sys/vfs/gnu/ext2fs/ext2_ihash.c                    |   37 ++--
 sys/vfs/gnu/ext2fs/ext2_vnops.c                    |   15 +-
 sys/vfs/hammer/hammer_vnops.c                      |   10 +-
 sys/vfs/hpfs/hpfs_hash.c                           |   31 +--
 sys/vfs/hpfs/hpfs_vfsops.c                         |    2 +-
 sys/vfs/isofs/cd9660/cd9660_node.c                 |   21 +-
 sys/vfs/msdosfs/msdosfs_denode.c                   |   26 +--
 sys/vfs/nfs/nfs_subs.c                             |    6 +-
 sys/vfs/nfs/nfs_vnops.c                            |    5 +-
 sys/vfs/ntfs/ntfs_ihash.c                          |   24 +--
 sys/vfs/ntfs/ntfs_vfsops.c                         |    1 -
 sys/vfs/udf/udf_vfsops.c                           |    2 +-
 sys/vfs/udf/udf_vnops.c                            |   19 +-
 sys/vfs/ufs/ffs_rawread.c                          |    5 +-
 sys/vfs/ufs/ffs_softdep.c                          |   16 +-
 sys/vfs/ufs/ufs_ihash.c                            |   37 ++--
 sys/vfs/ufs/ufs_vnops.c                            |   10 +-
 45 files changed, 581 insertions(+), 709 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/3b998fa96afe52828957ea4f65d15320eb0fe240


-- 
DragonFly BSD source repository





More information about the Commits mailing list