freebsd-dev/sys/fs
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
..
cd9660 Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
coda Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
deadfs Below is slightly edited description of the LOR by Tor Egge: 2007-01-22 11:25:22 +00:00
devfs Replace custom file descriptor array sleep lock constructed using a mutex 2007-04-04 09:11:34 +00:00
fdescfs Replace custom file descriptor array sleep lock constructed using a mutex 2007-04-04 09:11:34 +00:00
fifofs Replace custom file descriptor array sleep lock constructed using a mutex 2007-04-04 09:11:34 +00:00
hpfs Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
msdosfs Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
ntfs Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
nullfs Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
nwfs Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
portalfs Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
procfs Add a pn_destroy field to pfs_node. This field points to a destructor 2007-03-12 12:16:52 +00:00
pseudofs Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
smbfs Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
udf o cd9660 code repo-copied, update a comment. 2007-03-24 22:40:16 +00:00
umapfs Make insmntque() externally visibile and allow it to fail (e.g. during 2007-03-13 01:50:27 +00:00
unionfs Replace custom file descriptor array sleep lock constructed using a mutex 2007-04-04 09:11:34 +00:00