Jeff Roberson [Fri, 5 Jan 2007 08:50:38 +0000 (08:50 +0000)]
- ftick was initialized to -1 for init and any of it's children. Fix this by
setting ftick = ltick = ticks in schedinit().
- Update the priority when we are pulled off of the run queue and when we
are inserted onto the run queue so that it more accurately reflects our
present status. This is important for efficient priority propagation
functioning.
- Move the frequency test into sched_pctcpu_update() so we don't repeat it
each time we'd like to call it.
- Put some temporary work-around code in sched_priority() in case the tick
mechanism produces a bad priority. Eventually this should revert to an
assert again.
Bernd Walter [Fri, 5 Jan 2007 01:18:32 +0000 (01:18 +0000)]
MFp4: Read access require PDC to be setup first otherwise we might get
overrun errors.
Write access however need cmd first, so keep the existing order
for them.
John Baldwin [Thu, 4 Jan 2007 20:28:17 +0000 (20:28 +0000)]
- Use a regular mutex rather than a spin mutex. This driver doesn't need
a spin mutex since it doesn't have an INTR_FAST interrupt handler.
Beyond that the driver is still under Giant anyway.
- Remove unneeded locking during attach across operations that can't be
called with locks held (such as bus_dma_tag_create()).
Colin Percival [Thu, 4 Jan 2007 12:45:00 +0000 (12:45 +0000)]
Convert compression_skip from taking a size_t skip length request and
returning the length skipped in a ssize_t to using off_t for both. This
does not break any A[BP]Is, since compression_skip is entirely internal
to libarchive.
If a skip request is > SSIZE_MAX, don't pass it down to the client layer
skip function, since those still uses size_t / ssize_t. Instead, just
read the data and throw it away.
With this commit, libarchive/bsdtar should now successfully skip archive
entries of >2GB on 32-bit systems, but does so slower than necessary.
The performance will improve with a future A[BP]I breaking commit which
makes client layer skip functions use off_t.
Jeff Roberson [Thu, 4 Jan 2007 12:16:19 +0000 (12:16 +0000)]
- Only allow the tdq_idx to increase by one each tick rather than up to
the most recently chosen index. This significantly improves nice
behavior. This allows a lower priority thread to run some multiple of
times before the higher priority thread makes it to the front of
the queue. A nice +20 cpu hog now only gets ~5% of the cpu when running
with a nice 0 cpu hog and about 1.5% with a nice -20 hog. A nice
difference of 1 makes a 4% difference in cpu usage between two hogs.
- Track a seperate insert and removal index. When the removal index is
empty it is updated to point at the current insert index.
- Don't remove and re-add a thread to the runq when it is being adjusted
down in priority.
- Pull some conditional code out of sched_tick(). It's looking a bit
large now.
Jeff Roberson [Thu, 4 Jan 2007 08:56:25 +0000 (08:56 +0000)]
ULE 2.0:
- Remove the double queue mechanism for timeshare threads. It was slow
due to excess cache lines in play, caused suboptimal scheduling behavior
with niced and other non-interactive processes, complicated priority
lending, etc.
- Use a circular queue with a floating starting index for timeshare threads.
Enforces fairness by moving the insertion point closer to threads with
worse priorities over time.
- Give interactive timeshare threads real-time user-space priorities and
place them on the realtime/ithd queue.
- Select non-interactive timeshare thread priorities based on their cpu
utilization over the last 10 seconds combined with the nice value. This
gives us more sane priorities and behavior in a loaded system as
compared to the old method of using the interactivity score. The
interactive score quickly hit a ceiling if threads were non-interactive
and penalized new hog threads.
- Use one slice size for all threads. The slice is not currently
dynamically set to adjust scheduling behavior of different threads.
- Add some new sysctls for scheduling parameters.
Bug fixes/Clean up:
- Fix zeroing of td_sched after initialization in sched_fork_thread() caused
by recent ksegrp removal.
- Fix KSE interactivity issues related to frequent forking and exiting of
kse threads. We simply disable the penalty for thread creation and exit
for kse threads.
- Cleanup the cpu estimator by using tickincr here as well. Keep ticks and
ltick/ftick in the same frequency. Previously ticks were stathz and
others were hz.
- Lots of new and updated comments.
- Many many others.
Jeff Roberson [Thu, 4 Jan 2007 08:39:58 +0000 (08:39 +0000)]
- Add three new functions to support circular run queues.
- runq_add_pri allows the caller to position the thread at any rqindex
regardless of priority.
- runq_choose_from() chooses the lowest priority thread starting from a given
index. The index is updated with the rqindex of the chosen thread. This
routine is used to pick the lowest priority relative to a given index.
- runq_remove_idx() updates the index if the run queue that held the removed
thread is now empty.
Jeff Roberson [Thu, 4 Jan 2007 08:36:40 +0000 (08:36 +0000)]
- Add SRQ_BORROWING to the list of switch reasons. ULE is the only consumer
at this time. It is used to optimize the run queue placement of threads
who have newly elevated priorities.
Craig Rodrigues [Thu, 4 Jan 2007 04:46:59 +0000 (04:46 +0000)]
Add sockipprotoname() function. Decode the third parameter (protocol)
of a socket() call with sockipprotoname() if the first parameter (domain)
is PF_INET or PF_INET6.
Old parsing behavior before this change:
ping6 CALL socket(PF_INET6,SOCK_RAW,0x3a)
New behavior after this change:
ping6 CALL socket(PF_INET6,SOCK_RAW,IPPROTO_ICMPV6)
Craig Rodrigues [Thu, 4 Jan 2007 04:28:17 +0000 (04:28 +0000)]
Generate sockdomainname() function with auto_if_type() instead
of auto_or_type.
The old parsing code would incorrectly decode a socket() call in the
ping6 program as:
CALL socket(PF_PUP|PF_ECMA|PF_APPLETALK|PF_COIP|PF_SIP,SOCK_DGRAM,0)
The new parsing code decodes the same socket() call as:
CALL socket(PF_INET6,SOCK_DGRAM,0)
Craig Rodrigues [Thu, 4 Jan 2007 04:18:03 +0000 (04:18 +0000)]
Add auto_if_type() function, which is similar to auto_switch_type().
However, auto_if_type() uses if/else statements in C instead
of a single switch statement, when mapping an integer value to
a #define. For certain cases where multiple #define constants
alias to a single integer value, auto_if_type() makes things easier
to parse than auto_switch_type().
Colin Percival [Wed, 3 Jan 2007 21:47:35 +0000 (21:47 +0000)]
Rewrite and simplify archive_read_format_tar_skip. Compression-layer skip
functions are required to skip the requested distance, so we can avoid
lots of bookkeeping which would otherwise be necessary.
David Schultz [Wed, 3 Jan 2007 21:28:26 +0000 (21:28 +0000)]
Remove the test that ensures that when the string "nan(...)" is converted
to floating-point, the result is a quiet NaN. The current implementation
may return a signaling NaN, and the vendor has no plans for changing this,
for reasons explained in the comment I added.
Luigi Rizzo [Wed, 3 Jan 2007 10:50:03 +0000 (10:50 +0000)]
protect against multiple inclusion (this is useful when you
start working with third party usb modules, where sometimes it
is not easy to set the inclusion order so that there are no multiple
inclusions, yet you want to compile with high WARNS levels).
I am not sure if there is a standard for having a leading and/or trailing _
in the macro name, the usb code seems to use both.
There are still several unprotected headers here so it might be useful
to do the same thing on other files as well as the need arises.
Hiroki Sato [Tue, 2 Jan 2007 20:42:08 +0000 (20:42 +0000)]
The nfsm_srvpathsiz() macro in nfsrv_symlink() in nfs_serv.c should
check length of the pathname in the range 0<=n<=NFS_MAXPATHLEN,
not 0<n<=NFS_MAXPATHLEN. This fixes a minor interoperability problem
that the FreeBSD NFS server did not allow a symlink pointing the empty
pathname.
Julian Elischer [Tue, 2 Jan 2007 19:57:31 +0000 (19:57 +0000)]
Remove a bunch of dependencies in the IP header being the first thing in the
mbuf. First moves toward being able to cope better with having layer 2 (or
other encapsulation data) before the IP header in the packet being examined.
More commits to come to round out this functionality. This commit should
have no practical effect but clears the way for what is coming.
Revirewed by: luigi, yar
MFC After: 2 weeks
Colin Percival [Tue, 2 Jan 2007 15:03:38 +0000 (15:03 +0000)]
Clean up the struct archive used for reading an archive in the handling
of @archive commands. This bug should be harmless as long as you don't
use an excessive number of @archive commands.
Florent Thoumie [Tue, 2 Jan 2007 11:07:13 +0000 (11:07 +0000)]
Jail_ip and jail_interface local variables were renamed to _ip and _interface
in a previous commit to avoid namespace collisions, unfortunately I missed two
of them. This leads to the ip alias being incorrectly removed in some cases
when using the stop command.
Reported by: Philipp Wuensche <cryx-freebsd@h3q.com>
Ceri Davies [Mon, 1 Jan 2007 17:25:51 +0000 (17:25 +0000)]
During an upgrade, if /boot/kernel.prev exists then the backup of
/boot/kernel can fail. Try to remove /boot/kernel.prev and cope the
best we can if that fails.
Robert Watson [Sun, 31 Dec 2006 20:26:20 +0000 (20:26 +0000)]
Only signal the CV indicating that the MAC Framework is available for
exclusive access if there is at least one thread waiting for it to
become available. This may significantly reduce overhead by reducing
the number of unnecessary wakeups issued whenever the framework becomes
idle.
Annotate that we still signal the CV more than necessary and should
fix this.
MFp4 (111746+):
Redo the checking for 2.6 emulation. We now cache the value of
use26 and replace calls to linux_get_osrelease() + parsing with
a call to linux_use26(). Typical path is lockless now.
Pointed out by: kib
This allows to ship RELENG_7_0 with a default osrelease of 2.4.2 and the
possibility to enable 2.6.x emulation without the possible performance
impact of the previous version of the check.
Yaroslav Tykhiy [Sun, 31 Dec 2006 11:07:29 +0000 (11:07 +0000)]
Allow for /usr/bin/env when parsing the shebang line from an
interpreted $command. Some "portable" sofware packages use such a
line to skip the task of figuring out the absolute pathname of the
interpreter at install time, e.g.:
#!/usr/bin/env python
It is insecure, but a popular book on Python seems to have advised
it to a wide audience. Hence a number of such scripts in the ports,
mostly written in Python.