Commit Graph

1545 Commits

Author SHA1 Message Date
Alan Cox
5299887de5 - Relax the Giant required in vm_page_remove().
- Remove the Giant required from vm_page_free_toq().  (Any locking
   errors will be caught by vm_page_remove().)

This remedies a panic that occurred when kmem_malloc(NOWAIT) performed
without Giant failed to allocate the necessary pages.

Reported by:	phk
2003-04-25 06:35:05 +00:00
Alan Cox
875791f63d - Move swap_pager_isswapped()'s prototype to a more logical place. 2003-04-24 05:29:27 +00:00
Alan Cox
b6e48e0372 - Acquire the vm_object's lock when performing vm_object_page_clean().
- Add a parameter to vm_pageout_flush() that tells vm_pageout_flush()
   whether its caller has locked the vm_object.  (This is a temporary
   measure to bootstrap vm_object locking.)
2003-04-24 04:31:25 +00:00
John Baldwin
11edc1e0d7 Fix compiling in the NO_SWAPPING case.
Submitted by:	bde (partially)
2003-04-23 18:21:41 +00:00
John Baldwin
897ecacd64 Lock the proc to check p_flag and several other related tests in
vm_daemon().  We don't need to hold sched_lock as long now as a result.
2003-04-22 20:03:08 +00:00
John Baldwin
eeec6bab2e Prefer the proc lock to sched_lock when testing PS_INMEM now that it is
safe to do so.
2003-04-22 20:01:56 +00:00
John Baldwin
664f718ba1 - Always call faultin() in _PHOLD() if PS_INMEM is clear. This closes a
race where a thread could assume that a process was swapped in by
  PHOLD() when it actually wasn't fully swapped in yet.
- In faultin(), always msleep() if PS_SWAPPINGIN is set instead of doing
  this check after bumping p_lock in the PS_INMEM == 0 case.  Also,
  sched_lock is only needed for setting and clearning swapping PS_*
  flags and the swap thread inhibitor.
- Don't set and clear the thread swap inhibitor in the same loops as the
  pmap_swapin/out_thread() since we have to do it under sched_lock.
  Instead, mimic the treatment of the PS_INMEM flag and use separate loops
  to set the inhibitors when clearing PS_INMEM and clear the inhibitors
  when setting PS_INMEM.
- swapout() now returns with the proc lock held as it holds the lock
  while adjusting the swapping-related PS_* flags so that the proc lock
  can be used to test those flags.
- Only use the proc lock to check the swapping-related PS_* flags in
  several places.
- faultin() no longer requires sched_lock to be held by callers.
- Rename PS_SWAPPING to PS_SWAPPINGOUT to be less ambiguous now that we
  have PS_SWAPPINGIN.
2003-04-22 20:00:26 +00:00
Alan Cox
2e9d00a15d Revision 1.246 should have also included
- Weaken the assertion in vm_page_insert() to require Giant only if the
   vm_object isn't locked.

Reported by:	 "Ilmar S. Habibulin" <ilmar@watson.org>
2003-04-22 14:26:02 +00:00
Alan Cox
26da32cc73 Remove unused declarations. 2003-04-22 06:26:42 +00:00
Alan Cox
03d4c1e644 Revision 1.52 of vm/uma_core.c has led to UMA's obj_alloc() being
called without Giant; and obj_alloc() in turn calls vm_page_alloc()
without Giant.  This causes an assertion failure in vm_page_alloc().
Fortunately, obj_alloc() is now MPSAFE.  So, we need only clean up
some assertions.

 - Weaken the assertion in vm_page_lookup() to require Giant only
   if the vm_object isn't locked.
 - Remove an assertion from vm_page_alloc() that duplicates a check
   performed in vm_page_lookup().

In collaboration with:	gallatin, jake, jeff
2003-04-22 05:36:14 +00:00
Alan Cox
1c067f7ebc Add VM_OBJECT_LOCKED(). 2003-04-22 04:47:29 +00:00
Alan Cox
d647a0ed5a - Assert that the vm_object is locked in vm_object_clear_flag(),
vm_object_pip_add() and vm_object_pip_wakeup().
 - Remove GIANT_REQUIRED from vm_object_pip_subtract() and
   vm_object_pip_subtract().
 - Lock the vm_object when performing vm_object_page_remove().
2003-04-21 06:33:52 +00:00
Alan Cox
d7a013c320 - Lock the vm_object when performing either vm_object_clear_flag() or
vm_object_pip_wakeup().
2003-04-20 23:23:41 +00:00
Alan Cox
1d284e00b5 - Update the vm_object locking in vm_map_insert(). 2003-04-20 21:56:40 +00:00
Alan Cox
72ba747d16 - Lock the vm_object when performing vm_object_pip_wakeup().
- Merge two identical cases in a switch statement.
2003-04-20 20:37:14 +00:00
Alan Cox
b009d5a0af - Lock the vm_object when performing vm_object_pip_wakeup(). 2003-04-20 19:25:28 +00:00
Alan Cox
d68d828b43 - Lock the vm_object when performing vm_object_pip_add().
- Remove an unnecessary variable.
2003-04-20 07:08:30 +00:00
Alan Cox
7d040e3cc5 Update vm_object locking in vm_map_delete(). 2003-04-20 04:35:47 +00:00
Alan Cox
d22bc7101c - Lock the vm_object when performing vm_object_pip_add(). 2003-04-20 03:41:21 +00:00
Alan Cox
0fa05eae77 - Lock the vm_object when performing vm_object_pip_subtract().
- Assert that the vm_object lock is held in vm_object_pip_subtract().
2003-04-19 22:11:41 +00:00
Alan Cox
0d420ad3e6 - Lock the vm_object when performing vm_object_pip_wakeupn().
- Assert that the vm_object lock is held in vm_object_pip_wakeupn().
 - Add a new macro VM_OBJECT_LOCK_ASSERT().
2003-04-19 21:15:44 +00:00
Alan Cox
034b3d7a6f o Update locking around vm_object_page_remove() in vm_map_clean()
to use the new macros.
 o Remove unnecessary increment and decrement of the vm_object's
   reference count in vm_map_clean().
2003-04-19 01:43:32 +00:00
Alan Cox
410cfc455e Lock the vm_object in obj_alloc(). 2003-04-19 00:30:36 +00:00
Alan Cox
49281fbf68 Update locking around vm_object_page_remove() to use the new macros. 2003-04-18 16:39:03 +00:00
Andrew Gallatin
b37d8ead52 Don't grab Giant in slab_zalloc() if M_NOWAIT is specified. This
should allow the use of INTR_MPSAFE network drivers.

Tested by: njl
Glanced at by: jeff
2003-04-18 13:02:29 +00:00
John Baldwin
69297bf8c9 suser() does not need the proc lock, just the setting of P_PROTECTED in
p_flag needs the lock.
2003-04-17 22:38:27 +00:00
Tom Rhodes
9faaf3b3c8 Add some tunable descriptions.
Submitted by:	hmp
Discussed with:	bde
2003-04-17 15:44:22 +00:00
Tom Rhodes
2a3eeaa240 Pre-content whitespace commit.
Discussed with:	bde
2003-04-17 15:39:12 +00:00
Alan Cox
acbff226fc Update locking on the kmem_object to use the new macros. 2003-04-15 01:16:05 +00:00
Alan Cox
de5ef10142 Update locking on the kernel_object to use the new macros. 2003-04-14 00:36:53 +00:00
Alan Cox
d1dc776d9d Lock some manipulations of the vm object's flags. 2003-04-13 23:43:34 +00:00
Alan Cox
e2479b4fc3 Lock some manipulations of the vm object's flags. 2003-04-13 20:22:02 +00:00
Alan Cox
b077a36297 Lock some manipulations of the vm object's flags. 2003-04-13 19:36:18 +00:00
Alan Cox
fdff41609d Add new macros for locking and unlocking a vm object. 2003-04-13 18:39:47 +00:00
Alan Cox
f279b88deb Permit vm_object_pip_add() and vm_object_pip_wakeup() on the kmem_object
without Giant held.
2003-04-13 00:43:48 +00:00
Alan Cox
f31c239da1 Eliminate unnecessary gotos from kmem_malloc(). 2003-04-13 00:23:42 +00:00
John Baldwin
d8fed0f0f2 - Kill the pv_flags member of the alpha mdpage since it stop being used
in rev 1.61 of pmap.c.
- Now that pmap_page_is_free() is empty and since it is just a hack for
  the Alpha pmap, remove it.
2003-04-10 18:42:06 +00:00
Alan Cox
2ac8b16089 Remove GIANT_REQUIRED from getpbuf(). Reviewed by: tegge
Reduce pbuf_mtx's scope in relpbuf().  Submitted by: tegge
2003-04-05 21:01:16 +00:00
Dag-Erling Smørgrav
e8c7f48855 Rename a static variable to avoid future conflicts. 2003-04-04 12:08:42 +00:00
Wes Peters
f4cf2141f6 Add a facility allowing processes to inform the VM subsystem they are
critical and should not be killed when pageout is looking for more
memory pages in all the wrong places.

Reviewed by:	arch@
Sponsored by:	St. Bernard Software
2003-03-31 21:09:57 +00:00
Maxime Henrion
6900a17c75 The object type can't be OBJT_PHYS in vm_mmap().
Reviewed by:	peter
2003-03-30 00:56:20 +00:00
Tor Egge
125ee0d161 Obtain Giant before calling kmem_alloc without M_NOWAIT and before calling
kmem_free if Giant isn't already held.
2003-03-26 18:44:53 +00:00
Jake Burkholder
227f9a1c58 - Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)
2003-03-25 00:07:06 +00:00
Maxime Henrion
dab392a4d4 Remove an empty comment. 2003-03-19 00:34:43 +00:00
Poul-Henning Kamp
b4b138c27f Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.
2003-03-18 08:45:25 +00:00
Jake Burkholder
9f77ba59c5 Subtract the memory that backs the vm_page structures from phys_avail
after mapping it.  This makes it possible to determine if a physical
page has a backing vm_page or not.
2003-03-17 03:16:00 +00:00
Jake Burkholder
5501d40bb9 Made the prototypes for pmap_kenter and pmap_kremove MD. These functions
are machine dependent because they are not required to update the tlb when
mappings are added or removed, and doing so is machine dependent.
In addition, an implementation may require that pages mapped with pmap_kenter
have a backing vm_page_t, which is not necessarily true of all physical
pages, and so may choose to pass the vm_page_t to pmap_kenter instead of the
physical address in order to make this requirement clear.
2003-03-16 04:16:03 +00:00
David Schultz
72d97679ff - When the VM daemon is out of swap space and looking for a
process to kill, don't block on a map lock while holding the
  process lock.  Instead, skip processes whose map locks are held
  and find something else to kill.
- Add vm_map_trylock_read() to support the above.

Reviewed by:	alc, mike (mentor)
2003-03-12 23:13:16 +00:00
Kenneth D. Merry
9b80d344ec Zero copy send and receive fixes:
- On receive, vm_map_lookup() needs to trigger the creation of a shadow
  object.  To make that happen, call vm_map_lookup() with PROT_WRITE
  instead of PROT_READ in vm_pgmoveco().

- On send, a shadow object will be created by the vm_map_lookup() in
  vm_fault(), but vm_page_cowfault() will delete the original page from
  the backing object rather than simply letting the legacy COW mechanism
  take over.  In other words, the new page should be added to the shadow
  object rather than replacing the old page in the backing object.  (i.e.
  vm_page_cowfault() should not be called in this case.)  We accomplish
  this by making sure fs.object == fs.first_object before calling
  vm_page_cowfault() in vm_fault().

Submitted by:	gallatin, alc
Tested by:	ken
2003-03-08 06:58:18 +00:00
Alan Cox
09c80124a3 Remove ENABLE_VFS_IOOPT. It is a long unfinished work-in-progress.
Discussed on:	arch@
2003-03-06 03:41:02 +00:00