freebsd-skq/sys/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
..
_iovec.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
_label.h Improve consistency of include file guards in src/sys/sys by terminating 2004-05-10 18:38:07 +00:00
_lock.h Include <sys/_lock.h>'s prerequisite <sys/queue.h> before including the 2004-06-19 14:58:35 +00:00
_mutex.h Add some basic support for measuring sleep mutex contention to the 2004-01-25 01:59:27 +00:00
_null.h Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror) 2004-03-05 08:10:19 +00:00
_semaphore.h The sem_timedwait() and ksem_timedwait() functions both 2004-02-03 22:27:03 +00:00
_sigset.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
_task.h Defer the vrele() on a jail's root vnode reference from prison_free() 2004-01-23 20:44:26 +00:00
_timespec.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
_timeval.h
_types.h Define __lwpid_t as an int32_t in <sys/_types.h> and define lwpid_t 2004-06-19 17:58:32 +00:00
aac_ioctl.h Do some small cleanups to comments and remove AACQ_COMPLETE definitions since 2004-02-07 17:40:38 +00:00
acct.h Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
acl.h Improve consistency of include file guards in src/sys/sys by terminating 2004-05-10 18:38:07 +00:00
agpio.h Add simple support for AGP 3.0 including enabling 8x mode. The simple 2003-10-23 18:08:56 +00:00
aio.h
alq.h Add an explicit credential argument to alq_open() to allow the caller to 2003-06-22 22:28:56 +00:00
assym.h These are changes to allow to use the Intel C/C++ compiler (lang/icc) 2004-03-12 21:45:33 +00:00
ata.h Whitespace cleanup 2004-05-20 15:09:41 +00:00
bio.h Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
bitstring.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
blist.h Move the definitions of SWAPBLK_NONE and SWAPBLK_MASK from vm_page.h to 2004-06-04 04:03:26 +00:00
buf.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
bus_dma.h Document the lockfunc and lockfuncarg arguments to bus_dma_tag_create() in 2003-11-07 23:29:42 +00:00
bus.h Add doxygen doc comments for most of newbus and the BUS interface. 2004-07-18 16:30:31 +00:00
callout.h 1. Remove callout_stop binary compatibility. 2004-04-20 15:49:31 +00:00
cdefs.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
cdio.h Remove no longer existant CDIOCREADAUDIO ioctl. 2003-10-20 09:29:40 +00:00
cdrio.h
chio.h Use symbolic constants instead of "4". 2003-05-31 16:54:37 +00:00
clist.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
clock.h
condvar.h Name the pri argument to cv_broadcastpri() to match the existing style of 2004-05-05 21:57:44 +00:00
conf.h Remove the last bits of SPECHASH. 2004-07-11 23:03:37 +00:00
cons.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
consio.h
copyright.h Happy 2004! 2003-12-31 22:27:51 +00:00
ctype.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
dataacq.h
device_port.h
devicestat.h Add an XXX comment with a TODO item for next time we run a revision 2003-05-31 21:10:01 +00:00
digiio.h
dir.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
dirent.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
disk.h
disklabel.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
diskmbr.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
diskpc98.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
dkstat.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
domain.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
dvdio.h
elf32.h
elf64.h
elf_common.h Fix typo (in comment): s/IA-46/IA-64/ 2004-05-05 02:38:54 +00:00
elf_generic.h
endian.h Quiet warnings about mis-matched pointer assignment. 2003-10-15 20:05:57 +00:00
errno.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
eui64.h Add support for an /etc/eui64 file modeled on /etc/ethers. The API is 2004-05-26 22:58:06 +00:00
event.h do { } while(0) KNOTE macro, whitespace 2004-07-14 06:47:32 +00:00
eventhandler.h Make the process_exit eventhandler run without Giant. Add Giant hooks 2004-03-14 02:06:28 +00:00
eventvar.h Make FIOASYNC, FIOSETOWN and FIOGETOWN work on kqueues. 2004-07-14 07:02:03 +00:00
exec.h Do a pass over all modules in the kernel and make them return EOPNOTSUPP 2004-07-15 08:26:07 +00:00
extattr.h Userspace prototypes for the extattr_list_*() system calls. 2003-06-04 04:04:24 +00:00
fbio.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
fcntl.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
fdcio.h
file.h Add the f_vnode pointer to struct xfile, shortly it will no longer be 2004-06-19 11:38:00 +00:00
filedesc.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
filio.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
fnv_hash.h
gmon.h Add prototypes for the userland gmon support functions, which normally 2004-06-14 18:39:28 +00:00
gpt.h
iconv.h Make msdosfs long filenames matching case insensitive again. 2003-12-08 08:32:20 +00:00
imgact_aout.h Adjust the system endian and a.out headers to be more MI and cross-building 2004-06-22 17:05:39 +00:00
imgact_elf.h Add an additional field to the elf brandinfo structure to support 2003-12-23 02:42:39 +00:00
imgact.h Fixed some style bugs (useless forward declarations of structs and 2004-04-24 06:44:33 +00:00
inflate.h
interrupt.h Implement preemption of kernel threads natively in the scheduler rather 2004-07-02 20:21:44 +00:00
ioccom.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
ioctl_compat.h Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES. 2004-06-21 22:57:16 +00:00
ioctl.h Deorbit COMPAT_SUNOS. 2004-06-11 11:16:26 +00:00
ipc.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
jail.h Give jail(8) the feature to allow raw sockets from within a 2004-04-26 19:46:52 +00:00
joystick.h
jumbo.h
kbio.h
kdb.h Make kdb_dbbe_select() available as an interface function. This allows 2004-07-12 01:15:55 +00:00
kenv.h
kernel.h Remove nested include of <sys/module.h> 2004-06-18 08:54:49 +00:00
kerneldump.h
kobj.h * Add multiple inheritance to kobj. Each class can have zero or more base 2003-10-16 09:16:28 +00:00
kse.h Add code to support debugging threaded process. 2004-07-13 07:20:10 +00:00
kthread.h
ktr.h
ktrace.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
libkern.h Copy qsort_r(3) from libc to libkern. 2004-07-15 23:58:23 +00:00
limits.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
linedisc.h Fix line discipline switching issues: If opening a new ldisc fails, 2004-06-26 08:44:04 +00:00
link_aout.h
link_elf.h
linker_set.h These are changes to allow to use the Intel C/C++ compiler (lang/icc) 2004-03-12 21:45:33 +00:00
linker.h Give kldunload a -f(orce) argument. 2004-07-13 19:36:59 +00:00
lock.h Rework witness_lock() to make it slightly more useful and flexible. 2004-01-28 20:39:57 +00:00
lockf.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
lockmgr.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
mac_policy.h Introduce a temporary mutex, mac_ifnet_mtx, to lock MAC labels on 2004-06-24 03:34:46 +00:00
mac.h Do the dreaded s/dev_t/struct cdev */ 2004-06-16 09:47:26 +00:00
malloc.h Reimplement contigmalloc(9) with an algorithm which stands a greatly- 2004-07-19 06:21:27 +00:00
mbpool.h Add a facility for devices, specifically network interfaces, that require 2003-07-15 08:59:38 +00:00
mbuf.h Define semantic of M_SKIP_FIREWALL more precisely, i.e. also pass associated 2004-07-17 05:10:06 +00:00
mchain.h
md4.h
md5.h
mdioctl.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
memrange.h
mman.h Remove mlockall() and munlockall() from the list of unimplemented 2004-04-27 13:13:20 +00:00
module.h Give kldunload a -f(orce) argument. 2004-07-13 19:36:59 +00:00
mount.h Fix macro so that we don't get missing initializer warnings. 2004-07-17 23:56:24 +00:00
mouse.h
msg.h
msgbuf.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
mtio.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
mutex.h Include an annotation of NET_{LOCK,UNLOCK}_GIANT() noting that these 2004-06-20 21:49:12 +00:00
namei.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
nlist_aout.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
param.h Bump __FreeBSD_version for VFS_ROOT, vflush and kinfo_proc changes. 2004-07-12 08:23:10 +00:00
pciio.h
pcpu.h Change the type of the various CPU masks to cpumask_t. Note that as 2004-03-27 18:21:24 +00:00
pioctl.h
pipe.h Revise the direct or optimized case to use uiomove_fromphys() by the reader 2004-03-27 19:50:23 +00:00
poll.h
posix4.h
power.h
priority.h
proc.h - Move TDF_OWEPREEMPT, TDF_OWEUPC, and TDF_USTATCLOCK over to td_pflags 2004-07-16 21:04:55 +00:00
procfs.h type prgregset_t really should be an array. this is odd, however, other 2004-07-15 03:52:17 +00:00
protosw.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
ptio.h
ptrace.h Implement following commands: PT_CLEARSTEP, PT_SETSTEP, PT_SUSPEND 2004-07-13 07:25:24 +00:00
queue.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
random.h
reboot.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
regression.h Improve consistency of include file guards in src/sys/sys by terminating 2004-05-10 18:38:07 +00:00
resource.h Make this header a little bit more XSI-compliant: 2004-06-13 22:07:58 +00:00
resourcevar.h Change named parameters from max (which conflicts with a macro in libkern.h) 2004-07-17 23:53:37 +00:00
rman.h Soften __RMAN_RESOURCE_VISIBLE a little: expose rman and the 2004-07-01 16:20:58 +00:00
rtprio.h
runq.h
sbuf.h Have sbuf_bcat() and sbuf_bcpy() take a const void * instead of a 2004-07-09 11:35:30 +00:00
sched.h When calling scheduler entrypoints for creating new threads and processes, 2004-07-18 23:36:13 +00:00
select.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
selinfo.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
sem.h s/u_short/unsigned short/ to make this compile if _POSIX_C_SOURCE=200112 2003-06-02 17:23:37 +00:00
sema.h
semaphore.h The sem_timedwait() and ksem_timedwait() functions both 2004-02-03 22:27:03 +00:00
serial.h Make the relationship between modem control bits and their delta cousins 2004-06-25 10:56:43 +00:00
sf_buf.h In some cases, sf_buf_alloc() should sleep with pri PCATCH; in others, it 2004-04-03 09:16:27 +00:00
shm.h
sigio.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
signal.h Make this look less dubious :-) 2004-06-11 11:43:46 +00:00
signalvar.h Add code to support debugging threaded process. 2004-07-13 07:20:10 +00:00
sleepqueue.h Remove the signal_caught argument from sleepq_timedwait() as it was 2004-06-28 18:57:06 +00:00
smp.h Change the type of the various CPU masks to cpumask_t. Note that as 2004-03-27 18:21:24 +00:00
snoop.h Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
socket.h According to POSIX sys/socket.h must define CMSG_NXTHDR but most not 2004-07-16 17:42:48 +00:00
socketvar.h Rename Alfred's kern_setsockopt to so_setsockopt, as this seems a 2004-07-12 21:42:33 +00:00
sockio.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
soundcard.h New defines that paves the way for new midi features and ports. 2003-11-22 03:27:09 +00:00
stat.h Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
statvfs.h
stddef.h Change the definition of NULL on ia64 (for LP64 compilations) from 2003-12-07 21:10:06 +00:00
stdint.h
sun_disklabel.h Add SVR4-compatible VTOC-style elements to the Sun label. The 2004-06-01 20:18:25 +00:00
sx.h Add sx_unlock() macro as a frontend to both sx_sunlock() and sx_xunlock(), 2004-07-11 16:07:07 +00:00
syscall.h Give kldunload a -f(orce) argument. 2004-07-13 19:36:59 +00:00
syscall.mk Give kldunload a -f(orce) argument. 2004-07-13 19:36:59 +00:00
syscallsubr.h Add a kern_setsockopt and kern_getsockopt which can read the option 2004-07-17 21:06:36 +00:00
sysctl.h Define a KERN_PROC_GID option for kvm_getprocs(). 2004-06-19 13:42:05 +00:00
sysent.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
syslimits.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
syslog.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
sysproto.h Give kldunload a -f(orce) argument. 2004-07-13 19:36:59 +00:00
systm.h Add a SUSER_RUID flag to suser_cred. This flag indicates that we want to 2004-07-16 15:57:16 +00:00
taskqueue.h Defer the vrele() on a jail's root vnode reference from prison_free() 2004-01-23 20:44:26 +00:00
termios.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
thr.h Change the thread ID (thr_id_t) used for 1:1 threading from being a 2004-07-02 00:40:07 +00:00
tiio.h
time.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
timeb.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
timepps.h Long overdue comment claification: RFC 2783 was approved long time ago. 2003-11-23 18:52:23 +00:00
timers.h
times.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
timespec.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
timetc.h Give timecounters a numeric quality field. 2003-08-16 08:23:53 +00:00
timex.h
tree.h Synch with NetBSD: avoid "unused parameter" warning. 2004-03-29 11:18:25 +00:00
tty.h Preparation commit for the tty cleanups that will follow in the near 2004-07-15 20:47:41 +00:00
ttychars.h Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES. 2004-06-21 22:57:16 +00:00
ttycom.h Retire the TIOC_REMOTE ioctl. 2004-06-25 21:54:49 +00:00
ttydefaults.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
ttydev.h Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES. 2004-06-21 22:57:16 +00:00
turnstile.h Sort function prototypes. 2004-04-06 19:08:40 +00:00
types.h Define __lwpid_t as an int32_t in <sys/_types.h> and define lwpid_t 2004-06-19 17:58:32 +00:00
ucontext.h Change the clear_ret argument of get_mcontext() to be a flags argument. 2003-11-09 20:31:04 +00:00
ucred.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
uio.h Clean up and wash struct iovec and struct uio handling. 2004-07-10 15:42:16 +00:00
umtx.h Change the thread ID (thr_id_t) used for 1:1 threading from being a 2004-07-02 00:40:07 +00:00
un.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
unistd.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
unpcb.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
user.h Reserve a pointer "ki_udata" in kinfo_proc as a convenience for userland. 2004-07-12 04:53:33 +00:00
utsname.h Remove advertising clause from University of California Regent's license, 2004-04-07 04:19:52 +00:00
uuid.h Introduce {be,le}_uuid_{enc,dec}() functions for explicitly encoding 2003-05-31 16:47:07 +00:00
vmmeter.h Remove remnants of PGINPROF. 2004-06-08 10:37:30 +00:00
vnode.h Make VFS_ROOT() and vflush() take a thread argument. 2004-07-12 08:14:09 +00:00
wait.h Fixed missing forward declaration of struct rusage in the _KERNEL case. 2004-04-09 13:14:32 +00:00
watchdog.h Add a generic watchdog facility which through a single device entry 2004-02-28 20:06:59 +00:00
xrpuio.h