freebsd kernel with SKQ
Go to file
David Xu d10183d94d This is initial version of POSIX priority mutex support, a new userland
mutex structure is added as following:
struct umutex {
        __lwpid_t       m_owner;
        uint32_t        m_flags;
        uint32_t        m_ceilings[2];
        uint32_t        m_spare[4];
};
The m_owner represents owner thread, it is a thread id, in non-contested
case, userland can simply use atomic_cmpset_int to lock the mutex, if the
mutex is contested, high order bit will be set, and userland should do locking
and unlocking via kernel syscall. Flag UMUTEX_PRIO_INHERIT represents
pthread's PTHREAD_PRIO_INHERIT mutex, which when contention happens, kernel
should do priority propagating. Flag UMUTEX_PRIO_PROTECT indicates it is
pthread's PTHREAD_PRIO_PROTECT mutex, userland should initialize m_owner
to contested state UMUTEX_CONTESTED, then atomic_cmpset_int will be failure
and kernel syscall should be invoked to do locking, this becauses
for such a mutex, kernel should always boost the thread's priority before
it can lock the mutex, m_ceilings is used by PTHREAD_PRIO_PROTECT mutex,
the first element is used to boost thread's priority when it locked the mutex,
second element is used when the mutex is unlocked, the PTHREAD_PRIO_PROTECT
mutex's link list is kept in userland, the m_ceiling[1] is managed by thread
library so kernel needn't allocate memory to keep the link list, when such
a mutex is unlocked, kernel reset m_owner to UMUTEX_CONTESTED.
Flag USYNC_PROCESS_SHARED indicate if the synchronization object is process
shared, if the flag is not set, it saves a vm_map_lookup() call.

The umtx chain is still used as a sleep queue, when a thread is blocked on
PTHREAD_PRIO_INHERIT mutex, a umtx_pi is allocated to support priority
propagating, it is dynamically allocated and reference count is used,
it is not optimized but works well in my tests, while the umtx chain has
its own locking protocol, the priority propagating protocol are all protected
by sched_lock because priority propagating function is called with sched_lock
held from scheduler.

No visible performance degradation is found which these changes. Some parameter
names in _umtx_op syscall are renamed.
2006-08-28 04:24:51 +00:00
bin - Fix options order. 2006-08-25 09:58:13 +00:00
contrib Resolve conflicts after GCC 3.4.6 20060825 import. 2006-08-26 21:37:21 +00:00
crypto Resolve conflicts after import of OpenSSL 0.9.8b. 2006-07-30 14:17:54 +00:00
etc When stopping powerd, set the CPU frequency back to its maximum value 2006-08-27 11:04:39 +00:00
games visionary thoughts.. 2006-08-27 14:29:10 +00:00
gnu Use the pcb in stoppcbs[] if it is present for threads that were running 2006-08-25 16:20:17 +00:00
include Add device to access and modify Open Firmware NVRAM settings in 2006-08-01 22:19:01 +00:00
kerberos5 Kerberos/Heimdal doesn't really depend on the INET6 macro. 2006-07-28 06:33:27 +00:00
lib - Add new service class definitions and a new attribute identifier definition 2006-08-26 23:16:35 +00:00
libexec Remove alpha left-overs. 2006-08-22 08:03:01 +00:00
release New release notes: GCC 3.4.6, OpenSSL 0.9.8b. 2006-08-27 16:18:09 +00:00
rescue Remove alpha left-overs. 2006-08-22 08:03:01 +00:00
sbin o Fix style(9) for previous. 2006-08-25 09:14:23 +00:00
secure Remove alpha left-overs. 2006-08-22 08:03:01 +00:00
share Chase after phk@: remove reference to (now obsoleted) NMBCLUSTERS. 2006-08-26 21:24:22 +00:00
sys This is initial version of POSIX priority mutex support, a new userland 2006-08-28 04:24:51 +00:00
tools Remove alpha left-overs. 2006-08-22 08:03:01 +00:00
usr.bin Remove alpha-specific stuff. 2006-08-23 12:12:56 +00:00
usr.sbin Set alarm timer for grace period from the grace_period variable, instead 2006-08-23 15:59:43 +00:00
COPYRIGHT Happy new year, a little late 2006-01-15 22:06:10 +00:00
LOCKS Document commit constraints for RELENG_6_*. 2006-01-13 06:51:43 +00:00
MAINTAINERS Remove pre-commit review on mpt. 2006-07-11 06:09:54 +00:00
Makefile Per weak consensus on this topic, remove suggestion to set 2006-06-22 16:52:53 +00:00
Makefile.inc1 Always make obj when building the libraries. This never hurts, and 2006-08-24 17:02:26 +00:00
ObsoleteFiles.inc - Remove ramdisk rc.d scripts since they've been replaced by mdconfig{,2}. 2006-08-22 11:12:09 +00:00
README Simply running ``make world'' will bomb unless you dig up the 2006-06-07 03:33:48 +00:00
UPDATING Note IPFIREWALL_FOWARD_EXTENDED is now gone. 2006-08-17 00:41:05 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The ``world''
target should only be used in cases where the source tree has not
changed from the currently running version.  See:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
for more information, including setting make(1) variables.

The ``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html