freebsd-dev/sys/opencrypto
Robert Watson 5e3f7694b1 Replace custom file descriptor array sleep lock constructed using a mutex
and flags with an sxlock.  This leads to a significant and measurable
performance improvement as a result of access to shared locking for
frequent lookup operations, reduced general overhead, and reduced overhead
in the event of contention.  All of these are imported for threaded
applications where simultaneous access to a shared file descriptor array
occurs frequently.  Kris has reported 2x-4x transaction rate improvements
on 8-core MySQL benchmarks; smaller improvements can be expected for many
workloads as a result of reduced overhead.

- Generally eliminate the distinction between "fast" and regular
  acquisisition of the filedesc lock; the plan is that they will now all
  be fast.  Change all locking instances to either shared or exclusive
  locks.

- Correct a bug (pointed out by kib) in fdfree() where previously msleep()
  was called without the mutex held; sx_sleep() is now always called with
  the sxlock held exclusively.

- Universally hold the struct file lock over changes to struct file,
  rather than the filedesc lock or no lock.  Always update the f_ops
  field last. A further memory barrier is required here in the future
  (discussed with jhb).

- Improve locking and reference management in linux_at(), which fails to
  properly acquire vnode references before using vnode pointers.  Annotate
  improper use of vn_fullpath(), which will be replaced at a future date.

In fcntl(), we conservatively acquire an exclusive lock, even though in
some cases a shared lock may be sufficient, which should be revisited.
The dropping of the filedesc lock in fdgrowtable() is no longer required
as the sxlock can be held over the sleep operation; we should consider
removing that (pointed out by attilio).

Tested by:	kris
Discussed with:	jhb, kris, attilio, jeff
2007-04-04 09:11:34 +00:00
..
cast.c /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
cast.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
castsb.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
criov.c - Replace COPYDATA() and COPYBACK() macros with crypto_copydata() and 2006-06-04 22:15:13 +00:00
crypto.c Overhaul driver/subsystem api's: 2007-03-21 03:42:51 +00:00
cryptodev_if.m add missing file from last commit that overhauls crypto/driver api's 2007-03-21 03:43:33 +00:00
cryptodev.c Replace custom file descriptor array sleep lock constructed using a mutex 2007-04-04 09:11:34 +00:00
cryptodev.h Overhaul driver/subsystem api's: 2007-03-21 03:42:51 +00:00
cryptosoft.c Overhaul driver/subsystem api's: 2007-03-21 03:42:51 +00:00
cryptosoft.h Overhaul driver/subsystem api's: 2007-03-21 03:42:51 +00:00
deflate.c malloc.h relies on param.h for a definition of MAXCPU. I guess that there is 2005-05-30 05:01:44 +00:00
deflate.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
rmd160.c /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
rmd160.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
skipjack.c /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
skipjack.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
xform.c Use newly added defines instead of magic values. 2006-06-04 15:11:59 +00:00
xform.h - Fix a very old bug in HMAC/SHA{384,512}. When HMAC is using SHA384 2006-05-17 18:24:17 +00:00