opnsense-src/sys/powerpc/include
Alan Cox 7bfda801a8 Change the management of cached pages (PQ_CACHE) in two fundamental
ways:

(1) Cached pages are no longer kept in the object's resident page
splay tree and memq.  Instead, they are kept in a separate per-object
splay tree of cached pages.  However, access to this new per-object
splay tree is synchronized by the _free_ page queues lock, not to be
confused with the heavily contended page queues lock.  Consequently, a
cached page can be reclaimed by vm_page_alloc(9) without acquiring the
object's lock or the page queues lock.

This solves a problem independently reported by tegge@ and Isilon.
Specifically, they observed the page daemon consuming a great deal of
CPU time because of pages bouncing back and forth between the cache
queue (PQ_CACHE) and the inactive queue (PQ_INACTIVE).  The source of
this problem turned out to be a deadlock avoidance strategy employed
when selecting a cached page to reclaim in vm_page_select_cache().
However, the root cause was really that reclaiming a cached page
required the acquisition of an object lock while the page queues lock
was already held.  Thus, this change addresses the problem at its
root, by eliminating the need to acquire the object's lock.

Moreover, keeping cached pages in the object's primary splay tree and
memq was, in effect, optimizing for the uncommon case.  Cached pages
are reclaimed far, far more often than they are reactivated.  Instead,
this change makes reclamation cheaper, especially in terms of
synchronization overhead, and reactivation more expensive, because
reactivated pages will have to be reentered into the object's primary
splay tree and memq.

(2) Cached pages are now stored alongside free pages in the physical
memory allocator's buddy queues, increasing the likelihood that large
allocations of contiguous physical memory (i.e., superpages) will
succeed.

Finally, as a result of this change long-standing restrictions on when
and where a cached page can be reclaimed and returned by
vm_page_alloc(9) are eliminated.  Specifically, calls to
vm_page_alloc(9) specifying VM_ALLOC_INTERRUPT can now reclaim and
return a formerly cached page.  Consequently, a call to malloc(9)
specifying M_NOWAIT is less likely to fail.

Discussed with: many over the course of the summer, including jeff@,
   Justin Husted @ Isilon, peter@, tegge@
Tested by: an earlier version by kris@
Approved by: re (kensmith)
2007-09-25 06:25:06 +00:00
..
_bus.h Break out the definition of bus_space_{tag,handle}_t and a few other types 2005-04-18 21:45:34 +00:00
_inttypes.h Since printf(3) now supports the `j' conversion specifier, use that 2002-06-30 05:48:03 +00:00
_limits.h Move MINSIGSTKSZ from <machine/signal.h> to <machine/_limits.h> and rename 2005-08-20 16:44:41 +00:00
_stdint.h <stdint.h> should define WINT_M{AX,IN} independent from whether WCHAR_MIN is 2004-05-18 16:04:57 +00:00
_types.h netchild's mega-patch to isolate compiler dependencies into a central 2005-03-02 21:33:29 +00:00
asm.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
atomic.h Cast the arguments to atomic_*_ptr() when mapping it to atomic_*_32() 2007-07-10 04:40:00 +00:00
bat.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
bootinfo.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
bus.h Implement bus_space_map(). 2006-12-13 03:25:31 +00:00
bus_dma.h Refactor the bus_dma header files so that the interface is described in 2005-03-14 16:46:28 +00:00
clock.h First part of a little cleanup in the calendar/timezone/RTC handling. 2006-10-02 12:59:59 +00:00
cpu.h Add kdb_cpu_sync_icache(), intended to synchronize instruction 2007-06-09 21:55:17 +00:00
cpufunc.h Always isync after a mtmsr. While perhaps not strictly necessary for PSL_EE 2004-08-07 00:20:00 +00:00
db_machdep.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
elf.h PR: 2006-10-04 21:37:10 +00:00
endian.h netchild's mega-patch to isolate compiler dependencies into a central 2005-03-02 21:33:29 +00:00
exec.h Use a common multi-inclusion protection, and add such a 2005-02-19 21:16:48 +00:00
float.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
floatingpoint.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
fpu.h Not all cpus are MPC750s. Replace the MPC750 cpu option with OEA. This 2003-02-05 11:37:59 +00:00
frame.h Tweak how the MD code calls the fooclock() methods some. Instead of 2005-12-22 22:16:09 +00:00
gdb_machdep.h Add skeletal support for GDB. In particular gdb_cpu_getreg() needs 2006-08-24 21:52:11 +00:00
hid.h HID0 updates: 2005-02-04 01:14:38 +00:00
ieee.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
ieeefp.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
in_cksum.h netchild's mega-patch to isolate compiler dependencies into a central 2005-03-02 21:33:29 +00:00
intr.h Remove __P. 2002-03-20 23:17:50 +00:00
intr_machdep.h Revamp the interrupt handling in support of INTR_FILTER. This includes: 2007-08-11 19:25:32 +00:00
kdb.h Add kdb_cpu_sync_icache(), intended to synchronize instruction 2007-06-09 21:55:17 +00:00
limits.h netchild's mega-patch to isolate compiler dependencies into a central 2005-03-02 21:33:29 +00:00
md_var.h Revamp the interrupt handling in support of INTR_FILTER. This includes: 2007-08-11 19:25:32 +00:00
memdev.h Add /dev/mem and /dev/kmem to powerpc. 2004-08-16 13:07:40 +00:00
metadata.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
mmuvar.h Insert a layer of indirection to the pmap code, using a kobj for 2005-11-08 06:48:08 +00:00
mutex.h Modify the critical section API as follows: 2001-12-18 00:27:18 +00:00
nexusvar.h Remove hard-coded knowledge of specific OFW devices. Use bus_generic_probe 2004-01-13 11:20:52 +00:00
ofw_machdep.h o Move the prototype of mem_valid() from ofw_machdep.h to md_var.h. 2006-07-26 17:12:54 +00:00
openpicreg.h Driver for OpenPIC compatible interrupt controllers. 2002-07-09 11:26:10 +00:00
openpicvar.h Revamp the interrupt handling in support of INTR_FILTER. This includes: 2007-08-11 19:25:32 +00:00
param.h Drop _MACHINE_ARCH and _MACHINE defines (not to be confused with 2005-12-06 13:27:21 +00:00
pcb.h Forward declare struct trapframe. 2006-07-26 17:05:11 +00:00
pcpu.h Rework the PCPU_* (MD) interface: 2007-06-04 21:38:48 +00:00
pio.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
pmap.h Fix gdb issue where the i-cache was not being updated when a breakpoint 2006-12-05 04:01:52 +00:00
pmc_mdep.h MFP4: 2005-06-09 19:45:09 +00:00
powerpc.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
proc.h Divorce critical sections from spinlocks. Critical sections as denoted by 2005-04-04 21:53:56 +00:00
profile.h Add user-space profiling support. Kernel profiling still todo. 2005-12-29 04:07:36 +00:00
psl.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
pte.h Add definitions for 64-bit PTEs 2005-11-11 12:03:28 +00:00
ptrace.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
reg.h Add comment explaining struct reg and struct fpreg must match the trapframe. 2004-07-29 13:39:27 +00:00
reloc.h Remove 3rd clause, renumber, ok per email 2007-01-12 07:26:21 +00:00
resource.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
runq.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
sc_machdep.h A syscons implementation using the 8-bit framebuffer set up by 2004-01-21 05:16:23 +00:00
setjmp.h Fix namespace issues by using visibility conditionals from 2002-10-05 05:47:56 +00:00
sf_buf.h MFamd64 2004-04-18 08:10:04 +00:00
sigframe.h Removed osigframe. No need for COMPAT_43 signal bin-compat in PPC. 2002-09-19 04:46:36 +00:00
signal.h Move MINSIGSTKSZ from <machine/signal.h> to <machine/_limits.h> and rename 2005-08-20 16:44:41 +00:00
smp.h This commit (along with one pending in sys/dev/ofw and one in sys/conf) give 2001-06-16 07:14:07 +00:00
spr.h - add definitions for MPC7447A/7448 (i.e. miniMac) 2005-02-04 01:17:04 +00:00
sr.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
stdarg.h Use __builtin_va_start instead of __builtin_stdarg_start. GCC4 obsoletes 2006-09-21 01:37:02 +00:00
trap.h Add prototype for trap(). 2007-08-07 18:39:28 +00:00
ucontext.h /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
varargs.h netchild's mega-patch to isolate compiler dependencies into a central 2005-03-02 21:33:29 +00:00
vmparam.h Change the management of cached pages (PQ_CACHE) in two fundamental 2007-09-25 06:25:06 +00:00