diff --git a/mm/filemap.c b/mm/filemap.c index 13df01c50479ce8fa2dc1fa283d6483c2a31937b..af7e2f5caea94c12a21847fe7fe23047b58c344e 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1445,7 +1445,6 @@ struct page *filemap_nopage(struct vm_area_struct *area, * 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 156861fcac436e4716537c7e5dff565dded43224..a07120da868bccfec557ea72d28c2ba99e563c18 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);