DragonFly BSD

CVS log for src/sys/sys/param.h

[BACK] Up to [dragonfly] / src / sys / sys

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.53 / (download) - annotate - [select for diffs], Tue Nov 11 00:55:49 2008 UTC (3 years, 2 months ago) by pavalos
Branch: MAIN
CVS Tags: HEAD
Changes since 1.52: +2 -1 lines
Diff to previous 1.52 (colored)

Add the lchflags() syscall.

This is essentially the same as chflags(), but it operates on the symlink,
not on the underlying file.

Documentation-from: FreeBSD
Reviewed-by: dillon

Revision 1.52 / (download) - annotate - [select for diffs], Tue Sep 9 04:06:20 2008 UTC (3 years, 4 months ago) by dillon
Branch: MAIN
Changes since 1.51: +0 -1 lines
Diff to previous 1.51 (colored)

Fix issues with the scheduler that were causing unnecessary reschedules
between tightly coupled processes as well as inefficient reschedules under
heavy loads.

The basic problem is that a process entering the kernel is 'passively
released', meaning its thread priority is left at TDPRI_USER_NORM.  The
thread priority is only raised to TDPRI_KERN_USER if the thread switches
out.  This has the side effect of forcing a LWKT reschedule when any other
user process woke up from a blocked condition in the kernel, regardless of
its user priority, because it's LWKT thread was at the higher
TDPRI_KERN_USER priority.   This resulted in some significant switching
cavitation under load.

There is a twist here because we do not want to starve threads running in
the kernel acting on behalf of a very low priority user process, because
doing so can deadlock the namecache or other kernel elements that sleep with
lockmgr locks held.  In addition, the 'other' LWKT thread might be associated
with a much higher priority user process that we *DO* in fact want to give
cpu to.

The solution is elegant.  First, do not force a LWKT reschedule for the
above case.  Second, force a LWKT reschedule on every hard clock.  Remove
all the old hacks.  That's it!

The result is that the current thread is allowed to return to user
mode and run until the next hard clock even if other LWKT threads (running
on behalf of a user process) are runnable.  Pure kernel LWKT threads still
get absolute priority, of course.  When the hard clock occurs the other LWKT
threads get the cpu and at the end of that whole mess most of those
LWKT threads will be trying to return to user mode and the user scheduler
will be able to select the best one.  Doing this on a hardclock boundary
prevents cavitation from occuring at the syscall enter and return boundary.

With this change the TDF_NORESCHED and PNORESCHED flags and their associated
code hacks have also been removed, along with lwkt_checkpri_self() which
is no longer needed.

Revision 1.50.2.1 / (download) - annotate - [select for diffs], Mon Jul 14 04:20:35 2008 UTC (3 years, 6 months ago) by dillon
Branch: DragonFly_RELEASE_2_0
CVS Tags: DragonFly_RELEASE_2_0_Slip
Changes since 1.50: +1 -1 lines
Diff to previous 1.50 (colored) next main 1.51 (colored)

2.0 Release Engineering:

* Post-branch adjustments for 2.0-release

Revision 1.51 / (download) - annotate - [select for diffs], Mon Jul 14 04:01:42 2008 UTC (3 years, 6 months ago) by dillon
Branch: MAIN
CVS Tags: DragonFly_Preview
Changes since 1.50: +2 -1 lines
Diff to previous 1.50 (colored)

2.0 Release Engineering:

* Post-branch adjustments to HEAD (2.1)

Revision 1.50 / (download) - annotate - [select for diffs], Mon Jul 14 03:46:50 2008 UTC (3 years, 6 months ago) by dillon
Branch: MAIN
Branch point for: DragonFly_RELEASE_2_0
Changes since 1.49: +3 -1 lines
Diff to previous 1.49 (colored)

2.0 Release Engineering:

* Bump DragonFly_version
* Bump HEAD sub-vers

Revision 1.49 / (download) - annotate - [select for diffs], Thu Jun 5 17:53:10 2008 UTC (3 years, 8 months ago) by swildner
Branch: MAIN
Changes since 1.48: +1 -3 lines
Diff to previous 1.48 (colored)

Include <sys/_null.h> for the definition of NULL.

Revision 1.48 / (download) - annotate - [select for diffs], Mon May 19 10:19:49 2008 UTC (3 years, 8 months ago) by corecode
Branch: MAIN
Changes since 1.47: +1 -0 lines
Diff to previous 1.47 (colored)

Don't #include <sys/select.h> from sys/types.h, to conform to SUS.

Some old BSD programs assume that sys/types.h is basically enough
to get all types and even functions declared, so adjust these.
sys/param.h still works as kitchensink and includes sys/select.h.

Revision 1.47 / (download) - annotate - [select for diffs], Wed May 7 17:26:28 2008 UTC (3 years, 8 months ago) by dillon
Branch: MAIN
Changes since 1.46: +3 -2 lines
Diff to previous 1.46 (colored)

Bump base development version to 197700 so it is properly distinct from
the 1.12 release version.

Reported-by: Hasso Tepper

Revision 1.46 / (download) - annotate - [select for diffs], Tue Feb 12 02:43:17 2008 UTC (3 years, 11 months ago) by dillon
Branch: MAIN
Changes since 1.45: +1 -1 lines
Diff to previous 1.45 (colored)

Oops, drop head's version back one for head (it was set to the release's
version).

Revision 1.45 / (download) - annotate - [select for diffs], Tue Feb 12 02:26:05 2008 UTC (3 years, 11 months ago) by dillon
Branch: MAIN
Changes since 1.44: +5 -7 lines
Diff to previous 1.44 (colored)

Release Engineering on HEAD.

* Branch 1.12

* Change HEAD to 1.13

Revision 1.44 / (download) - annotate - [select for diffs], Tue Feb 12 02:09:23 2008 UTC (3 years, 11 months ago) by dillon
Branch: MAIN
CVS Tags: DragonFly_RELEASE_1_12_Slip, DragonFly_RELEASE_1_12
Changes since 1.43: +2 -1 lines
Diff to previous 1.43 (colored)

Bump to 1.11.1 prior to 1.12 branch and update the preview tag.

Revision 1.42.2.1 / (download) - annotate - [select for diffs], Tue Jul 24 20:45:11 2007 UTC (4 years, 6 months ago) by dillon
Branch: DragonFly_RELEASE_1_10
CVS Tags: DragonFly_RELEASE_1_10_Slip
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored) next main 1.43 (colored)

Release Engineering: Update sources in release branch to reflect the 1.10
release.

Revision 1.43 / (download) - annotate - [select for diffs], Tue Jul 24 20:38:19 2007 UTC (4 years, 6 months ago) by dillon
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

Release engineering: Update version information in HEAD to reflect 1.11

Revision 1.42 / (download) - annotate - [select for diffs], Tue Jul 24 19:47:13 2007 UTC (4 years, 6 months ago) by dillon
Branch: MAIN
Branch point for: DragonFly_RELEASE_1_10
Changes since 1.41: +2 -1 lines
Diff to previous 1.41 (colored)

Bump DragonFly_version and create a subvers-DEVELOPMENT file for HEAD for
1.11.  This will be the last rev before 2.0.

Revision 1.41 / (download) - annotate - [select for diffs], Mon Jun 18 05:13:43 2007 UTC (4 years, 7 months ago) by dillon
Branch: MAIN
Changes since 1.40: +1 -1 lines
Diff to previous 1.40 (colored)

Move all the code related to handling the current 32 bit disklabel
to subr_disklabel32.c.  Move the header file from sys/disklabel.h to
sys/disklabel32.h.  Rename all the related structures and constants
and retire 'struct disklabel'.

Redo the sys/disklabel.h header file to implement a generic disklabel
abstraction.  Modify kern/subr_diskslice.c to use this abstraction, with
some shims for the ops dispatch at the moment which will be cleaned up later.

Adjust all auxillary code that directly accesses 32 bit disklabels to use
the new structure and constant names.

Remove the snoop-adjust code.  The kernel would snoop reads and writes to
the disklabel area via the raw slice device (e.g. ad0s1) and convert the
disklabel from the in-core format to the on-disk format and vise-versa.
The reads and writes made by disklabel -r and the kernel's own internal
readdisklabel and writedisklabel code used the snooping.

Rearrange the kernel's internal code to manually convert the disklabel when
reading and writing.  Rearrange the /sbin/disklabel program to do the same
when the -r option is used.  Have the disklabel program also check which
DragonFly OS it is running under so it can be run on older systems.  Note
that the disklabel binary prior to these changes will NOT operate on the
disklabel properly if running on a NEW kernel.

Introduce skeleton files for 64 bit disklabel support.

Revision 1.40 / (download) - annotate - [select for diffs], Tue May 8 02:31:43 2007 UTC (4 years, 8 months ago) by dillon
Branch: MAIN
Changes since 1.39: +0 -1 lines
Diff to previous 1.39 (colored)

Replace NOCDEV with NULL.  NOCDEV was ((void *)-1) and as inherited
from *BSD a long time ago due to the device pointer / device number
duality.  Now that the pointer and device number has been separated, we
can just use NULL to indicate no-pointer.

Replace si_refs with si_sysref.  Use SYSREF for ref-count cdev_t.  Enable
cdev_t reclamation on deletion.

Revision 1.38.2.1 / (download) - annotate - [select for diffs], Thu Jan 25 19:07:35 2007 UTC (5 years ago) by dillon
Branch: DragonFly_RELEASE_1_8
CVS Tags: DragonFly_RELEASE_1_8_Slip
Changes since 1.38: +2 -3 lines
Diff to previous 1.38 (colored) next main 1.39 (colored)

Setup for 1.8 release - Adjust the release to say 1.8 after branching.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Jan 25 18:57:46 2007 UTC (5 years ago) by dillon
Branch: MAIN
Changes since 1.38: +2 -1 lines
Diff to previous 1.38 (colored)

Setup for 1.8 release - Adjust HEAD to 1.9.0

Revision 1.38 / (download) - annotate - [select for diffs], Thu Jan 25 18:42:41 2007 UTC (5 years ago) by dillon
Branch: MAIN
Branch point for: DragonFly_RELEASE_1_8
Changes since 1.37: +2 -1 lines
Diff to previous 1.37 (colored)

Setup for 1.8 release - bump HEAD to 1.7.1 and synchronize preview tag.

Revision 1.37 / (download) - annotate - [select for diffs], Sun Sep 10 01:26:40 2006 UTC (5 years, 4 months ago) by dillon
Branch: MAIN
Changes since 1.36: +4 -2 lines
Diff to previous 1.36 (colored)

Change the kernel dev_t, representing a pointer to a specinfo structure,
to cdev_t.  Change struct specinfo to struct cdev.  The name 'cdev' was taken
from FreeBSD.  Remove the dev_t shim for the kernel.

This commit generally removes the overloading of 'dev_t' between userland and
the kernel.

Also fix a bug in libkvm where a kernel dev_t (now cdev_t) was not being
properly converted to a userland dev_t.

Revision 1.36 / (download) - annotate - [select for diffs], Sat Sep 9 19:34:46 2006 UTC (5 years, 4 months ago) by dillon
Branch: MAIN
Changes since 1.35: +1 -1 lines
Diff to previous 1.35 (colored)

Rename the kernel NODEV to NOCDEV to avoid conflicts with the userland NODEV.

Revision 1.34.2.1 / (download) - annotate - [select for diffs], Mon Jul 17 00:46:32 2006 UTC (5 years, 6 months ago) by dillon
Branch: DragonFly_RELEASE_1_6
CVS Tags: DragonFly_RELEASE_1_6_Slip
Changes since 1.34: +2 -3 lines
Diff to previous 1.34 (colored) next main 1.35 (colored)

Cleanup the version for the new 1.6 release branch.

Revision 1.35 / (download) - annotate - [select for diffs], Mon Jul 17 00:11:58 2006 UTC (5 years, 6 months ago) by dillon
Branch: MAIN
Changes since 1.34: +2 -3 lines
Diff to previous 1.34 (colored)

Adjust HEAD version from 1.5 to 1.7.

Revision 1.34 / (download) - annotate - [select for diffs], Mon Jul 17 00:00:03 2006 UTC (5 years, 6 months ago) by dillon
Branch: MAIN
Branch point for: DragonFly_RELEASE_1_6
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored)

Bump sub-versions and DragonFly_version in preparation for branching.

Revision 1.33 / (download) - annotate - [select for diffs], Tue Jun 13 08:12:04 2006 UTC (5 years, 7 months ago) by dillon
Branch: MAIN
Changes since 1.32: +3 -1 lines
Diff to previous 1.32 (colored)

Add kernel syscall support for explicit blocking and non-blocking I/O
regardless of the setting applied to the file pointer.

send/sendmsg/sendto/recv/recvmsg/recfrom: New MSG_ flags defined in
sys/socket.h may be passed to these functions to override the settings
applied to the file pointer on a per-I/O basis.

MSG_FBLOCKING	- Force the operation to be blocking
MSG_FNONBLOCKING- Force the operation to be non-blocking

pread/preadv/pwrite/pwritev: These system calls have been renamed and
wrappers will be added to libc.  The new system calls are prefixed with
a double underscore (like getcwd vs __getcwd) and include an additional
flags argument.  The new flags are defined in sys/fcntl.h and may be
used to override settings applied to the file pointer on a per-I/O basis.

Additionally, the internal __ versions of these functions now accept an
offset of -1 to mean 'degenerate into a read/readv/write/writev' (i.e.
use the offset in the file pointer and update it on completion).

O_FBLOCKING	- Force the operation to be blocking
O_FNONBLOCKING	- Force the operation to be non-blocking
O_FAPPEND	- Force the write operation to append (to a regular file)
O_FOFFSET	- (implied of the offset != -1) - offset is valid
O_FSYNCWRITE	- Force a synchronous write
O_FASYNCWRITE	- Force an asynchronous write
O_FUNBUFFERED	- Force an unbuffered operation (O_DIRECT)
O_FBUFFERED	- Force a buffered operation (negate O_DIRECT)

If the flags do not specify an operation (e.g. neither FBLOCKING or
FNONBLOCKING are set), then the settings in the file pointer are used.

The original system calls will become wrappers in libc, without the flags
arguments.  The new system calls will be made available to libc_r to allow
it to perform non-blocking I/O without having to mess with a descriptor's
file flags.

NOTE: the new __pread and __pwrite system calls are backwards compatible
with the originals due to a pad byte that libc always set to 0.
The new __preadv and __pwritev system calls are NOT backwards compatible,
but since they were added to HEAD just two months ago I have decided
to not renumber them either.

NOTE: The subrev has been bumped to 1.5.4 and installworld will refuse to
install if you are not running at least a 1.5.4 kernel.

Revision 1.32 / (download) - annotate - [select for diffs], Fri Apr 14 01:00:16 2006 UTC (5 years, 9 months ago) by dillon
Branch: MAIN
Changes since 1.31: +2 -1 lines
Diff to previous 1.31 (colored)

Supply version of wakeup() which only operate on threads blocked on the
same cpu, or on a particular cpu.

Revision 1.30.2.1 / (download) - annotate - [select for diffs], Fri Dec 23 19:16:07 2005 UTC (6 years, 1 month ago) by dillon
Branch: DragonFly_RELEASE_1_4
CVS Tags: DragonFly_RELEASE_1_4_Slip
Changes since 1.30: +1 -1 lines
Diff to previous 1.30 (colored) next main 1.31 (colored)

Update version for new release branch to 1.4.

Revision 1.31 / (download) - annotate - [select for diffs], Fri Dec 23 19:10:54 2005 UTC (6 years, 1 month ago) by dillon
Branch: MAIN
Changes since 1.30: +1 -1 lines
Diff to previous 1.30 (colored)

1.4 Release branched, HEAD is now 1.5.

Revision 1.30 / (download) - annotate - [select for diffs], Fri Dec 23 10:11:48 2005 UTC (6 years, 1 month ago) by dillon
Branch: MAIN
Branch point for: DragonFly_RELEASE_1_4
Changes since 1.29: +1 -1 lines
Diff to previous 1.29 (colored)

Bump us to 1.3.8 in preparation for pre-release tagging.

Revision 1.29 / (download) - annotate - [select for diffs], Tue Nov 8 20:47:02 2005 UTC (6 years, 2 months ago) by dillon
Branch: MAIN
Changes since 1.28: +4 -0 lines
Diff to previous 1.28 (colored)

Make tsleep/wakeup MP SAFE part 1/2.

Make most of the tsleep/wakeup core code MP safe.   Convert the global sleep
id hash table to a per-cpu hash table and use cpu-localization for all access
to the hash table.  Note that the timeout code is also per-cpu and will
issue the timeout callback on the correct cpu.

On an SMP box, this code is actually more efficient then the old code.
Instead of having to send multiple IPI messages by calling lwkt_schedule()
on each foreign thread, we now send one IPI message to the target cpu and
lwkt_schedule() is localized only for matching threads on that cpu.

wakeup_one() continues to be supported.  We pass a flag and chain through
the cpus until we exhaust available cpus or locate a match.  Currently we
do not round-robin the cpu mask check, so this could use some improvement.

A global cpumask array has been added so only cpus possibly containing
the sleeping threads are chained.  We chain the IPI rather then broadcast
it to reduce latency on the originating wakeup() and to introduce a
staggered wakeup between cpus that may reduce resource collisions when
multiple threads are blocked on the same resource.

This code uses the same cpu-localization concepts that much of the rest of
DragonFly uses for SMP, which means no mutexes, no locks, and virtually no
added overhead in the same-cpu case, and a simple asynchronous send-and-forget
IPI message for the SMP case.

Revision 1.20.2.2 / (download) - annotate - [select for diffs], Sun Oct 9 19:07:47 2005 UTC (6 years, 3 months ago) by dillon
Branch: DragonFly_RELEASE_1_2
CVS Tags: DragonFly_RELEASE_1_2_Slip
Changes since 1.20.2.1: +1 -1 lines
Diff to previous 1.20.2.1 (colored) next main 1.21 (colored)

Bump the version id to 1.2.6 (120006).

Revision 1.28 / (download) - annotate - [select for diffs], Sun Oct 9 19:02:09 2005 UTC (6 years, 3 months ago) by dillon
Branch: MAIN
Changes since 1.27: +1 -1 lines
Diff to previous 1.27 (colored)

Bump subversion in param.h

Reminded-by: Sepherosa Ziehau <sepherosa@gmail.com>

Revision 1.27 / (download) - annotate - [select for diffs], Fri Sep 16 19:25:03 2005 UTC (6 years, 4 months ago) by dillon
Branch: MAIN
Changes since 1.26: +1 -1 lines
Diff to previous 1.26 (colored)

Bump __Dragonfly_version to 130006 (+ slip preview on the file)

Reminded-by: Joerg Sonnenberger <joerg@britannica.bec.de>

Revision 1.26 / (download) - annotate - [select for diffs], Sat Sep 3 12:16:14 2005 UTC (6 years, 5 months ago) by joerg
Branch: MAIN
Changes since 1.25: +1 -1 lines
Diff to previous 1.25 (colored)

Update __DragonFly_version as well. Don't let this slip, please.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Aug 2 13:06:36 2005 UTC (6 years, 6 months ago) by joerg
Branch: MAIN
Changes since 1.24: +1 -1 lines
Diff to previous 1.24 (colored)

Bump version to 1.3.4 for stat changes.

Revision 1.24 / (download) - annotate - [select for diffs], Sun Jun 26 22:03:23 2005 UTC (6 years, 7 months ago) by dillon
Branch: MAIN
Changes since 1.23: +0 -13 lines
Diff to previous 1.23 (colored)

Move more scheduler-specific defines from various places into usched_bsd4.c
and revamp our scheduler algorithms.

* Get rid of the multiple layers of abstraction in the nice and frequency
  calculations.

* Increase the scheduling freqency from 20hz to 50hz.

* Greatly reduce the number of scheduling ticks that occur before a
  reschedule is issued.

* Fix a bug where the scheduler was not rescheduling when estcpu drops
  a process into a lower priority queue.

* Implement a new batch detection algorithm.  This algorithm gives
  forked children slightly more batchness then their parents (which
  is recovered quickly if the child is interactive), and propogates
  estcpu data from exiting children to future forked children (which
  handles fork/exec/wait loops such as used by make, scripts, etc).

* Change the way NICE priorities effect process execution.  The NICE
  value is used in two ways:  First, it determines the initial process
  priority.  The estcpu will have a tendancy to correct for this so the NICE
  value is also used to control estcpu's decay rate.

  This means that niced processes will have both an initial penalty for
  startup and stabilization, and an ongoing penalty if they become cpu
  bound.

Examples from cpu-bound loops:

CPU PRI  NI   PID %CPU      TIME COMMAND
 42 159 -20   706 20.5   0:38.88 /bin/csh /tmp/dowhile
 37 159 -15   704 17.6   0:35.09 /bin/csh /tmp/dowhile
 29 157 -10   702 15.3   0:30.41 /bin/csh /tmp/dowhile
 28 160  -5   700 13.0   0:26.73 /bin/csh /tmp/dowhile
 23 160   0   698 11.5   0:20.52 /bin/csh /tmp/dowhile
 18 160   5   696  9.2   0:16.85 /bin/csh /tmp/dowhile
 13 160  10   694  7.1   0:10.82 /bin/csh /tmp/dowhile
  3 160  20   692  1.5   0:02.14 /bin/csh /tmp/dowhile

Revision 1.23 / (download) - annotate - [select for diffs], Wed Jun 1 18:07:09 2005 UTC (6 years, 8 months ago) by joerg
Branch: MAIN
Changes since 1.22: +1 -1 lines
Diff to previous 1.22 (colored)

Stop branding DragonFly binaries with the FreeBSD ABI.
Increment __DragonFly_version to get this into programs,
we can do sanity checks on it later.

Revision 1.22 / (download) - annotate - [select for diffs], Sat Apr 30 23:04:21 2005 UTC (6 years, 9 months ago) by swildner
Branch: MAIN
Changes since 1.21: +0 -4 lines
Diff to previous 1.21 (colored)

Remove DEC Alpha support.

Revision 1.21 / (download) - annotate - [select for diffs], Fri Apr 8 06:40:33 2005 UTC (6 years, 9 months ago) by dillon
Branch: MAIN
CVS Tags: DragonFly_Stable
Changes since 1.20: +1 -1 lines
Diff to previous 1.20 (colored)

Bump HEAD's official release #define to 130000.

Revision 1.20.2.1 / (download) - annotate - [select for diffs], Fri Apr 8 06:40:01 2005 UTC (6 years, 9 months ago) by dillon
Branch: DragonFly_RELEASE_1_2
Changes since 1.20: +1 -1 lines
Diff to previous 1.20 (colored)

Bump the official release #define to 120000.

Revision 1.20 / (download) - annotate - [select for diffs], Fri Jan 14 02:20:24 2005 UTC (7 years ago) by dillon
Branch: MAIN
Branch point for: DragonFly_RELEASE_1_2
Changes since 1.19: +5 -3 lines
Diff to previous 1.19 (colored)

Add syscall primitives for generic userland accessible sleep/wakeup
functions.  These functions are capable of sleeping and waking up based on
a generic user VM address.  Programs capable of sharing memory are also
capable of interaction through these functions.

Also regenerate our system calls.

umtx_sleep(ptr, matchvalue, timeout)

    If *(int *)ptr (userland pointer) does not match the matchvalue,
    sleep for timeout microseconds.  Access to the contents of *ptr plus
    entering the sleep is interlocked against calls to umtx_wakeup().
    Various error codes are turned depending on what causes the function
    to return.  Note that the timeout may not exceed 1 second.

utmx_wakeup(ptr, count)

    Wakeup at least count processes waiting on the specified userland
    address.  A count of 0 wakes all waiting processes up.  This function
    interlocks against umtx_sleep().

The typical race case showing resolution between two userland processes is
shown below.  A process releasing a contested mutex may adjust the contents
of the pointer after the kernel has tested *ptr in umtx_sleep(), but this does
not matter because the first process will see that the mutex is set to a
contested state and will call wakeup after changing the contents of the
pointer.  Thus, the kernel itself does not have to execute any
compare-and-exchange operations in order to support userland mutexes.

    PROCESS 1			PROCESS 2		******** RACE#1 ******

    cmp_exg(ptr, FREE, HELD)
	.			cmp_exg(ptr, HELD, CONTESTED)
	.			umtx_sleep(ptr, CONTESTED, 0)
	.			[kernel tests *ptr]     <<<< COMPARE vs
    cmp_exg(CONTESTED, FREE)		.		<<<< CHANGE
	.			tsleep(....)
    umtx_wakeup(ptr, 1)			.
	.				.
	.				.



    PROCESS 1			PROCESS 2		******** RACE#2 ******

    cmp_exg(ptr, FREE, HELD)
				cmp_exg(ptr, HELD, CONTESTED)
				umtx_sleep(ptr, CONTESTED, 0)
    cmp_exg(CONTESTED, FREE)				<<<< CHANGE vs
    umtx_wakeup(ptr, 1)
				[kernel tests *ptr]	<<<< COMPARE
				[MISMATCH, DO NOT TSLEEP]


These functions are very loosely based on Jeff Roberson's umtx work in
FreeBSD.  These functions are greatly simplified relative to that work in
order to provide a more generic mechanism.

This is precursor work for a port of David Xu's 1:1 userland threading
library.

Revision 1.19 / (download) - annotate - [select for diffs], Thu Oct 7 01:33:31 2004 UTC (7 years, 3 months ago) by dillon
Branch: MAIN
Changes since 1.18: +0 -0 lines
Diff to previous 1.18 (colored)

The last commit was improperly documented as being VFS related.  It was
in related to the tty/clist fixes for USB keyboards.

Revision 1.18 / (download) - annotate - [select for diffs], Wed Oct 6 23:03:50 2004 UTC (7 years, 3 months ago) by dillon
Branch: MAIN
Changes since 1.17: +0 -15 lines
Diff to previous 1.17 (colored)

VFS messaging/interfacing work stage 7e/99: More firming up of stage 7.
[commit files missed in the last vfs commit]

Revision 1.17 / (download) - annotate - [select for diffs], Mon Aug 23 16:03:44 2004 UTC (7 years, 5 months ago) by joerg
Branch: MAIN
CVS Tags: DragonFly_Snap29Sep2004, DragonFly_Snap13Sep2004
Changes since 1.16: +13 -0 lines
Diff to previous 1.16 (colored)

Improve the endian support for DragonFly by providing functions to convert
16/32/64 bit variables and parts of byte streams between host order and
big / little endian.

Reduce the namespace pollution for normal usage, e.g. of sys/types.h.
The duplication of ntohl and friends in arpa/inet.h and sys/param.h comes
from byteorder(3) showing sys/param.h as header file and SUS requiring
arpa/inet.h to provide this functions.

Remove local hacks in acpidump and usb_port.h.

The prototype of ntohl and friends is in sync with SUS, warnings e.g. for
implicit sign casts or use of int/long will be handled separately.

Written-by:	Hitten Pandya and Joerg Sonnenberger
Inspired-by:	FreeBSD

Revision 1.16 / (download) - annotate - [select for diffs], Sat Aug 7 21:22:25 2004 UTC (7 years, 5 months ago) by dillon
Branch: MAIN
Changes since 1.15: +4 -1 lines
Diff to previous 1.15 (colored)

Do not hack a #define __FreeBSD_version if __FreeBSD__ does not exist,
to keep our gcc-3.4 builds freebsd-free.

Suggested-by: Richard Nyberg <rnyberg@it.su.se>

Revision 1.15 / (download) - annotate - [select for diffs], Sat Jul 24 20:21:35 2004 UTC (7 years, 6 months ago) by dillon
Branch: MAIN
Changes since 1.14: +1 -0 lines
Diff to previous 1.14 (colored)

Update the userland scheduler.  Fix scheduler interactions which were
previously resulting in the wrong process sometimes getting a full 1/10
second slice, which under heavy load resulted in serious glitching.
Introduce a new dynamic 'p_interactive' heuristic and allow it to effect
priority +/- by a few nice levels.

With this patch batch operations such as buildworlds, setiathome should not
interfere with X / interactive operations as much as they did before.

Note that we are talking about the the userland scheduler here, not the
LWKT scheduler.  Also note that the userland scheduler needs a complete
rewrite.

Revision 1.14 / (download) - annotate - [select for diffs], Sat Jul 24 09:51:18 2004 UTC (7 years, 6 months ago) by asmodai
Branch: MAIN
Changes since 1.13: +1 -1 lines
Diff to previous 1.13 (colored)

Bump version number for the 1.1-CURRENT tree.

Revision 1.13 / (download) - annotate - [select for diffs], Tue Mar 30 19:14:13 2004 UTC (7 years, 10 months ago) by dillon
Branch: MAIN
CVS Tags: DragonFly_1_0_REL, DragonFly_1_0_RC1, DragonFly_1_0A_REL
Changes since 1.12: +1 -0 lines
Diff to previous 1.12 (colored)

Second major scheduler patch.  This corrects interactive issues that were
introduced in the pipe sf_buf patch.

Split need_resched() into need_user_resched() and need_lwkt_resched().
Userland reschedules are requested when a process is scheduled with a higher
priority then the currently running process, and LWKT reschedules are
requested when a thread is scheduled with a higher priority then the
currently running thread.  As before, these are ASTs, LWKTs are not
preemptively switch while running in the kernel.

Exclusively use the resched wanted flags to determine whether to reschedule
or call lwkt_switch() upon return to user mode.  We were previously also
testing the LWKT run queue for higher priority threads, but this was causing
inefficient scheduler interactions when two processes are doing tightly
bound synchronous IPC (e.g. using PIPEs) because in DragonFly the LWKT
priority of a thread is raised when it enters the kernel, and lowered when
it tries to return to userland.  The wakeups occuring in the pipe code
were causing extra quick-flip thread switches.

Introduce a new tsleep() flag which disables the need_lwkt_resched() call
when the sleeping thread is woken up.   This is used by the PIPE code in
the synchronous direct-write PIPE case to avoid the above problem.

Redocument and revamp the ESTCPU code.  The original changes reduced the
interrupt rate from 100Hz (FBsd-4 and FBsd-5) to 20Hz, but did not compensate
for the slower ramp-up time.  This commit introduces a 'virtual' ESTCPU
frequency which compensates without us having to bump up the actual systimer
interrupt rate.

Redo the P_CURPROC methodology, which is used by the userland scheduler
to manage processes running in userland.  Create a globaldata->gd_uschedcp
process pointer which represents the current running-in-userland (or about
to be running in userland) process, and carefully recode acquire_curproc()
to allow this gd_uschedcp designation to be stolen from other threads trying
to return to userland without having to request a reschedule (which would
have to switch back to those threads to release the designation).  This
reduces the number of unnecessary context switches that occur due to
scheduler interactions.  Also note that this specifically solves the case
where there might be several threads running in the kernel which are trying
to return to userland at the same time.  A heuristic check against gd_upri
is used to select the correct thread for schedling to userland 'most of the
time'.  When the correct thread is not selected, we fall back to the old
behavior of forcing a reschedule.

Add debugging sysctl variables to better track userland scheduler efficiency.

With these changes pipe statistics are further improved.  Though some
scheduling aberrations still exist(1), the previous scheduler had totally
broken interactive processes and this one does not.

	BLKSIZE	BEFORE		NEWPIPE		NOW	    Tests on AMD64
		MBytes/s	MBytes/s	MBytes/s	3200+ FN85MB
							    (64KB L1, 1MB L2)
	256KB	1900		2200		2250
	 64KB	1800		2200		2250
	 32KB	-		-		3300
	 16KB	1650		2500-3000	2600-3200
	  8KB	1400		2300		2000-2400(1)
	  4KB	1300		1400-1500	1500-1700

Revision 1.12 / (download) - annotate - [select for diffs], Tue Mar 2 20:55:10 2004 UTC (7 years, 11 months ago) by drhodus
Branch: MAIN
Changes since 1.11: +38 -39 lines
Diff to previous 1.11 (colored)

*    Remove instances of PRIBIO because DragonFly no longer
     uses sleep priorities.

Revision 1.11 / (download) - annotate - [select for diffs], Mon Jan 5 17:36:20 2004 UTC (8 years, 1 month ago) by drhodus
Branch: MAIN
Changes since 1.10: +2 -0 lines
Diff to previous 1.10 (colored)


*	Add in some basic parameter values that we will use for
	synchronization of the device drivers.

Revision 1.10 / (download) - annotate - [select for diffs], Wed Nov 19 00:51:29 2003 UTC (8 years, 2 months ago) by dillon
Branch: MAIN
Changes since 1.9: +16 -12 lines
Diff to previous 1.9 (colored)

Change the system name from 'FreeBSD' to 'DragonFly'.  We are now officially
DragonFly 1.0-CURRENT.  The change is fairly straight forward but involves
adding support for the 'DragonFly' OS type in various gnu contributed pieces
(typically configure based), as well as compiler and BFD support for building
GCC and friends (basically just copied the FreeBSD files for DragonFly).

Additionally, hack the ports makefiles with UNAME_xxx environment variables
so ports builds think its still a FreeBSD-4.8 system.  Otherwise most of the
ports will fail.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Nov 15 11:46:26 2003 UTC (8 years, 2 months ago) by asmodai
Branch: MAIN
Changes since 1.8: +3 -0 lines
Diff to previous 1.8 (colored)

Add __DragonFly_version, set to 100000, which basically means:

DragonFly version 1.0.0, allowing for 999 updates before we are forced
to update the last revision number.

Do note that it hasn't replaced the current naming or numbering in the
DragonFly system.

Revision 1.8 / (download) - annotate - [select for diffs], Fri Oct 17 07:30:40 2003 UTC (8 years, 3 months ago) by dillon
Branch: MAIN
Changes since 1.7: +5 -0 lines
Diff to previous 1.7 (colored)

Cleanup P_CURPROC and P_CP_RELEASED handling.  P_CP_RELEASED prevents the
userland scheduler from messing with a process and must be set (in a lazy
fashion) when a thread that came in from userland is about to block in
the kernel.  P_CURPROC is used to manage which threads belonging to
processes controlled by the userland scheduler are scheduled by LWKT.
The userland scheduler has also been streamlined considerably.

p_priority now has a rollup priority that can be compared directly,
regardless of the realtime/idle/whatever queue a process is on.
p_priority has been changed from an unsigned char to a signed short.

schedclock is now distributed, so 'top' shows the correct values.

A huge amount of cpu affinity code has been added to the scheduler.  It is
not working 100% yet, but the framework is there (see kern/kern_switch.c).
globaldata now has gd_upri to support remote reschedule requests issued
by the affinity code.  There are two goals to the new scheduling code for
MP boxes: (1) so niced/idleprio cpu bound programs do not interfere
*at* *all* with other things (like, say, a buildworld).  (2) to reduce
the flip-flopping of processes between cpus.

lwkt_gettoken() now increments the generation number unconditionally so
kernel code can detect when other processes have used a token.

lwkt_send_ipiq_mask() removes stopped cpus from the mask automatically.

Revision 1.7 / (download) - annotate - [select for diffs], Thu Oct 16 23:59:13 2003 UTC (8 years, 3 months ago) by dillon
Branch: MAIN
Changes since 1.6: +0 -1 lines
Diff to previous 1.6 (colored)

Remove PUSER entirely.  Since p_priority has nothing to do with kernel
thread priorities, the userland scheduler can now use the entire range 0-127.

Document the estcpu and other macros related to the p_priority calculation.

Adjust the default values such that a cpu bound nice -20 process will not
completely starve a nice +0 process (though it gets close!).  Note that a
nice +2 process will not run at all in the face of a cpu bound nice -20
process.

Revision 1.6 / (download) - annotate - [select for diffs], Wed Aug 20 07:31:21 2003 UTC (8 years, 5 months ago) by rob
Branch: MAIN
Changes since 1.5: +1 -1 lines
Diff to previous 1.5 (colored)

__P() != wanted, begin removal, in order to preserve white space this needs
to be done by hand, as I accidently killed a source tree that I had gotten
this far on. I'm committing this now, LINT and GENERIC both build with
these changes, there are many more to come.

Revision 1.5 / (download) - annotate - [select for diffs], Fri Aug 1 17:46:23 2003 UTC (8 years, 6 months ago) by dillon
Branch: MAIN
Changes since 1.4: +0 -13 lines
Diff to previous 1.4 (colored)

Cleanup remaining tsleep priority issues.

Submitted-by: Jeroen Ruigrok/asmodai <asmodai@wxs.nl>

Revision 1.4 / (download) - annotate - [select for diffs], Sun Jul 27 01:49:53 2003 UTC (8 years, 6 months ago) by hmp
Branch: MAIN
Changes since 1.3: +0 -2 lines
Diff to previous 1.3 (colored)

Consolidate usage of MIN/MAX().

Instead, just remove the conditional processing in sys/param.h so
it's available to all files.

Revision 1.3 / (download) - annotate - [select for diffs], Sat Jul 19 21:14:50 2003 UTC (8 years, 6 months ago) by dillon
Branch: MAIN
Changes since 1.2: +5 -3 lines
Diff to previous 1.2 (colored)

Remove the priority part of the priority|flags argument to tsleep().  Only
flags are passed now.  The priority was a user scheduler thingy that is not
used by the LWKT subsystem.  For process statistics assume sleeps without
P_SINTR set to be disk-waits, and sleeps with it set to be normal sleeps.

This commit should not contain any operational changes.

Revision 1.2 / (download) - annotate - [select for diffs], Tue Jun 17 04:28:58 2003 UTC (8 years, 7 months ago) by dillon
Branch: MAIN
CVS Tags: PRE_MP
Changes since 1.1: +1 -0 lines
Diff to previous 1.1 (colored)

Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids.  Most
ids have been removed from !lint sections and moved into comment sections.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Jun 17 02:55:52 2003 UTC (8 years, 7 months ago) by dillon
Branch: MAIN
CVS Tags: FREEBSD_4_FORK

import from FreeBSD RELENG_4 1.61.2.38

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.