Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jun 2007 20:01:42 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   cvs commit: src/sys/kern kern_exit.c kern_ktrace.c
Message-ID:  <200706132001.l5DK1gsX073850@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
jhb         2007-06-13 20:01:42 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             kern_exit.c kern_ktrace.c 
  Log:
  Improve the ktrace locking somewhat to reduce overhead:
  - Depessimize userret() in kernels where KTRACE is enabled by doing an
    unlocked check of the per-process queue of pending events before
    acquiring any locks.  Previously ktr_userret() unconditionally acquired
    the global ktrace_sx lock on every return to userland for every thread,
    even if ktrace wasn't enabled for the thread.
  - Optimize the locking in exit() to first perform an unlocked read of
    p_traceflag to see if ktrace is enabled and only acquire locks and
    teardown ktrace if the test succeeds.  Also, explicitly disable tracing
    before draining any pending events so the pending events actually get
    written out.  The unlocked read is safe because proc lock is acquired
    earlier after single-threading so p_traceflag can't change between then
    and this check (well, it can currently due to a bug in ktrace I will fix
    next, but that race existed prior to this change as well).
  
  Reviewed by:    rwatson
  
  Revision  Changes    Path
  1.304     +24 -18    src/sys/kern/kern_exit.c
  1.120     +2 -0      src/sys/kern/kern_ktrace.c



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706132001.l5DK1gsX073850>