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.
Yaroslav Tykhiy [Sat, 30 Dec 2006 22:53:20 +0000 (22:53 +0000)]
Eliminate global symbols starting with an underscore from rc.d
scripts, except for mdconfig* and jail. Such symbols are reserved
for the rc.subr internals. Most scripts can be fixed by just
declaring _foo symbols as local: few scripts actually need them to
be global.
Yaroslav Tykhiy [Sat, 30 Dec 2006 21:10:25 +0000 (21:10 +0000)]
- Don't defer the removal of an 802.1q header for no real reason.
- Micro-optimize the addition of an 802.1q header to match the removal code.
- Consistently check for interfaces being up and running.
- Consistently use NULL instead of 0 with pointers.
Bruce A. Mah [Sat, 30 Dec 2006 18:22:09 +0000 (18:22 +0000)]
Remove alpha-specific stuff from the hardware notes (these are mostly
in attributes for generating MD hardware, as well as a few alpha-only
paragraphs here and there).
While here, bump copyright date in dev.archlist.txt.
Paolo Pisati [Fri, 29 Dec 2006 21:59:17 +0000 (21:59 +0000)]
Summer of Code 2005: improve libalias - part 2 of 2
With the second (and last) part of my previous Summer of Code work, we get:
-ipfw's in kernel nat
-redirect_* and LSNAT support
General information about nat syntax and some examples are available
in the ipfw (8) man page. The redirect and LSNAT syntax are identical
to natd, so please refer to natd (8) man page.
To enable in kernel nat in rc.conf, two options were added:
o firewall_nat_enable: equivalent to natd_enable
o firewall_nat_interface: equivalent to natd_interface
Remember to set net.inet.ip.fw.one_pass to 0, if you want the packet
to continue being checked by the firewall ruleset after being
(de)aliased.
NOTA BENE: due to some problems with libalias architecture, in kernel
nat won't work with TSO enabled nic, thus you have to disable TSO via
ifconfig (ifconfig foo0 -tso).
Randall Stewart [Fri, 29 Dec 2006 20:21:42 +0000 (20:21 +0000)]
a) macro-ization of all mbuf and random number
access plus timers. This makes the code
more portable and able to change out the
mbuf or timer system used more easily ;-)
b) removal of all use of pkt-hdr's until only
the places we need them (before ip_output routines).
c) remove a bunch of code not needed due to <b> aka
worrying about pkthdr's :-)
d) There was one last reorder problem it looks where
if a restart occur's and we release and relock (at
the point where we setup our alias vtag) we would
end up possibly getting the wrong TSN in place. The
code that fixed the TSN's just needed to be shifted
around BEFORE the release of the lock.. also code that
set the state (since this also could contribute).
Approved by: gnn
Bjoern A. Zeeb [Fri, 29 Dec 2006 19:23:38 +0000 (19:23 +0000)]
bridge_snmp.h
* Change the API of bridge_get_basemac to take a maximum buffer length.
bridge_if.c
* Adopt to new API.
* In bridge_attach_newif() remove an additional pointer to the buffer
by shuffling the code a bit. Also makes the code more readable.
bridge_sys.c
* bridge_get_basemac():
- Adopt to the new API.
- Change check for error code of getifaddrs().
- First check for sa_family != AF_LINK.
- Copy sockaddr_dl * to get around alignment constraints on some
platforms.
- Use strcmp instead of strncmp so that "foo11" != "foo1".
* other functions:
- Allocate n times of the struct we need instead of arbitrary len,
cast to the type we want it to be and pass around struct *s instead
of char *s. This gets us around alignment restrictions on some
platforms and in addition it is more clear what data is passed around.
- Name variables for same types consistently.
John Baldwin [Fri, 29 Dec 2006 13:59:50 +0000 (13:59 +0000)]
Various bpf(4) related fixes to catch places up to the new bpf(4)
semantics.
- Stop testing bpf pointers for NULL. In some cases use
bpf_peers_present() and then call the function directly inside the
conditional block instead of the macro.
- For places where the entire conditional block is the macro, remove the
test and make the macro unconditional.
- Use BPF_MTAP() in if_pfsync on FreeBSD instead of an expanded version of
the old semantics.
Max Laier [Fri, 29 Dec 2006 13:59:03 +0000 (13:59 +0000)]
Work around a long standing LOR with user/group rules by doing the socket
lookup early. This has some performance implications and should not be
enabled by default, but might help greatly in certain setups. After some
more testing this could be turned into a sysctl.
Bruce Evans [Fri, 29 Dec 2006 13:36:26 +0000 (13:36 +0000)]
Try harder to garbage-collect the "LOCORE" (really asm) version of
MPLOCKED. The cleaning in rev.1.25 was supposed to have been undone
by rev.1.26, but 1.26 could never have actually affected asm files
since atomic.h is full of C declarations so including it in asm files
would just give syntax errors. The asm MPLOCKED is even less needed
than when misplaced definitions of it were first removed, and is now
unused in any asm file in the src tree except in anachronismns in
sys/i386/i386/support.s.