freebsd-nq/sys
Brian Feldman 4362fada8f Reimplement contigmalloc(9) with an algorithm which stands a greatly-
improved chance of working despite pressure from running programs.
Instead of trying to throw a bunch of pages out to swap and hope for
the best, only a range that can potentially fulfill contigmalloc(9)'s
request will have its contents paged out (potentially, not forcibly)
at a time.

The new contigmalloc operation still operates in three passes, but it
could potentially be tuned to more or less.  The first pass only looks
at pages in the cache and free pages, so they would be thrown out
without having to block.  If this is not enough, the subsequent passes
page out any unwired memory.  To combat memory pressure refragmenting
the section of memory being laundered, each page is removed from the
systems' free memory queue once it has been freed so that blocking
later doesn't cause the memory laundered so far to get reallocated.

The page-out operations are now blocking, as it would make little sense
to try to push out a page, then get its status immediately afterward
to remove it from the available free pages queue, if it's unlikely to
have been freed.  Another change is that if KVA allocation fails, the
allocated memory segment will be freed and not leaked.

There is a sysctl/tunable, defaulting to on, which causes the old
contigmalloc() algorithm to be used.  Nonetheless, I have been using
vm.old_contigmalloc=0 for over a month.  It is safe to switch at
run-time to see the difference it makes.

A new interface has been used which does not require mapping the
allocated pages into KVA: vm_page.h functions vm_page_alloc_contig()
and vm_page_release_contig().  These are what vm.old_contigmalloc=0
uses internally, so the sysctl/tunable does not affect their operation.

When using the contigmalloc(9) and contigfree(9) interfaces, memory
is now tracked with malloc(9) stats.  Several functions have been
exported from kern_malloc.c to allow other subsystems to use these
statistics, as well.  This invalidates the BUGS section of the
contigmalloc(9) manpage.
2004-07-19 06:21:27 +00:00
..
alpha In -CURRENT pseudo devices are not statically assigned at compile time, 2004-07-18 09:03:12 +00:00
amd64 Enable ADAPTIVE_MUTEXES by default by changing the sense of the option to 2004-07-18 15:59:03 +00:00
arm In pmap_remove_pages(), when the pv_list is entry, we want to clean the 2004-07-13 22:40:59 +00:00
boot Rename snd_pcm as sound. 2004-07-16 07:24:20 +00:00
cam Quirk for SEGRAND NP-900 USB MP3Player 2004-07-18 05:39:14 +00:00
coda Do a pass over all modules in the kernel and make them return EOPNOTSUPP 2004-07-15 08:26:07 +00:00
compat I missed two pieces of the commit to this file. Robert has already 2004-07-18 09:26:34 +00:00
conf Unbreak kernel compiles by preserving an old opt_adaptive_mutexes.h file 2004-07-18 18:21:39 +00:00
contrib Fix a stupid attemp to apply host arithmetics to network byte ordered data. 2004-07-18 14:25:48 +00:00
crypto Use __FBSDID(). 2004-06-14 00:38:54 +00:00
ddb Re-add the gdb command. It was removed to be replaced by something 2004-07-12 01:38:07 +00:00
dev Start the entropy device insecure/unblocked. I'll be handing over 2004-07-18 09:07:58 +00:00
doc Experimental support for using doxygen to generate kernel documentation. 2004-07-11 16:13:57 +00:00
fs Do a pass over all modules in the kernel and make them return EOPNOTSUPP 2004-07-15 08:26:07 +00:00
gdb Introduce the GDB debugger backend for the new KDB framework. The 2004-07-10 17:47:22 +00:00
geom Fix copy&paste bug. 2004-07-18 16:51:58 +00:00
gnu Make VFS_ROOT() and vflush() take a thread argument. 2004-07-12 08:14:09 +00:00
i4b Fix a possible hang which apparently occurs during a warm boot (cold boot 2004-07-18 20:13:31 +00:00
i386 Add a #error requiring KDB if DDB is specified. (This can probably be 2004-07-19 02:46:34 +00:00
ia64 Add partial pmap locking. 2004-07-19 05:39:49 +00:00
isa Ignore more strange return values of the test_aux_port() function, 2004-07-16 22:04:29 +00:00
isofs/cd9660 Make VFS_ROOT() and vflush() take a thread argument. 2004-07-12 08:14:09 +00:00
kern Reimplement contigmalloc(9) with an algorithm which stands a greatly- 2004-07-19 06:21:27 +00:00
libkern Copy qsort_r(3) from libc to libkern. 2004-07-15 23:58:23 +00:00
modules Fix the alpha (and others) module build by only building fdc_acpi.c on 2004-07-16 18:37:00 +00:00
net Comment clarifying debug_mpsafenet. 2004-07-18 21:50:22 +00:00
net80211 Link ALTQ to the build and break with ABI for struct ifnet. Please recompile 2004-06-13 17:29:10 +00:00
netatalk Procotol control block locking for netatalk DDP. 2004-07-12 18:39:59 +00:00
netatm The socket field so_state is used to hold a variety of socket related 2004-06-14 18:16:22 +00:00
netgraph Reverse a lock/unlock pair that were the wrong way around in some code that 2004-07-18 22:57:46 +00:00
netinet Fix the !INET6 build. 2004-07-17 21:40:14 +00:00
netinet6 Do a pass over all modules in the kernel and make them return EOPNOTSUPP 2004-07-15 08:26:07 +00:00
netipsec Add required includes for post-sorwakeup() change to fix FAST_IPSEC 2004-06-23 01:58:22 +00:00
netipx Constify 'spx_backoff'. 2004-07-12 19:35:29 +00:00
netkey Merge next step in socket buffer locking: 2004-06-21 00:20:43 +00:00
netnatm Constify send and receive space constants in natm. 2004-06-24 03:11:29 +00:00
netncp Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
netsmb Merge additional socket buffer locking from rwatson_netperf: 2004-06-17 22:48:11 +00:00
nfs Remove advertising clause from University of California Regent's 2004-04-07 05:00:01 +00:00
nfs4client Make VFS_ROOT() and vflush() take a thread argument. 2004-07-12 08:14:09 +00:00
nfsclient Turn off SO_REUSEADDR and SO_REUSEPORT, they were causing EADDRINUSE 2004-07-13 05:42:59 +00:00
nfsserver Do a pass over all modules in the kernel and make them return EOPNOTSUPP 2004-07-15 08:26:07 +00:00
opencrypto Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
pc98 In -CURRENT pseudo devices are not statically assigned at compile time, 2004-07-18 09:03:12 +00:00
pccard Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
pci Update for the KDB framework: 2004-07-10 21:47:53 +00:00
posix4
powerpc Empty GENERIC.hints file needed by make release. 2004-07-19 02:08:22 +00:00
rpc fix array index out of bounds in rpc->rc_srtt[], rpc->rc_sdrtt[] 2004-07-15 22:21:25 +00:00
security Rename Biba and MLS _single label elements to _effective, which more 2004-07-16 02:03:50 +00:00
sparc64 In -CURRENT pseudo devices are not statically assigned at compile time, 2004-07-18 09:03:12 +00:00
sys Reimplement contigmalloc(9) with an algorithm which stands a greatly- 2004-07-19 06:21:27 +00:00
tools Pass doxygen doc comments through to the output. 2004-07-11 16:14:24 +00:00
ufs Make sure to update the mnt_stats before UFS1 extattr tried to 2004-07-14 14:19:32 +00:00
vm Reimplement contigmalloc(9) with an algorithm which stands a greatly- 2004-07-19 06:21:27 +00:00
Makefile Try harder not to compile anything in sys/boot for arm. 2004-05-16 00:19:12 +00:00