Thread (1 message) 1 message, 1 author, 2004-02-09

Re: Documentation/vm/locking: why not hold two PT locks?

From: Ed L Cashin <hidden>
Date: 2004-02-09 21:17:34

Kanoj Sarcar [off-list ref] writes:

...
When "locking" came into being, vmscan was the only
page stealer.
I tried to start a patch to the file, but I realize that I don't
really know how 2.6 is ensuring the existance of the backing store, so
I couldn't put that in.

--- Documentation/vm/locking.orig	Wed Nov 26 15:43:30 2003
+++ Documentation/vm/locking	Mon Feb  9 16:07:45 2004
@@ -7,19 +7,17 @@
 page_table_lock & mmap_sem
 --------------------------------------
 
-Page stealers pick processes out of the process pool and scan for 
-the best process to steal pages from. To guarantee the existence 
-of the victim mm, a mm_count inc and a mmdrop are done in swap_out().
-Page stealers hold kernel_lock to protect against a bunch of races.
-The vma list of the victim mm is also scanned by the stealer, 
-and the page_table_lock is used to preserve list sanity against the
-process adding/deleting to the list. This also guarantees existence
-of the vma. Vma existence is not guaranteed once try_to_swap_out() 
-drops the page_table_lock. To guarantee the existence of the underlying 
-file structure, a get_file is done before the swapout() method is 
-invoked. The page passed into swapout() is guaranteed not to be reused
-for a different purpose because the page reference count due to being
-present in the user's pte is not released till after swapout() returns.
+The page stealer in mm/vmscan.c picks pages out of the page cache and
+scans for the best pages to reclaim.  The mm/rmap.c:try_to_unmap
+function uses trylock to get the page_table_lock for each page table
+that has a mapping to the victim page.  Trylocks are used to avoid the
+deadlock that might otherwise occur, because the mmap_sem is not
+acquired first.
+
+The vma list of the victim mm is also scanned by the stealer, and the
+page_table_lock is used to preserve list sanity against the process
+adding/deleting to the list. This also guarantees existence of the
+vma.
 
 Any code that modifies the vmlist, or the vm_start/vm_end/
 vm_flags:VM_LOCKED/vm_next of any vma *in the list* must prevent 

-- 
--Ed L Cashin            |   PGP public key:
  ecashin@uga.edu        |   http://noserose.net/e/pgp/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help