git: kernel - Refactor tty_token, fix SMP performance issues

Matthew Dillon dillon at crater.dragonflybsd.org
Thu Oct 4 19:48:33 PDT 2018


commit 2efb75f3055c1746efc358d68dbc2bf526faaf61
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Thu Oct 4 10:22:35 2018 -0700

    kernel - Refactor tty_token, fix SMP performance issues
    
    * Remove most uses of tty_token in favor of per-tty tp->t_token.
      This is particularly important for removing bottlenecks related to PTYs,
      which are used all over the place.  tty_token remains in a few places
      managing overall registration and global list manipulation.
    
    * tty structures are now required to be persistent.  Implement a sepearate
      ttyinit() function.  Continue to allow ttyregister() and ttyunregister()
      calls, but these no longer presume destruction of the structure.
    
    * Refactor ttymalloc() to take a **tty pointer and interlock allocations.
      Allocations are intended to be one-time.  ttymalloc() only requires the
      tty_token for initial allocations.
    
    * Remove all critical section use that was combined with tty_token and
      tp->t_token.  Leave only the tokens.  The critical sections were
      hold-overs going all the way back to pre-SMP days.
    
    * syscons now gets its own token, vga_token.  The ISA VGA code and
      the framebuffer code also now use this token instead of tty_token.
    
    * The keyboard subsystem now uses kbd_token instead of tty_token.
    
    * A few remaining serial-like devices (snp, nmdm) also get their own
      tokens, as well as use the now required tp->t_token.
    
    * Remove use of tty_token in the session management code.  This fixes
      a niggling performance path since sessions almost universally go
      hand-in-hand with fork/exec/exit sequences.  Instead we use the
      already-existing per-hash session token.

Summary of changes:
 sys/bus/isa/vga_isa.c                      |   4 +-
 sys/bus/u4b/serial/usb_serial.c            | 119 ++++-----
 sys/dev/misc/atkbd/atkbd_isa.c             |   8 +-
 sys/dev/misc/atkbdc_layer/atkbdc_isa.c     |  24 +-
 sys/dev/misc/dcons/dcons_os.c              |  79 +++---
 sys/dev/misc/kbd/kbd.c                     | 283 +++++++++-----------
 sys/dev/misc/nmdm/nmdm.c                   | 118 +++++----
 sys/dev/misc/snp/snp.c                     | 131 +++++-----
 sys/dev/misc/syscons/scvgarndr.c           |   8 +-
 sys/dev/misc/syscons/scvidctl.c            | 159 ++++++------
 sys/dev/misc/syscons/syscons.c             | 363 ++++++++++++++------------
 sys/dev/serial/sio/sio.c                   |   3 +-
 sys/dev/video/fb/bmp/splash_bmp.c          |  24 +-
 sys/dev/video/fb/fb.c                      |  36 +--
 sys/dev/video/fb/fbreg.h                   |  16 +-
 sys/dev/video/fb/vga.c                     |  18 +-
 sys/kern/kern_proc.c                       |   6 +-
 sys/kern/lwkt_token.c                      |   2 +
 sys/kern/tty.c                             | 404 ++++++++++++++---------------
 sys/kern/tty_cons.c                        |   2 +
 sys/kern/tty_pty.c                         | 348 +++++++++++++++----------
 sys/kern/tty_subr.c                        | 113 +++-----
 sys/net/sl/if_sl.c                         |  75 +++---
 sys/netgraph/tty/ng_tty.c                  |  86 +++---
 sys/netgraph7/bluetooth/drivers/h4/ng_h4.c |  36 +--
 sys/netgraph7/tty/ng_tty.c                 | 101 +++-----
 sys/platform/vkernel64/platform/console.c  |  36 +--
 sys/sys/proc.h                             |   2 +
 sys/sys/thread.h                           |   2 +
 sys/sys/tty.h                              |   7 +-
 30 files changed, 1281 insertions(+), 1332 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/2efb75f3055c1746efc358d68dbc2bf526faaf61


-- 
DragonFly BSD source repository


More information about the Commits mailing list