aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshwin Chaugule <ashwin.chaugule@celunite.com>2006-12-06 20:31:54 -0800
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 08:39:21 -0800
commit098fe651f7e9d759d1117c78c1a642b9b3945922 (patch)
tree8688e367d04c8341e79d9da775dccb9dc7747509
parentcd54e7e54318d333227b13186f9a464bf1f68d27 (diff)
downloadkernel_samsung_smdk4412-098fe651f7e9d759d1117c78c1a642b9b3945922.zip
kernel_samsung_smdk4412-098fe651f7e9d759d1117c78c1a642b9b3945922.tar.gz
kernel_samsung_smdk4412-098fe651f7e9d759d1117c78c1a642b9b3945922.tar.bz2
[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>
-rw-r--r--mm/filemap.c1
-rw-r--r--mm/memory.c2
2 files changed, 1 insertions, 2 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 13df01c..af7e2f5 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1445,7 +1445,6 @@ no_cached_page:
* effect.
*/
error = page_cache_read(file, pgoff);
- grab_swap_token();
/*
* The page we want has now been added to the page cache.
diff --git a/mm/memory.c b/mm/memory.c
index 156861f..a07120d 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,
delayacct_set_flag(DELAYACCT_PF_SWAPIN);
page = lookup_swap_cache(entry);
if (!page) {
+ grab_swap_token(); /* Contend for token _before_ read-in */
swapin_readahead(entry, address, vma);
page = read_swap_cache_async(entry, vma, address);
if (!page) {
@@ -2008,7 +2009,6 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
/* 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);