Commit 098fe651 authored by Ashwin Chaugule's avatar Ashwin Chaugule Committed by Linus Torvalds
Browse files

[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: default avatarAshwin Chaugule <>
Cc: Rik van Riel <>
Cc: Peter Zijlstra <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent cd54e7e5
......@@ -1445,7 +1445,6 @@ struct page *filemap_nopage(struct vm_area_struct *area,
* effect.
error = page_cache_read(file, pgoff);
* The page we want has now been added to the page cache.
......@@ -1991,6 +1991,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment