From 266fc07dffa60d68b997ffa31d5251cb816ce210 Mon Sep 17 00:00:00 2001 From: huangzq2 Date: Sat, 11 Nov 2023 20:35:37 +0800 Subject: [PATCH] workaround fix long page fault issue - change version to 2 - exit page fault with EIO if waited long time - reduce log and enlarge page fault warning timeout to 500ms Change-Id: I87858443d639c43cc804931063fe71daf0eccc96 Signed-off-by: huangzq2 Reviewed-on: https://gerrit.mot.com/2792701 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- drivers/moto_swap/hybridswap/hybridswap_eswap.c | 12 +++++++++--- drivers/moto_swap/hybridswap/hybridswap_swapd.c | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/moto_swap/hybridswap/hybridswap_eswap.c b/drivers/moto_swap/hybridswap/hybridswap_eswap.c index 1fdd7e0e4efc..f9cfbfac411b 100644 --- a/drivers/moto_swap/hybridswap/hybridswap_eswap.c +++ b/drivers/moto_swap/hybridswap/hybridswap_eswap.c @@ -174,7 +174,7 @@ struct hyb_entries_table { (index) != (hindex); (index) = (tmp), (tmp) = prev_index((index), (tab))) static unsigned long warn_level[HYB_CLASS_BUTT] = { - 0, 200, 500, 0 + 0, 500, 500, 0 }; const char *key_point_name[HYB_KYE_POINT_BUTT] = { @@ -4946,7 +4946,7 @@ static int hybridswap_permcg_reclaim(struct mem_cgroup *memcg, atomic64_inc(&hybs->hybridswap_outcnt); out: - hybp(HYB_INFO, "memcg %s %lu %lu out_to_eswap %lu KB eswap %lu zram %lu %d\n", + hybp(HYB_DEBUG, "memcg %s %lu %lu out_to_eswap %lu KB eswap %lu zram %lu %d\n", hybs->name, (unsigned long)require_size_before, (unsigned long)require_size, (unsigned long)((require_size_before - require_size) >> 10), (unsigned long)atomic64_read(&hybs->hybridswap_stored_size), @@ -4998,7 +4998,7 @@ static int hybridswap_permcg_reclaimin(struct mem_cgroup *memcg, rq->reclaimined_sz += mcg_reclaimed_size; mutex_unlock(&hybs->swap_lock); - hybp(HYB_INFO, "memcg %s mcg_reclaimed_size %lu rq->reclaimined_sz %lu rq->size %lu rq->out_size %lu ret %d\n", + hybp(HYB_DEBUG, "memcg %s mcg_reclaimed_size %lu rq->reclaimined_sz %lu rq->size %lu rq->out_size %lu ret %d\n", hybs->name, mcg_reclaimed_size, rq->reclaimined_sz, rq->size, rq->out_size, ret); @@ -5304,6 +5304,12 @@ static int hybridswap_page_fault_fetch_eswap(struct zram *zram, if (likely(iowork->ioentry->eswapid != -EBUSY)) break; + // Moto: waited enough, exit with EIO. + if (wait_cycle > 100000) { + hybp(HYB_ERR, "waited 100000 cycles in page fault, exit with EIO!\n"); + return -EIO; + } + if (wait_cycle < 100) udelay(50); else diff --git a/drivers/moto_swap/hybridswap/hybridswap_swapd.c b/drivers/moto_swap/hybridswap/hybridswap_swapd.c index 51326c2d698e..b172c90b15a2 100644 --- a/drivers/moto_swap/hybridswap/hybridswap_swapd.c +++ b/drivers/moto_swap/hybridswap/hybridswap_swapd.c @@ -36,7 +36,7 @@ #endif #include "hybridswap_internal.h" -#define MOTO_SWAP_VERSION 1 +#define MOTO_SWAP_VERSION 2 struct swapd_param { unsigned int min_grade;