|
@@ -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);
|