freebsd-dev/sys
Matthew Dillon 936524aa02 Implement a low-memory deadlock solution.
Removed most of the hacks that were trying to deal with low-memory
    situations prior to now.

    The new code is based on the concept that I/O must be able to function in
    a low memory situation.  All major modules related to I/O (except
    networking) have been adjusted to allow allocation out of the system
    reserve memory pool.  These modules now detect a low memory situation but
    rather then block they instead continue to operate, then return resources
    to the memory pool instead of cache them or leave them wired.

    Code has been added to stall in a low-memory situation prior to a vnode
    being locked.

    Thus situations where a process blocks in a low-memory condition while
    holding a locked vnode have been reduced to near nothing.  Not only will
    I/O continue to operate, but many prior deadlock conditions simply no
    longer exist.

Implement a number of VFS/BIO fixes

	(found by Ian): in biodone(), bogus-page replacement code, the loop
        was not properly incrementing loop variables prior to a continue
        statement.  We do not believe this code can be hit anyway but we
        aren't taking any chances.  We'll turn the whole section into a
        panic (as it already is in brelse()) after the release is rolled.

	In biodone(), the foff calculation was incorrectly
        clamped to the iosize, causing the wrong foff to be calculated
        for pages in the case of an I/O error or biodone() called without
        initiating I/O.  The problem always caused a panic before.  Now it
        doesn't.  The problem is mainly an issue with NFS.

	Fixed casts for ~PAGE_MASK.  This code worked properly before only
        because the calculations use signed arithmatic.  Better to properly
        extend PAGE_MASK first before inverting it for the 64 bit masking
        op.

	In brelse(), the bogus_page fixup code was improperly throwing
        away the original contents of 'm' when it did the j-loop to
        fix the bogus pages.  The result was that it would potentially
        invalidate parts of the *WRONG* page(!), leading to corruption.

	There may still be cases where a background bitmap write is
        being duplicated, causing potential corruption.  We have identified
        a potentially serious bug related to this but the fix is still TBD.
        So instead this patch contains a KASSERT to detect the problem
  	and panic the machine rather then continue to corrupt the filesystem.
	The problem does not occur very often..  it is very hard to
	reproduce, and it may or may not be the cause of the corruption
	people have reported.

Review by: (VFS/BIO: mckusick, Ian Dowse <iedowse@maths.tcd.ie>)
Testing by: (VM/Deadlock) Paul Saab <ps@yahoo-inc.com>
2000-11-18 23:06:26 +00:00
..
alpha - Split the run queue and sleep queue linkage, so that a process 2000-11-17 18:09:18 +00:00
amd64 - Split the run queue and sleep queue linkage, so that a process 2000-11-17 18:09:18 +00:00
boot mdoc(7) police: use certified section headers wherever possible. 2000-11-17 11:44:16 +00:00
cam Add special quirk for this ancient Viper drive. This is all creeping 2000-11-08 18:37:12 +00:00
coda Give vop_mmap an untimely death. The opportunity to give it a timely 2000-11-01 17:57:24 +00:00
compat Use the linux_connect() on alpha rather than passing directly through 2000-11-16 01:05:53 +00:00
compile
conf Fix the `make -jX' (X>1) breakage. 2000-11-17 21:25:15 +00:00
contrib/dev We should include <machine/stdarg.h> not <stdarg.h> 2000-10-28 08:32:43 +00:00
crypto Initial import of AES algorithm code (aka Rijndael) from KAME. 2000-10-30 11:03:32 +00:00
ddb
dev Further use of M_ZERO. 2000-11-18 15:21:22 +00:00
fs Use vop_defaultop() instead of ntfs_bypass(). 2000-11-18 02:47:12 +00:00
geom
gnu Quick fix for not writing group descriptor group, inode bitmaps or 2000-11-10 14:54:15 +00:00
i4b Fix i4b netgraph interface to not kernel panic at boot time 2000-11-09 12:27:31 +00:00
i386 - Split the run queue and sleep queue linkage, so that a process 2000-11-17 18:09:18 +00:00
ia64 - Split the run queue and sleep queue linkage, so that a process 2000-11-17 18:09:18 +00:00
isa Ignore resources with a size of 0, as these are disabled (and we don't 2000-11-07 00:03:33 +00:00
isofs/cd9660 Weaken a bogus dependency on <sys/proc.h> in <sys/buf.h> by #ifdef'ing 2000-10-29 14:54:55 +00:00
kern Implement a low-memory deadlock solution. 2000-11-18 23:06:26 +00:00
libkern Fix compilation of profiled kernels by including <machine/lock.h> 2000-10-14 08:34:27 +00:00
miscfs More paranoia against overflows 2000-11-08 21:53:05 +00:00
modules New netgraph node type ng_one2many(4). 2000-11-16 05:58:33 +00:00
msdosfs Weaken a bogus dependency on <sys/proc.h> in <sys/buf.h> by #ifdef'ing 2000-10-29 14:54:55 +00:00
net Make compilable. if_fddisubr.c depended on sys/malloc.h by my 2000-11-04 14:21:23 +00:00
netatalk Move suser() and suser_xxx() prototypes and a related #define from 2000-10-29 16:06:56 +00:00
netatm Add back some #include <sys/systm.h> which were needed when <sys/ktr.h> 2000-10-30 20:37:01 +00:00
netgraph Add the use of M_ZERO to netgraph. 2000-11-18 15:17:43 +00:00
netinet While I'm here, get rid of (now useless) MCLISREFERENCED and use MEXT_IS_REF 2000-11-11 23:05:59 +00:00
netinet6 Change check from mbuf->m_ext.ext_free to use the new ext_type in order 2000-11-11 23:07:38 +00:00
netipx Move suser() and suser_xxx() prototypes and a related #define from 2000-10-29 16:06:56 +00:00
netkey Revert previous commit after discussion with phk. 2000-10-30 09:13:46 +00:00
netnatm
netncp Make malloc use M_ZERO in some more locations. 2000-10-29 16:14:28 +00:00
netns
nfs This patchset fixes a large number of file descriptor race conditions. 2000-11-18 21:01:04 +00:00
nfsclient This patchset fixes a large number of file descriptor race conditions. 2000-11-18 21:01:04 +00:00
nfsserver This patchset fixes a large number of file descriptor race conditions. 2000-11-18 21:01:04 +00:00
ntfs Use vop_defaultop() instead of ntfs_bypass(). 2000-11-18 02:47:12 +00:00
nwfs v_interlock is a mutex now, not simple lock. 2000-11-04 02:42:11 +00:00
pc98 Merged from the following changes. 2000-11-05 14:31:19 +00:00
pccard fix type check in pccard_beep_select 2000-11-01 00:37:34 +00:00
pci When checking the device code in the probe routine, leave the chip in 2000-11-16 19:56:09 +00:00
posix4
powerpc Add the 'witness_spin_check' per-CPU variable. 2000-11-15 21:58:02 +00:00
rpc
svr4 This patchset fixes a large number of file descriptor race conditions. 2000-11-18 21:01:04 +00:00
sys Implement a low-memory deadlock solution. 2000-11-18 23:06:26 +00:00
tools
ufs Implement a low-memory deadlock solution. 2000-11-18 23:06:26 +00:00
vm Implement a low-memory deadlock solution. 2000-11-18 23:06:26 +00:00
Makefile