From 1c3fe4abfab71f29bcba556b62ea4c0ab3082308 Mon Sep 17 00:00:00 2001 From: huangzq2 Date: Sat, 13 Mar 2021 19:28:24 +0800 Subject: [PATCH] mm: zram: skip readahead for sync io pages Zram is a ram based swap, but Zram with writeback is ram + IO based swap, so we still need readhead for the pages on backing store, the page-cluster should be tuned on each chipset if we enabled zram wb, beside this, we made this patch to skip readahead on the page which has not been writebacked. Change-Id: Ia219baf888cfc6ef4865f7c4d682ab4384de893c Signed-off-by: huangzq2 Reviewed-on: https://gerrit.mot.com/1900257 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1902452 Reviewed-by: Yonghui Jia Reviewed-by: Zhizhong Ge Reviewed-by: Huosheng Liao --- mm/swap_state.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/swap_state.c b/mm/swap_state.c index 260ac6a822b9..16709312e949 100644 --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -738,6 +738,12 @@ static struct page *swap_vma_readahead(swp_entry_t fentry, gfp_t gfp_mask, bool page_allocated; struct vma_swap_readahead ra_info = {0,}; + /* Moto huangzq2: don't readahead sync io pages */ + if (swap_slot_has_sync_io(fentry)) { + ra_info.win = 1; + goto skip; + } + swap_ra_info(vmf, &ra_info); if (ra_info.win == 1) goto skip; @@ -753,6 +759,9 @@ static struct page *swap_vma_readahead(swp_entry_t fentry, gfp_t gfp_mask, entry = pte_to_swp_entry(pentry); if (unlikely(non_swap_entry(entry))) continue; + /* Moto huangzq2: don't readahead sync io pages */ + if (swap_slot_has_sync_io(entry)) + continue; page = __read_swap_cache_async(entry, gfp_mask, vma, vmf->address, &page_allocated); if (!page)