Revert "kernel5.4: mm zram:free the swap slot when swap in"

Reason, the changes may cause panic problem
  Fix, revert the change

This reverts commit 147db8784085f8456da0c2870e626da4c25f1778.

Change-Id: Ia4cfda84125c5d06af363e6a2d685d0c94c26c5f
Reviewed-on: https://gerrit.mot.com/1930858
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Zhizhong Ge <gezz1@motorola.com>
Reviewed-by: Zhangqing Huang <huangzq2@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Reviewed-by: Zhongsheng Xia <xiazs1@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Yonghui Jia 2021-04-23 03:42:52 -05:00 • committed by Xiaojun Ji
commit 0ad3cfe7d0

View file

@ -398,12 +398,11 @@ int swap_readpage(struct page *page, bool synchronous)
ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
if (!ret) {
/*
* 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);
if (trylock_page(page)) {
swap_slot_free_notify(page);
unlock_page(page);
}
count_vm_event(PSWPIN);
goto out;
}