Commit Graph

2671 Commits

Author SHA1 Message Date
jdolecek 18c0643bfb Update the uio resid counts appropriately when any error occurs
(not just EPIPE), so that the higher-level code would note partial
write has happened and DTRT if the write was interrupted due to
e.g. delivery of signal.

This fixes kern/14087 by Frank van der Linden.
Much thanks to Frank for extensive help with debugging this, and review
of the fix.

Note: EPIPE/SIGPIPE delivery behaviour was retained - they're delivered
even if the write was partially successful.
2001-09-29 13:48:11 +00:00
chs a76b67cf09 jump through hoops to avoid calling uvm_km_free_poolpage() while holding
spinlocks, since that function can sleep.  (note that there's still one
instance remaining to be fixed.)  use TAILQ_FOREACH where appropriate.
2001-09-26 07:14:56 +00:00
enami b0df86c9e6 In the function getnewvnode:
- Mark file system busy again on retry.
- Don't use the variable `listhd' uninitialized.
2001-09-26 00:59:57 +00:00
jdolecek 25bef3c837 Take care to transfer whole buffer passed via write(2); write(2) should
not do short writes unless when using non-blocking I/O.
This fixes kern/13744 by Geoff C. Wing.

Note this partially undoes rev. 1.5 change. Upon closer examination,
it's been apparent that hbench-OS expectations were not actually justified.
2001-09-25 19:01:21 +00:00
chs 039c1fd312 print a stack trace in more LOCKDEBUG cases.
add a blank line between complaints.
use TAILQ_FOREACH where appropriate.
2001-09-25 06:13:29 +00:00
chs e7d9abce3e in ltsleep(), assert that the interlock is held (if one is given). 2001-09-25 01:38:38 +00:00
chs 7bb91a0959 resize the namecache hash table also when desiredvnodes changes. 2001-09-24 06:01:13 +00:00
sommerfeld b27c418d40 Deal with invokers who pass us environment variable settings as part
of the command they want us to run.

Fixes part 3A of PR#14046
2001-09-24 00:20:11 +00:00
sommerfeld acf40b361c Correct comment to match code 2001-09-22 22:36:30 +00:00
jdolecek 8573719e3d add new UVM_LOAN_WIRED flag - the memory pages loaned in TOPAGE case
are only wired if this flag is present (i.e. they are not wired by default now)
loaned pages are unloaned via new uvm_unloan(), uvm_unloananon() and
uvm_unloanpage() are no longer exported
adjust uvm_unloanpage() to unwire the pages if UVM_LOAN_WIRED is specified
mark uvm_loanuobj() and uvm_loanzero() static also in function implementation

kern/sys_pipe.c: uvm_unloanpage() --> uvm_unloan()
2001-09-22 05:58:04 +00:00
chs d0b76cab5e use shared locks instead of exclusive for VOP_READ() and VOP_READDIR(). 2001-09-21 08:02:55 +00:00
jdolecek 1d161cb2d4 call pmap_update() after pmap_enter()s
ALWAYS call uvm_unloanpage() in cleanup - it's necessary even
in pipe_loan_free() case, since uvm_km_free() doesn't seem
to implicitly unloan the loaned pages
2001-09-20 19:09:13 +00:00
jdolecek ef8abe0767 Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
2001-09-18 19:36:32 +00:00
jdolecek a7357fecf4 soreceive(): do not ignore uiomove() error
Problem reported and fix provided by Aaro Koskinen in kern/11692.
2001-09-17 18:59:29 +00:00
wiz 456dff6cb8 Spell 'occurred' with two 'r's. 2001-09-16 16:34:23 +00:00
jmc 87a006a7de Fix issues areound compilation errors (ntv is a pointer in adjtime1 and needs
-> rather than . access and adjtime1 needs the syscall args passed in)
2001-09-16 09:55:26 +00:00
manu adb22920bc Split root-only time-related system calls so that we have an upper part, that
checks root privs, and a lower part that does the actual job. The lower part
will be called by the upcoming clockctl driver. Approved by Christos
Also fixed a few cosmetic things
2001-09-16 06:50:06 +00:00
chs d9faf4d4e7 regen 2001-09-15 20:37:36 +00:00
chs 64c6d1d2dc a whole bunch of changes to improve performance and robustness under load:
- remove special treatment of pager_map mappings in pmaps.  this is
   required now, since I've removed the globals that expose the address range.
   pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
   no longer any need to special-case it.
 - eliminate struct uvm_vnode by moving its fields into struct vnode.
 - rewrite the pageout path.  the pager is now responsible for handling the
   high-level requests instead of only getting control after a bunch of work
   has already been done on its behalf.  this will allow us to UBCify LFS,
   which needs tighter control over its pages than other filesystems do.
   writing a page to disk no longer requires making it read-only, which
   allows us to write wired pages without causing all kinds of havoc.
 - use a new PG_PAGEOUT flag to indicate that a page should be freed
   on behalf of the pagedaemon when it's unlocked.  this flag is very similar
   to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
   pageout fails due to eg. an indirect-block buffer being locked.
   this allows us to remove the "version" field from struct vm_page,
   and together with shrinking "loan_count" from 32 bits to 16,
   struct vm_page is now 4 bytes smaller.
 - no longer use PG_RELEASED for swap-backed pages.  if the page is busy
   because it's being paged out, we can't release the swap slot to be
   reallocated until that write is complete, but unlike with vnodes we
   don't keep a count of in-progress writes so there's no good way to
   know when the write is done.  instead, when we need to free a busy
   swap-backed page, just sleep until we can get it busy ourselves.
 - implement a fast-path for extending writes which allows us to avoid
   zeroing new pages.  this substantially reduces cpu usage.
 - encapsulate the data used by the genfs code in a struct genfs_node,
   which must be the first element of the filesystem-specific vnode data
   for filesystems which use genfs_{get,put}pages().
 - eliminate many of the UVM pagerops, since they aren't needed anymore
   now that the pager "put" operation is a higher-level operation.
 - enhance the genfs code to allow NFS to use the genfs_{get,put}pages
   instead of a modified copy.
 - clean up struct vnode by removing all the fields that used to be used by
   the vfs_cluster.c code (which we don't use anymore with UBC).
 - remove kmem_object and mb_object since they were useless.
   instead of allocating pages to these objects, we now just allocate
   pages with no object.  such pages are mapped in the kernel until they
   are freed, so we can use the mapping to find the page to free it.
   this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
2001-09-15 20:36:31 +00:00
chs adf5d360a7 add a new VFS op, vfs_reinit, which is called when desiredvnodes is
adjusted via sysctl.  file systems that have hash tables which are
sized based on the value of this variable now resize those hash tables
using the new value.  the max number of FFS softdeps is also recalculated.

convert various file systems to use the <sys/queue.h> macros for
their hash tables.
2001-09-15 16:12:54 +00:00
enami 163c9dd7c1 Defopt CALLWHEEL_STATS. 2001-09-13 05:22:16 +00:00
thorpej 16c229ea7c Optimization suggested by Bill Sommerfeld: Keep a hint as to the
"earliest" firing callout in a bucket.  This allows us to skip
the scan up the bucket if no callouts are due in the bucket.

A cheap O(1) hint update is done at callout insertion (if new callout
is earlier than hint) and removal (is bucket empty).  A thorough
refresh of the hint is done when the bucket is traversed.

This doesn't matter much on machines with small values of hz
(e.g. i386), but on systems with large values of hz (e.g. Alpha),
it has a definite positive effect.

Also, keep the callwheel stats in evcnts, so that you can view them
with "vmstat -e".
2001-09-11 04:32:19 +00:00
christos fdad5eb59c Don't trash the ref count of cred. It causes a memory leak. 2001-09-08 15:34:06 +00:00
christos f556e46298 Hijack the credentials used to evaluate access, to avoid a potential lwp
race by modifying the proc's credentials temporarily. From Bill Sommerfeld.
Thanks for forcing me to do this right :-)
2001-09-08 02:05:39 +00:00
christos 51d673156c Set the credentials to be used in the NDINIT macro so that syscalls can
hijack them.
2001-09-08 02:02:04 +00:00
enami 405f874060 extent_alloc_subregion shouldn't allocate a region pasts the end of subregion. 2001-08-27 13:35:44 +00:00
thorpej bbd3d01db5 Artur Grabowski's simple brute-force malloc debugger, which uses
guard pages.  Can only debug one malloc type at a time, and nothing
larger than 1 page.  But can be useful for debugging certain types
of "data modified on freelist" type problems.

Modified from code in OpenBSD.
2001-08-17 00:48:29 +00:00
chs e9fbc91f95 user maps are always pageable. 2001-08-16 01:37:50 +00:00
enami 256a367268 Give different names for different wait channels.
# and minor knf fix while I'm here.
2001-08-05 08:25:39 +00:00
jdolecek 332bb4894a bound check mount args more thoroughly 2001-08-03 06:00:13 +00:00
jdolecek c650c8d91c make local 'nsops' same unsigned type as the value we store there in sys_semop() 2001-08-03 05:58:18 +00:00
christos f2a8a907b4 simplify an expression. 2001-07-29 21:24:23 +00:00
christos 3e1e7a68e5 adjust to the new copyargs footprint 2001-07-29 21:22:58 +00:00
christos e2b51c04af - make copyargs function return the reason it failed and pass a pointer to
the stack, so that it can be modified.
- pass the error code in the exit code in addition to aborting.
- kill the second exit1() call; it does not make any sense.
2001-07-29 21:22:42 +00:00
thorpej 9e74a14e1f Add a sysctl to frob sb_max. 2001-07-27 21:19:09 +00:00
thorpej 59612894e1 Now that M_TRAILINGSPACE() checks buffer writeability properly,
we can greatly simplify sbcompress().  Slightly modified from
a similar change in FreeBSD.
2001-07-27 19:27:49 +00:00
thorpej fcc2e4e5f6 Use pool_cache_*() for mbufs and clusters. While we don't use the
ctor/dtor feature, it's still faster to allocate from the cache groups
than it is from the pool (cache groups are analogous to "magazines"
in the Solaris SLAB allocator).
2001-07-26 19:05:04 +00:00
jdolecek 875b784599 pipe_create(): explicitly zero whole memory returned from pool_get(), instead
of some selective pieces. This fixes problem with NEW_PIPE in kernels
with DEBUG option, reported via e-mail by Chuck Silvers.

sys_pipe(): g/c fdp, provide it at the chunk of FreeBSD code where it's used
2001-07-26 14:14:28 +00:00
wiz f1bde32520 s/necesary/necessary/ 2001-07-24 16:43:02 +00:00
assar bec71dc090 change vop_symlink and vop_mknod to return vpp (the created node)
refed, so that the caller can actually use it.  update callers and
file systems that implement these vnode operations
2001-07-24 15:39:30 +00:00
wiz a9356936b4 seperate -> separate 2001-07-22 13:33:58 +00:00
thorpej f20822333e Add `WALLSIG' which causes wait4(2) to wait for all processes, regardless
of exit signal.  Add Linux-compatible aliases __WCLONE (for WALTSIG) and
__WALL (for WALLSIG), for compatibility with the Linux clone(2) API.
2001-07-18 19:10:26 +00:00
thorpej 1071f796f4 bcopy -> memcpy 2001-07-18 06:51:38 +00:00
thorpej f2f13262df bzero -> memset 2001-07-18 06:48:27 +00:00
thorpej 33d6023447 Unshare signal actions on exec.
From Matthew Orgass <darkstar@pgh.net>.
2001-07-18 05:34:58 +00:00
thorpej 35c5abaeff Unshare the file descriptor table and `cwdinfo' when we exec.
From Matthew Orgass <darkstar@pgh.net>.
2001-07-18 05:34:37 +00:00
matt 7fa8aeac6c When we auto size the vnode cache, make sure we do it *before* we
init vfs so it can the size into account when creating its hash lists.
This means that for a 2GB system, it'll have a default of 65536 buckets
instead of 2048 and when you have 200,000+ vnodes that makes a significant
difference.
2001-07-18 00:51:54 +00:00
jdolecek f9f0d49b94 comment police 2001-07-17 18:21:59 +00:00
jdolecek db3510e6f8 fix bogus uio->uio_offset check introduced in rev. 1.5, which effectively
disabled loans for writes (a.k.a "direct write"), oops; use uio->uio_resid
for the check instead

don't bother updating uio->uio_offset in pipe_direct_write(), it's not used
by upper layers anyway
2001-07-17 18:18:52 +00:00
jdolecek 588b94c0a2 Expel MSG_COMPAT/COMPAT_OLDSOCK, make the COMPAT_43 wrappers
arrange things as needed.  Unfortunately, the check in sockargs()
have to stay, since 4.3BSD bind(2), connect(2) and sendto(2) were
not versioned at the time :(

This code was tested to pass regression tests.
2001-07-17 11:49:40 +00:00