mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
mm: zram: free the swap slot when swap in
The zram pages on backing store can not be freed when swap in, becase they have swap cache. So before these pages become drity, they will be always read from swap cache or backing store. If these pages happens to be swap out again, the swap cahce will be deleted, then they can only be loaded from backing store, not zram. Change-Id: I59a4ef1f7b6fb4ce803a56a7eaae7693a69780d4 Signed-off-by: huangzq2 <huangzq2@motorola.com> Reviewed-on: https://gerrit.mot.com/1900258 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com> Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1902453 Reviewed-by: Yonghui Jia <jiayh2@motorola.com> Reviewed-by: Zhizhong Ge <gezz1@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com>
This commit is contained in:
parent
1c3fe4abfa
commit
0daa6e1781
1 changed files with 6 additions and 5 deletions
11
mm/page_io.c
11
mm/page_io.c
|
|
@ -398,11 +398,12 @@ int swap_readpage(struct page *page, bool synchronous)
|
|||
|
||||
ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
|
||||
if (!ret) {
|
||||
if (trylock_page(page)) {
|
||||
swap_slot_free_notify(page);
|
||||
unlock_page(page);
|
||||
}
|
||||
|
||||
/*
|
||||
* Moto huangzq2: We either remove the trylock_page or use lock_page
|
||||
* here, becuase trylock will always return false due to page_endio
|
||||
* in zram_rw_page.
|
||||
*/
|
||||
swap_slot_free_notify(page);
|
||||
count_vm_event(PSWPIN);
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue