+ swap-token-try-to-grab-swap-token-before-the-vm-selects-pages-for-eviction.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     swap-token: try to grab swap token before the VM selects pages for eviction

has been added to the -mm tree.  Its filename is

     swap-token-try-to-grab-swap-token-before-the-vm-selects-pages-for-eviction.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: swap-token: try to grab swap token before the VM selects pages for eviction
From: Ashwin Chaugule <ashwin.chaugule@xxxxxxxxxxxx>

In the current implementation of swap token tuning, grab swap token is made
from: 

1) after page_cache_read (filemap.c) and 

2) after the readahead logic in do_swap_page (memory.c) 

IMO, the contention for the swap token should happen _before_ the
aforementioned calls, because in the event of low system memory, calls to
freeup space will be made later from page_cache_read and read_swap_cache_async
, so we want to avoid "false LRU" pages by grabbing the token before the VM
starts searching for replacement candidates.  

Signed-off-by: Ashwin Chaugule <ashwin.chaugule@xxxxxxxxxxxx>
Cc: Rik van Riel <riel@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 mm/filemap.c |    2 +-
 mm/memory.c  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -puN mm/filemap.c~swap-token-try-to-grab-swap-token-before-the-vm-selects-pages-for-eviction mm/filemap.c
--- a/mm/filemap.c~swap-token-try-to-grab-swap-token-before-the-vm-selects-pages-for-eviction
+++ a/mm/filemap.c
@@ -1456,8 +1456,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.
diff -puN mm/memory.c~swap-token-try-to-grab-swap-token-before-the-vm-selects-pages-for-eviction mm/memory.c
--- a/mm/memory.c~swap-token-try-to-grab-swap-token-before-the-vm-selects-pages-for-eviction
+++ a/mm/memory.c
@@ -1989,6 +1989,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) {
@@ -2006,7 +2007,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);
_

Patches currently in -mm which might be from ashwin.chaugule@xxxxxxxxxxxx are

swap-token-try-to-grab-swap-token-before-the-vm-selects-pages-for-eviction.patch
swap-token-new-scheme-to-preempt-token.patch
swap-token-new-scheme-to-preempt-token-tidy.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux