freebsd-dev/sys/vm
Matthew Dillon 389d2b6e21 Fix a refcount race with the vmspace structure. In order to prevent
resource starvation we clean-up as much of the vmspace structure as we
can when the last process using it exits.  The rest of the structure
is cleaned up when it is reaped.  But since exit1() decrements the ref
count it is possible for a double-free to occur if someone else, such as
the process swapout code, references and then dereferences the structure.
Additionally, the final cleanup of the structure should not occur until
the last process referencing it is reaped.

This commit solves the problem by introducing a secondary reference count,
calling 'vm_exitingcnt'.  The normal reference count is decremented on exit
and vm_exitingcnt is incremented.  vm_exitingcnt is decremented when the
process is reaped.  When both vm_exitingcnt and vm_refcnt are 0, the
structure is freed for real.

MFC after:	3 weeks
2002-12-15 18:50:04 +00:00
..
default_pager.c Remove references to vm_zone.h and switch over to the new uma API. 2002-03-20 04:02:59 +00:00
device_pager.c o Lock accesses to the page queues. 2002-07-12 02:55:55 +00:00
phys_pager.c o Retire vm_page_zero_fill() and vm_page_zero_fill_area(). Ever since 2002-08-25 00:22:31 +00:00
pmap.h Move pmap_collect() out of the machine-dependent code, rename it 2002-11-13 05:39:58 +00:00
swap_pager.c Remove vm_page_protect(). Instead, use pmap_page_protect() directly. 2002-11-18 04:05:22 +00:00
swap_pager.h Use `struct uma_zone *' instead of uma_zone_t, so that <sys/uma.h> isn't 2002-09-05 14:04:34 +00:00
uma_core.c - Wakeup the correct address when a zone is no longer full. 2002-11-18 08:27:14 +00:00
uma_dbg.c atomic_set_8 isn't MI. Instead, follow Jake's suggestions about 2002-11-11 11:50:03 +00:00
uma_dbg.h - Use my freebsd email alias in the copyright. 2002-09-19 06:05:32 +00:00
uma_int.h - Add support for machine dependant page allocation routines. MD code 2002-11-01 01:01:27 +00:00
uma.h Fix typo in comments (misspelled "necessary"). 2002-10-22 12:10:27 +00:00
vm_contig.c o Extend the scope of the page queues lock in contigmalloc1(). 2002-08-04 07:07:34 +00:00
vm_extern.h o Merge vm_fault_wire() and vm_fault_user_wire() by adding a new parameter, 2002-07-24 19:47:56 +00:00
vm_fault.c Now that pmap_remove_all() is exported by our pmap implementations 2002-11-16 07:44:25 +00:00
vm_glue.c - Check that a process isn't a new process (p_state == PRS_NEW) before 2002-10-22 14:31:32 +00:00
vm_init.c Move the definitions of the hw.physmem, hw.usermem and hw.availpages 2002-11-07 23:57:17 +00:00
vm_kern.c o Retire vm_page_zero_fill() and vm_page_zero_fill_area(). Ever since 2002-08-25 00:22:31 +00:00
vm_kern.h o Make contigmalloc1() static. 2002-05-22 01:01:37 +00:00
vm_map.c Fix a refcount race with the vmspace structure. In order to prevent 2002-12-15 18:50:04 +00:00
vm_map.h Fix a refcount race with the vmspace structure. In order to prevent 2002-12-15 18:50:04 +00:00
vm_meter.c Rename the mutex thread and process states to use a more generic 'LOCK' 2002-10-02 20:31:47 +00:00
vm_mmap.c Lock page field accesses in mincore(). 2002-11-28 08:01:39 +00:00
vm_object.c As per the comments, vm_object_page_remove() now expects its caller to lock 2002-12-15 07:30:51 +00:00
vm_object.h Remove dead code that hasn't been needed since the demise of share maps 2002-11-13 19:50:06 +00:00
vm_page.c Assert that the page queues lock is held in vm_page_unhold(), 2002-12-15 00:06:02 +00:00
vm_page.h Remove vm_page_protect(). Instead, use pmap_page_protect() directly. 2002-11-18 04:05:22 +00:00
vm_pageout.c Hold the page queues lock when calling pmap_protect(); it updates fields 2002-12-01 05:40:18 +00:00
vm_pageout.h Remove __P. 2002-03-19 22:20:14 +00:00
vm_pageq.c o Remove dead and/or unused code. 2002-07-20 05:06:20 +00:00
vm_pager.c o Remove some long dead code: from revision 1.41 of vm/vm_pager.c 2002-07-01 02:38:05 +00:00
vm_pager.h o Remove some long dead code: from revision 1.41 of vm/vm_pager.c 2002-07-01 02:38:05 +00:00
vm_param.h Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loader 2001-10-10 23:06:54 +00:00
vm_swap.c Merge from MAC tree: rename mac_check_vnode_swapon() to 2002-10-27 06:54:06 +00:00
vm_unix.c Use the fields in the sysentvec and in the vm map header in place of the 2002-09-21 22:07:17 +00:00
vm_zeroidle.c - Create a new scheduler api that is defined in sys/sched.h 2002-10-12 05:32:24 +00:00
vm.h - Remove a number of extra newlines that do not belong here according to 2002-03-10 21:52:48 +00:00
vnode_pager.c Perform vm_object_lock() and vm_object_unlock() around 2002-12-15 05:41:56 +00:00
vnode_pager.h Remove __P. 2002-03-19 22:20:14 +00:00