Commit Graph

3970 Commits

Author SHA1 Message Date
kleink 3925dc263a Regen from syscalls.master 1.141: [gs]ettimeofday(2) argument declaration
change.
2004-04-27 01:15:38 +00:00
kleink 681b62c2ce POSIX-2001: Add restrict keywords to gettimeofday(2) and setitimer(2);
further deprecate struct timezone usage by changing `tzp' argument to
gettimeofday() to void *; align utimes(2) declaration by changing `times`
argument from struct timeval * to struct timeval[2].  From Murray
Armfield in PR standards/25331.

In due curse, reflect these changes in futimes(2), lutimes(2), and
settimeofday(2).
2004-04-27 01:12:44 +00:00
kleink 679cb3e5a5 Regen from rev. 1.140:
POSIX-2001: Change the `who' argument to [gs]etpriority(2) from int
to id_t.  Partially addressing PR standards/25216 from Murray Armfield.
2004-04-25 22:21:17 +00:00
kleink 3e7f30c118 POSIX-2001: Change the `who' argument to [gs]etpriority(2) from int
to id_t.  Partially addressing PR standards/25216 from Murray Armfield.
2004-04-25 22:18:08 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
yamt ab195ed32f bio_doread: vp is always non-NULL here. 2004-04-25 12:41:12 +00:00
matt f86644a808 Constify the table argument to ttspeedtab. 2004-04-25 06:13:38 +00:00
atatat 3f800573aa Be consistent about using sysc_init_field() 2004-04-25 05:54:38 +00:00
atatat 990f278f7a Remove dynamic sysctl node version 0 from the tree. It seemed okay at
first, but quickly showed its shortcomings.  The version 1 node we're
now using should be good for a while.
2004-04-25 05:47:52 +00:00
simonb 9bc855a931 s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).
2004-04-23 02:58:27 +00:00
yamt 05076bfbb9 chgsbsize: correct limit check and ui_sbsize calculation.
ok'ed by Christos Zoulas.
2004-04-23 02:13:29 +00:00
enami 45a4841ce9 Copy fsidx so that not to break binary compatibility of mountd etc. 2004-04-22 03:47:58 +00:00
matt e50668c7fa Constify protosw arrays. This can reduce the kernel .data section by
over 4K (if all the network protocols) are loaded.
2004-04-22 01:01:40 +00:00
matt fde909e1a1 Add prototype for uiomove_frombuf. Change uiomove_frombuf to use size_t
for its length argument (to be the same as uiomove).  Remove code that
dealt with length being negative.
2004-04-21 20:31:50 +00:00
itojun d2f1c029b9 kill sprintf, use snprintf 2004-04-21 18:40:37 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
christos ed95f3e980 Charge root for socket buffers without a socket pointer. 2004-04-19 03:44:46 +00:00
lukem fad77af2ac Add "vfs.generic.fstypes" sysctl, which contains a space separate
list of file system types currently supported by the kernel.
Previously there wasn't an easy way to determine this.
(Code shamelessly cribbed from subr_disk.c::sysctl_hw_disknames().)

Use LIST_FOREACH() appropriately.
2004-04-19 00:15:55 +00:00
matt ac57eb9d5b Constify sun_noname. 2004-04-18 22:20:32 +00:00
matt 70e1f0d3ac ANSI'fy. 2004-04-18 21:48:15 +00:00
matt 91bb3497f5 Constify the addr parameter to sbappenaddr. 2004-04-18 21:47:11 +00:00
matt 8f23e3baa1 sbreserve can be called with a NULL socket, deal with it. 2004-04-18 16:38:42 +00:00
christos f13a3d0852 PR/9347: Eric E. Fair: socket buffer pool exhaustion leads to system deadlock
and unkillable processes.
1. Introduce new SBSIZE resource limit from FreeBSD to limit socket buffer
   size resource.
2. make sokvareserve interruptible, so processes ltsleeping on it can be
   killed.
2004-04-17 15:15:29 +00:00
atatat 904ca21614 Prefer that kern.hostid is printed in hex, not as a signed decimal,
and avoid accidental sign-extension when setting it.
2004-04-16 13:25:40 +00:00
pk f663e2397e checkalias: pass LK_NOWAIT to vget() while holding the spechash spinlock. 2004-04-16 09:59:32 +00:00
provos 2e7c8ca97f check process flags, noted by Stefan Esser 2004-04-09 16:49:33 +00:00
atatat 3a5915c0ae Lots of sysctl descriptions (if someone wants to help out here, that
would be good) mostly copied from sysctl(3).  This takes care of the
top-level, most of kern.* and hw.* (modulo the ath and bge stuff), and
all of proc.*.

If you don't want the added rodata in your kernel, use "options
SYSCTL_NO_DESCR" in your kernel config.
2004-04-08 06:20:29 +00:00
atatat a70c39ff35 Clear out the struct kinfo_drivers before stuffing things into it.
Avoids leaking garbage from the stack (left over from the earlier
call to sysctl_locate()).
2004-04-08 03:35:10 +00:00
atatat 275e2ae7f3 First caller to set a description on a node sets it. This allows one
setup function to set the description, even if the node has been
instantiated elsewhere.  Or not, depending on the other that the setup
functions are called.
2004-04-06 18:52:35 +00:00
yamt 4972de4cca make cache_purge more controlable.
namely, allow following operations.
	- purge only an entry specified by a component name.
	- purge only child entries.
	- purge only parent entries.
no objections on tech-kern@.
2004-04-05 10:20:52 +00:00
yamt 9aa8d354bd add assertions related to file descriptor allocation. 2004-04-05 10:10:29 +00:00
pk b3efee4b3b We use maxdmap and maxsmap, so remove comment questioning that. 2004-04-04 18:22:44 +00:00
matt 4dfb2be423 When a process is being traced (debugged) and a catchable signal arrives,
make sure to save its ksiginfo_t for eventual delivery.  This makes debugging
SA_SIGINFO signal handlers work.
2004-04-03 19:46:10 +00:00
matt dfe066e777 Add the notion of an "empty" ksiginfo_t (one where on signo is filled in).
Add an initializer for them: KSI_INIT_EMPTY
Add a predicate for them: KSI_EMPTY_P
Don't bother storing empty ksiginfo_t's since they have no information.
Change uses of KSI_INIT to KSI_INIT_EMPTY where no other information other
than the signo is being filled in.
2004-04-03 19:43:08 +00:00
matt 11d24b6c29 Replace memset's of ksiginfo_t with KSI_INIT (which is the proper way to
initialize ksiginfo_t structures).
2004-04-03 19:38:04 +00:00
matt 44708bbf1a If a signal is the result of trap, only invoke a supplied handler if it's
not blocked.  Otherwise (it if it blocked or the hanlder is set to SIG_IGN)
reset the signal back to its default settings so that a coredump can be
generated.
2004-04-01 16:56:44 +00:00
atatat f06d00c1a8 Add the standard "is this tree writeable" check to sysctl_describe()
and a comment to sysctl_destroy() about why the check is slightly
different there.
2004-04-01 04:50:06 +00:00
yamt f74afe6463 ras_fork: don't do PR_WAITOK holding a spinlock. 2004-04-01 02:37:42 +00:00
yamt b27349c286 ras_install: don't do pool_get(PR_WAITOK) while we're holding a spinlock. 2004-04-01 01:49:04 +00:00
matt b173c9d332 Make kernel continuations optional for now. 2004-03-28 22:43:56 +00:00
atatat d97889de23 Fix sysctl_createv() so that rnode and cnode can refer to the same
pointer.  Fix sysctl_create() so that nodes cannot be added to an
alias node.
2004-03-27 04:26:23 +00:00
petrov 2edf945c23 sys_sa_yield returns EJUSTRETURN. 2004-03-27 00:49:47 +00:00
jonathan 63fe9ef057 Use proper NetBSD conventions for deferred kthread creation, not the
other semantics from an earlier incarnation.

Call kcont_init() from init_main before device autoconfiguration,
so kcont is availble to device drivers if required.

Also ensure the kthread process runs any pending continuations once
the kthread is finally up and running. For now, use a non-null timeout
to poll the queue periodically.  Draining any pending requests just
before the kthread enters its ltsleep()/kc_run loop is cleaner, but
this is the version I tested with an early-in-boot kcont request.)
2004-03-27 00:42:38 +00:00
drochner 945c30f4ab all ports define __HAVE_SIGINFO now, so remove the CPP conditionals 2004-03-26 17:13:37 +00:00
drochner 4f4ec7e627 regen after __HAVE_SIGINFO removal 2004-03-26 15:29:28 +00:00
drochner 9fd8e8983b all ports define __HAVE_SIGINFO now, so remove the CPP conditionals 2004-03-26 15:18:54 +00:00
simonb 1c13fd358f Give buf_lotsfree() a bit of a service:
- Fix a 32-bit overflow that could erroneously return true even if the
  currently allocated buffer memory was greater than the high water mark.
- Add an early check for bufmem > hiwater to avoid a needless call to
  random().
- Sprinkle some comments.

Add a vm.bufmem sysctl so the current bufmem value can be easily queried
from userland.

Reviewed by Thor Simon.
2004-03-26 00:31:55 +00:00
simonb 07056cd3d1 More white space nits. 2004-03-25 23:17:16 +00:00
enami c4a655ef80 Misc. style fix; white-space usage, comment style, ansify, multiple
include protection, rcsid, typo, ...
2004-03-25 23:02:58 +00:00
atatat 76f167c40b Set version in node destroy request 2004-03-25 22:16:04 +00:00
pooka 845a217e15 Convert pool_get()'s from nowait to waitok. We're allowed to block,
and this is more acceptable since the code assumes success.

gmcgarry ok
2004-03-25 22:08:33 +00:00
atatat 44afe14cb6 Unwind the nested designators for fields within structs within structs
(or unions).  This should really be put back once we're all using gcc3
for everything, since that makes it look a *lot* cleaner.
2004-03-25 18:36:49 +00:00
drochner bcb7a96b95 In exec_sigcode_map(), do nothing if the sigcode is of
size 0.
This way, individual ports can circumvent sigcode mapping
by setting sigcode/esigcode.
(would be better to clean up the __HAVE_SIGINFO/COMPAT_XX
stuff, but it is not a good moment now)
2004-03-25 18:29:24 +00:00
simonb c67d420cbf White-space nit. 2004-03-25 08:22:31 +00:00
pooka 8a7ed44002 * replace incorrect M_WAITOK flag from pool_get() by proper PR_WAITOK
and remove redundant check for NULL return value
* switch pool page allocator to nointr allocator

jdolecek sayeth ok
2004-03-24 20:25:28 +00:00
atatat 38c4183b04 Implement sysctl descriptions. Now all that remains is actually to
write them.
2004-03-24 18:11:09 +00:00
atatat 5aab77f087 Framework for sysctl descriptions. Implementation to follow shortly. 2004-03-24 17:40:02 +00:00
atatat c6abd47f96 New node version and layout. This should take care of the netbsd32
emulation problem, formalizes the versioning (should it ever be needed
again), and provides a slot for descriptions.
2004-03-24 17:21:02 +00:00
atatat 289b641ef9 Implement sysctllog and sysctl_teardown(), which unwinds the log. 2004-03-24 16:55:49 +00:00
atatat d42aae36c0 The new sysctl query interface returns the same information as the old
one, but you must pass in an empty node that indicates the version
you're using.
2004-03-24 16:34:34 +00:00
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
atatat 70057f1d4e That copystr() should be copyinstr(), and fix a couple of places where
aliasing needs to be avoided.
2004-03-24 15:25:43 +00:00
pooka cca4b8c09d tyop in comment 2004-03-24 10:01:46 +00:00
matt 3549b49655 Don't use malloc/free for fixed sized items, use a pool instead. 2004-03-24 01:27:57 +00:00
junyoung fdc32973e7 - Nuke __P().
- Drop trailing spaces.
2004-03-23 13:22:32 +00:00
junyoung a222c81884 Nuke __P(). 2004-03-23 13:22:03 +00:00
cl d636a8b9cb On MP, exit postsig() when another LWP has already handled the signal while
this LWP was waiting for the kernel lock.

Fixes PR kern/24829
2004-03-21 18:41:38 +00:00
mycroft 9f9d44127e Remove part of a very old change that caused NFS to not enforce socket buffer
limits.  No idea why it was done in the first place.

Don't remember who reported this, but I think it was yamt.
2004-03-21 00:54:46 +00:00
he cbeffeb007 Make this compile on platforms which do not define
__HAVE_GENERIC_SOFT_INTERRUPTS, such as sun3.
2004-03-20 18:34:57 +00:00
martin c72dda16a9 Include <lib/libkern/libkern.h> for KASSERT. 2004-03-20 10:39:21 +00:00
snj 089c0cfc10 Fix typos. 2004-03-20 02:57:34 +00:00
jonathan ec8cb83cd3 Initial import of kcont(9), as posted to tech-kern for discussion in
January 2004. This version also incorporates fixes (several typos and
other detailed improvemnts) commented upon by Nathan J Williams.
2004-03-20 02:22:49 +00:00
enami 55c19744c4 - remove unnecessary code.
- factor out common code.
- don't stop searching before the target.
- touch the correct object.
- validate the argument before the loop otherwise we need to roll back.
2004-03-18 22:57:38 +00:00
enami a67d24818d Whitespace nits and wrap some lines. 2004-03-18 22:53:16 +00:00
christos b4d69b5716 PR/24814: Colin Percival: sysv_sem waiter counting problem 2004-03-18 01:16:44 +00:00
yamt 639cdf812b sokvaalloc: unreserve kva if uvm_km_valloc_wait failed. 2004-03-17 10:30:18 +00:00
yamt 82b343cc81 - move kern.somaxkva sysctl stuff from init_sysctl.c to uipc_socket.c.
- when changing its value, wakeup sokva waiters.
2004-03-17 10:21:59 +00:00
yamt 097a3aea2e - fix locking of sosend kva allocation.
- some comments.
2004-03-17 10:03:26 +00:00
yamt 2429c10607 remove per-socket pendfree list. 2004-03-17 09:58:15 +00:00
cl ea5ec0212d add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
  * VP id
  * lock on VP data
  * LWP on VP
  * recently blocked LWP on VP
  * queue of LWPs woken which ran on this VP before sleep
  * faultaddr
  * LWP cache for upcalls
  * upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP
2004-03-14 01:08:47 +00:00
cl f1bacc8b38 disable SA upcalls during "systrmsg" sleep
-> improves problem from PR bin/23429
2004-03-14 00:48:58 +00:00
cl 63fe298156 regen after:
g/c sys_sa_unblockyield which has been unused since 2004/01/02
2004-03-14 00:47:25 +00:00
cl 919b9e33c4 g/c sys_sa_unblockyield which has been unused since 2004/01/02 2004-03-14 00:45:21 +00:00
matt 879040549d Only do the pmap_procwr if the uvm_io succeeded. 2004-03-13 18:43:18 +00:00
christos 7bd0e983e2 PR/24750: Frank Kardel: panic when process is signalled during
proc initialization.
2004-03-11 22:34:26 +00:00
christos cde926b610 PR/24745: Jared Momose: kernel prompts for a root device when using md_root 2004-03-11 15:17:55 +00:00
yamt f75335b469 - add a function prototype.
- consitify.
2004-03-09 12:23:07 +00:00
yamt cd9b5b72f5 m_cat: assert mbuf types only when coalescing them by copying.
mbuf n often have 0-sized "headers" and their types don't matter much.

PR/24713 from Darrin B. Jewell.
2004-03-09 06:37:59 +00:00
dbj 7a30c4a987 add more spltty() calls around TTY_LOCK/UNLOCK where needed 2004-03-09 05:30:24 +00:00
junyoung 70706199eb Whitespaces. 2004-03-09 02:35:45 +00:00
dbj 436daafe7e add splvm() around a few pa_slock and psppool calls since they
may be shared with pools that can be used in interrupt context.
2004-03-08 22:48:09 +00:00
atatat 73c41a46cc Some optimization for sysctl_locate() 2004-03-08 03:31:26 +00:00
junyoung 0f89803028 Drop trailing spaces. 2004-03-05 11:30:50 +00:00
junyoung 103afd6ebf lwp_exit2(): set lwp state to SZOMB at more appropriate point. 2004-03-05 11:17:41 +00:00
dbj f8e0478668 add some spltty() calls around TTY_LOCK() calls that didn't have them 2004-03-05 07:27:22 +00:00
matt 1b4f540b78 Look at _UC_STACK to decide whether the process' SS_ONSTACK state needs to
be updated.  (This is needed to be compatible with how pre-SIGINFO signals
operated.  If you siglongjmp out of a signal handler, the SS_ONSTACK state
needs to be cleared.  This commit restores that functionality).
2004-03-04 00:05:58 +00:00
dsl 1288fac2ba No need to initialise [rw]pipe twice.
Initialise locks before trying to allocate pipe buffer, when allocate
fails we'll not explode trying to acquire the locks when tidying up.
2004-03-03 22:00:34 +00:00
christos 08230af71c initialize rpipe and wpipe to NULL, so that they are initialized in the
error path.
2004-03-03 21:35:52 +00:00
yamt 471ef5f249 once exit1() releases big kernel lock, the struct proc can be freed and
re-used by another cpu immediately.  in that case, lwp_exit2() will
access freed memory.  to fix this:

- remove curlwp from p_lwps in exit1() rather than letting lwp_exit2() do so.
- add assertions to ensure freed proc has no lwps.

kern/24329 from me and kern/24574 from Havard Eidnes.
2004-03-02 09:15:26 +00:00
yamt 395e9958f2 change the way to handle NEW_BUFQ_STRATEGY option.
instead of putting #ifdefs into each drivers,
use a global variable to indicate default strategy.

XXX should have a way to specify other strategies.
2004-02-28 06:28:47 +00:00
junyoung d177d4c744 More typos in comments. 2004-02-27 02:43:25 +00:00
junyoung c5a0b24bb5 pgrpdump() is gone. 2004-02-26 11:29:41 +00:00
junyoung 213495299b - Fix typos.
- De-__P().
- Remove trailing spaces.
2004-02-26 11:20:08 +00:00
jdolecek 52197d307a pipelock() must release the pipe simplelock during tsleep()
fixes PR kern/24551 by Havard Eidnes
2004-02-26 08:15:31 +00:00
itojun efcd57f822 m_cat() - if it is safe, copy data portion into 1st mbuf even if 1st mbuf
is M_EXT mbuf.
2004-02-26 02:30:04 +00:00
enami dab2cb5bb0 Whitespace nits. 2004-02-25 21:40:40 +00:00
enami f7b4bb80a5 Make ktrwrite() and ktrinitheader() private again. ktrsyscall32() no longer
exists.
2004-02-25 21:34:18 +00:00
dbj 5fd36718ae fix typo in comment s/MNT_LAXY/MNT_LAZY/ 2004-02-25 04:10:28 +00:00
christos 7088db9a48 remove error(1) comment. 2004-02-24 20:57:26 +00:00
wiz f05e6f1a3a occured -> occurred. From Peter Postma. 2004-02-24 15:12:51 +00:00
jdolecek 4d49760268 use the new NOTE_SUBMIT to flag if the locking is necessary
for EVFILT_READ/EVFILT_WRITE knotes

fixes PR kern/23915 by Martin Husemann (pipes), and similar locking problem
in tty code
2004-02-22 17:51:25 +00:00
jdolecek 2ae728e7ef mount(2): if vinvalbuf() fails, we must also vput() the mountpoint vnode
fixes stale vnode lock after attempt to mount something on a NTFS directory
2004-02-22 09:56:26 +00:00
dan 5819919614 micro-optimisation - if we're going to return 0, do so before doing
other unnecessary work
2004-02-22 01:00:41 +00:00
enami 06107df871 Modify pool page header allocation strategy as follows:
In addition to current one (i.e., don't wast so large part of the page),
- if the header fitsin the page without wasting any items, put it there.
- don't put the header in the page if it may consume rather big item.

For example, on i386, header is now allocated in the page for the pools
like fdescpl or sigapl, and allocated off the page for the pools like
buf1k or buf2k.
2004-02-22 00:19:48 +00:00
atatat 56392ab40b Use KERN_PROCSLOP for struct kinfo_proc and KERN_LWPSLOP for
struct kinfo_lwp, and not vice versa.

Should solve the issue with top dying because it's unable to "allocate
memory".
2004-02-21 03:27:57 +00:00
atatat 42d379d041 Use new PTRTOUINT64() macro instead of local PTRTOINT64() macro. 2004-02-19 03:57:56 +00:00
atatat caea20e952 Add PTRTOUINT64() and UINT64TOPTR() macros to sys/sysctl.h for use by
kern.proc, kern.proc2, kern.lwp, and kern.buf.

Define more MIB for kern.buf so that specific buffers can be selected
(only all/all is supported right now), and use a 32/64 bit agnostic
structure for communcating buffer information to userland.

Convert systat to the new kern.buf method.

Clean up the vm.buf* handling a little.  There's no actual need to
record the dynamically assigned OIDs, since sysctl_data can tell us
what we're looking at.

Oh, and fix a typo in a comment.
2004-02-19 03:56:30 +00:00
matt cb57c6f8e9 Move detection of a special symbol into a separate function. Add some more
special symbols.
2004-02-19 03:42:01 +00:00
matt f01501b2c6 Support really large LKMs. Find out how much space is needed for symbols
and then allocate it on demand.  Rename some common symbols (__bss_start,
_edata, _end, __start_link_set_*, __stop_link_set_*) so that ".<module>"
is appended to them.  This shrinks an amd64 kernel by 20KB of BSS.
2004-02-18 23:44:49 +00:00
matt 004f0d503a s/sumbols/symbols/ 2004-02-18 20:41:09 +00:00
hannken c59d4851b8 Run pmap_deactivate() earlier in exit1(). Prevents a panic on sparc MP
where p->p_vmspace was 0xdeadbeef in pmap_deactivate().

Approved by: YAMAMOTO Takashi <yamt@netbsd.org>
2004-02-18 14:42:20 +00:00
simonb d7ee872c5f Don't shadow a function name with a parameter. 2004-02-17 11:36:01 +00:00
tron 7008209ace Include "sys/systm.h" to get the prototype for panic() which is required
for diagnostic kernels.
2004-02-17 08:22:12 +00:00
rtr 8845b1e975 split off the evcnt code (which is unrelated to autoconfiguration)
into a separate file

approved by simonb@
2004-02-17 05:03:15 +00:00
enami 456851e71a Some whitespace fix. 2004-02-17 01:45:34 +00:00
enami d59c88c291 The vnode capability id is gone. 2004-02-17 01:35:33 +00:00
enami 6a268a570b Rewind the `bp' advanced backward by cache_revlookup() if getcwd_getcache()
finally returns cache miss.

# Slightly modified from posted version so that it is cleanly patchable
# at least on 1.6 branch.
2004-02-17 01:29:39 +00:00
yamt 0e9e078e22 - raise ipl when calling buf_canrelease() because it traverses buffer queue.
- correct/add comments on buf_canrelease().
2004-02-16 09:34:15 +00:00
jdolecek 159f41eca4 allocate wired memory for the marker kevent in kqueue_scan() instead
of using on-stack memory, so that this wouldn't eventually cause kernel
panic if the process get swapped out and another process runs kqueue_scan()
problem pointed out in kern/24220 by Stephan Uphoff
2004-02-14 11:56:28 +00:00
hannken 142e9d5deb Add a generic copy-on-write hook to add/remove functions that will be
called with every buffer written through spec_strategy().

Used by fss(4). Future file-system-internal snapshots will need them too.

Welcome to 1.6ZK

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-02-14 00:00:56 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
enami 7ff66821f4 Also defer the writing of KTR_EMUL entry. Otherwise, the parent process
may sleep with setting KTRFAC_ACTIVE of child process and the child will
run without emitting any ktrace entry.
2004-02-12 23:47:21 +00:00
tls eb9b96577c Fix bug noted by yamt@netbsd.org: the UVM free target is in *pages*,
so the last change has us comparing pages to bytes instead of pages
to buffers!  The consequence was to try to free radically less memory
than UVM wanted us to -- though always at least one buffer, which is
probably why the results weren't dire.

This does suggest that buf_canrelease() could be a *lot* more
conservative about how much to release than "2 * page deficit".  In
fact, serious trouble seems to ensue if it's not -- when anything
else on the system demands enough pages, we slam down to the low
water mark nd stay there.  I've adjusted it to use min(page defecit,
buffer memory / 16), which still isn't quite right but seems better.

Another change: consider the case of an infinite loop that does
"tar xzf pkgsrc.tar.gz ; rm -rf pkgsrc".  Each time the rm runs,
all the dead metadata will go on the AGE list -- and, until we hit
the high-water mark, stay there, at which point it may be slowly
recycled.  Two adjustments seem to solve this:  1) whack buf_lotsfree()
to return 0 if there's anything on the AGE list; 2) whack buf_canrelease()
to count the memory used by the AGE list and always return at least
that much.

This basically turns the AGE list into a "delayed free" list, since we
can't entirely eliminate it as we can't free pool items from interrupt
context (e.g. from biodone()).

To consider: with the bookkeeping corrected, should buf_drain() move
back to the _end_ of the pagedaemon, and should the calculation then
try to give back at least the current defecit?
2004-02-11 17:36:31 +00:00
yamt 1e18e59746 - borrow vmspace0 in uvm_proc_exit instead of uvmspace_free.
the latter is not a appropriate place to do so and it broke vfork.
- deactivate pmap before calling cpu_exit() to keep a balance of
  pmap_activate/deactivate.
2004-02-09 13:11:21 +00:00
yamt fa47baddee lwp_exit2: grab kernel_lock to preserve locking order. 2004-02-09 13:02:48 +00:00
yamt a45adbd9c7 don't deactivate pmap in exit1 because we'll touch the pmap later.
instead, borrow vmspace0 immediately before destroying the pmap
in uvmspace_free.
2004-02-07 10:05:52 +00:00
christos 13057976a6 include <uvm/uvm_object.h> for the benefit of ports that don't include
it in <machine/pmap.h>
2004-02-06 13:46:27 +00:00
junyoung 48d5030e12 ANSIfy & zap some blank lines. 2004-02-06 08:08:46 +00:00
junyoung 9a410f9ed0 Rename es_check in struct execsw to es_makecmds. 2004-02-06 08:02:58 +00:00
pk f092315b50 pg_delete: re-arrange SESSRELE() calls to allow for better code generation. 2004-02-06 06:59:33 +00:00
pk 7026ce08c8 ioctl TIOCSCTTY: re-arrange SESSHOLD() calls to allow for better code generation. 2004-02-06 06:58:21 +00:00
christos 0283dcd8a6 - Don't use uao_ functions directly; use them through the pgops methods.
- Fix missing reference leak in the error path of shmat() mentioned in
  Full-Disclosure.
2004-02-05 22:28:33 +00:00
christos 6b1b54b981 Don't use uao_reference, directly use the pgops instead. XXX: we should
prolly make all the uao_ functions used in pgops static.
2004-02-05 22:26:52 +00:00
tls aeaf748ff2 Buffer cache fixes to avoid thrashing between high and low water marks
and uncontrolled growth.

The key fix is from Dan Carasone, who noticed that buf_canfree() was
counting in _bytes_ but freeing in _buffers_, which caused the instant
drop to lowater observed by some users.

We now control the rate of growth; the probability of getting a new
allocation is inversely proportional to the current size of the
cache.  This idea is from a long-ago conversation with Kirk McKusick
and, if memory serves, was used for the file-system cache in some
other BSD variant at some point in history.

With growth and shrinkage more or less dealt with, we return the
default maximum cache size to 15%.  The default _minimum_ cache size
is raised from 1/16 of the maximum cache size to 1/8, since 1/16 was
chosen when the maximum size was 30% of memory.

Finally, after observing the behaviour of the pagedaemon and the
buffer cache drainer under pathological workloads (e.g. a benchmark
that steps through 75% of available memory backwards) I have moved
the call to buf_drain() to the beginning of the pagedaemon from the
end; if the pagedaemon bogs down, it still won't get run as often
as it should, but at least this way it will see the state of the
free count and free target _before_ the scan step does its thing.
2004-01-30 11:32:16 +00:00
tsarna 72489e1ea0 uuidgen(2) syscall. Originally from FreeBSD, ported by John Franklin in
PR#23470, with minor updates by me. This is only the syscall support
from that PR, for now.

Changes: port over fix from FreeBSD for multicast address generation.
Changed bcopy to memcpy.  For now, #ifdef notyet the portions of
kern_uuid.c that are meant to be used by (currently nonexistent) other
things in the kernel.  Added syscall to COMPAT_FREEBSD as well, though
that's currently not useful, as any program new enough to use this call
also uses other syscalls we don't (yet) emulate.
2004-01-29 02:00:02 +00:00
dan c6ba3edf9d Reduce the default BUFCACHE to 10% for now. Too many users are
tripping over this getting too large, and suffering other performance
problems due to the lack of good backpressure shrinking the bufcache
when other memory is required.  Again, this tunable should be
revisited when the backpressure mechanism has been improved.

sysctl vm.bufcache can be used to manually tune those rare machines
that might need more than this.

See comments in rev 1.106 for more detail.
2004-01-27 11:35:23 +00:00
hannken 3db4e2acd8 Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp)  Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp)      Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
2004-01-25 18:06:48 +00:00
hannken d7f6cbf8bc Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern. 2004-01-25 18:02:04 +00:00
hannken b1cb363c11 Make VOP_STRATEGY(bp) a real VOP as discussed on tech-kern.
VOP_STRATEGY(bp) is replaced by one of two new functions:

- VOP_STRATEGY(vp, bp)  Call the strategy routine of vp for bp.
- DEV_STRATEGY(bp)      Call the d_strategy routine of bp->b_dev for bp.

DEV_STRATEGY(bp) is used only for block-to-block device situations.
2004-01-25 18:02:03 +00:00
wiz f62661e104 Add semicolons after variable declarations; closes PR 24201. 2004-01-24 01:40:57 +00:00