aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorAshwin Chaugule <ashwin.chaugule@celunite.com>2006-12-06 23:31:54 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:21 -0500
commit098fe651f7e9d759d1117c78c1a642b9b3945922 (patch)
tree8688e367d04c8341e79d9da775dccb9dc7747509 /mm/memory.c
parentcd54e7e54318d333227b13186f9a464bf1f68d27 (diff)
[PATCH] grab swap token reordered
Make sure the contention for the token happens _before_ any read-in and kicks the swap-token algo only when the VM is under pressure. Signed-off-by: Ashwin Chaugule <ashwin.chaugule@celunite.com> Cc: Rik van Riel <riel@redhat.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 156861fcac43..a07120da868b 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1991,6 +1991,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
1991 delayacct_set_flag(DELAYACCT_PF_SWAPIN); 1991 delayacct_set_flag(DELAYACCT_PF_SWAPIN);
1992 page = lookup_swap_cache(entry); 1992 page = lookup_swap_cache(entry);
1993 if (!page) { 1993 if (!page) {
1994 grab_swap_token(); /* Contend for token _before_ read-in */
1994 swapin_readahead(entry, address, vma); 1995 swapin_readahead(entry, address, vma);
1995 page = read_swap_cache_async(entry, vma, address); 1996 page = read_swap_cache_async(entry, vma, address);
1996 if (!page) { 1997 if (!page) {
@@ -2008,7 +2009,6 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
2008 /* Had to read the page from swap area: Major fault */ 2009 /* Had to read the page from swap area: Major fault */
2009 ret = VM_FAULT_MAJOR; 2010 ret = VM_FAULT_MAJOR;
2010 count_vm_event(PGMAJFAULT); 2011 count_vm_event(PGMAJFAULT);
2011 grab_swap_token();
2012 } 2012 }
2013 2013
2014 delayacct_clear_flag(DELAYACCT_PF_SWAPIN); 2014 delayacct_clear_flag(DELAYACCT_PF_SWAPIN);