Skip to contentSkip to conversation

Swap token re-tuned

RFC PATCH In review Ashwin Chaugule 1 participant 1 message Sep 28, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 Swap token re-tuned

Try to grab swap token before the VM selects pages for eviction.

mm/filemap.c +1 -1
index afcdc72..190d2c1 100644
@@ -1478,8 +1478,8 @@ no_cached_page:
    * We're only likely to ever get here if MADV_RANDOM is in
    * effect.
    */
+    grab_swap_token(); /* Contend for token _before_ we read-in */
   error = page_cache_read(file, pgoff);
-    grab_swap_token();
 
   /*
    * The page we want has now been added to the page cache.
mm/memory.c +1 -1
index 92a3ebd..52eb9b8 100644
@@ -1974,6 +1974,7 @@ static int do_swap_page(struct mm_struct
   delayacct_set_flag(DELAYACCT_PF_SWAPIN);
   page = lookup_swap_cache(entry);
   if (!page) {
+        grab_swap_token(); /* Contend for token _before_ we read-in */
        swapin_readahead(entry, address, vma);
        page = read_swap_cache_async(entry, vma, address);
       if (!page) {
@@ -1991,7 +1992,6 @@ static int do_swap_page(struct mm_struct
       /* Had to read the page from swap area: Major fault */
       ret = VM_FAULT_MAJOR;
       count_vm_event(PGMAJFAULT);
-        grab_swap_token();
   }
 
   delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
Signature · 5 lines
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>