freebsd-skq/sys/security
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
..
audit Replace custom file descriptor array sleep lock constructed using a mutex 2007-04-04 09:11:34 +00:00
mac Remove 'MPSAFE' annotations from the comments above most system calls: all 2007-03-04 22:36:48 +00:00
mac_biba More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_bsdextended More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_ifoff More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_lomac Introduce accessor functions mac_label_get() and mac_label_set() to replace 2007-02-06 14:19:25 +00:00
mac_mls Introduce accessor functions mac_label_get() and mac_label_set() to replace 2007-02-06 14:19:25 +00:00
mac_none Remove many unneeded includes, update copyright. 2007-02-23 11:21:26 +00:00
mac_partition More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_portacl More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_seeotheruids More unnecessary include reduction. 2007-02-23 14:39:04 +00:00
mac_stub Continue 7-CURRENT MAC Framework rearrangement and cleanup: 2007-02-06 10:59:23 +00:00
mac_test More unnecessary include reduction. 2007-02-23 14:39:04 +00:00