mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
Fix incomplete backport of commit 0f792cf949a0
Signed-off-by: Zefan Li <lizefan@huawei.com>
This commit is contained in:
parent
6883832be8
commit
d64519bf05
1 changed files with 9 additions and 5 deletions
14
mm/hugetlb.c
14
mm/hugetlb.c
|
@ -2929,13 +2929,17 @@ out_page_table_lock:
|
||||||
unlock_page(pagecache_page);
|
unlock_page(pagecache_page);
|
||||||
put_page(pagecache_page);
|
put_page(pagecache_page);
|
||||||
}
|
}
|
||||||
if (page != pagecache_page)
|
|
||||||
unlock_page(page);
|
|
||||||
put_page(page);
|
|
||||||
|
|
||||||
out_mutex:
|
out_mutex:
|
||||||
mutex_unlock(&hugetlb_instantiation_mutex);
|
mutex_unlock(&hugetlb_instantiation_mutex);
|
||||||
|
/*
|
||||||
|
* Generally it's safe to hold refcount during waiting page lock. But
|
||||||
|
* here we just wait to defer the next page fault to avoid busy loop and
|
||||||
|
* the page is not used after unlocked before returning from the current
|
||||||
|
* page fault. So we are safe from accessing freed page, even if we wait
|
||||||
|
* here without taking refcount.
|
||||||
|
*/
|
||||||
|
if (need_wait_lock)
|
||||||
|
wait_on_page_locked(page);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue