MTK MMC读写速度提升

安卓10.0 kernel_4.9

emmc宏配置:CONFIG_MTK_EMMC_CQ_SUPPORT = y

保证宏配置为y,没有则进行添加

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index ee45e5b..ea409bd 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -4366,7 +4366,10 @@ int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req)
 			mq->mqrq_cur = &mq->mqrq[index];
 			mq->mqrq_cur->req = req;
 			atomic_set(&mq->mqrq_cur->index, index + 1);
+/* StoneOim:kevin on: Tue, 21 Dec 2021 10:15:06 +0800
 			atomic_inc(&card->host->areq_cnt);
+  */
+// End of StoneOim:kevin
 		}
 #endif
 		if (!part_cmdq_en && !req && host->areq) {
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index fac6c0f..4d2b45d 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -90,6 +90,10 @@ static void mmc_enqueue_queue(struct mmc_host *host, struct mmc_request *mrq)
 		spin_unlock_irqrestore(&host->dat_que_lock, flags);
 	} else {
 		spin_lock_irqsave(&host->cmd_que_lock, flags);
+/* StoneOim:kevin on: Tue, 21 Dec 2021 10:12:07 +0800
+  */
+        atomic_inc(&host->areq_cnt);
+// End of StoneOim:kevin
 		if (mrq->flags)
 			list_add(&mrq->link, &host->cmd_que);
 		else

---------------------------------------------------------------------------------------------------------------------------------

安卓11.0 kernel_4.19

From 03095e70b9bc0252d0d417a272999128b806d143 Mon Sep 17 00:00:00 2001
From: mtk13858 <derong.liu@mediatek.com>
Date: Fri, 09 Jul 2021 21:02:30 +0800
Subject: [PATCH] [ALPS05897129] msdc:set exe_cq as RT thread

1.block layer changes in kernel-4.19,
in order to gain more performance,
we need to set exe_cq as RT thread.
2.if it only sets exe_cq as RT thread,
areq_cnt also needs to change together with enqueue flow,
or KE will happen.

Change-Id: Id38b4f9bd09f7ce46b02839d1a87345f5d806b15
Signed-off-by: mtk13858 <derong.liu@mediatek.com>
CR-Id: ALPS05897129
Feature: eMMC
---

diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 18528a5..9367007 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2349,7 +2349,6 @@
 	mq->mqrq[index].req = req;
 	atomic_set(&mqrq->index, index + 1);
 	atomic_set(&mq->mqrq[index].index, index + 1);
-	atomic_inc(&card->host->areq_cnt);
 
 	mmc_blk_rw_rq_prep(mqrq, mq->card, 0, mq);
 
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 2187072..642173f 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -357,6 +357,7 @@
 	} else {
 
 		spin_lock_irqsave(&host->cmd_que_lock, flags);
+		atomic_inc(&host->areq_cnt);
 		if (mrq->flags)
 			list_add(&mrq->link, &host->cmd_que);
 		else
@@ -895,6 +896,11 @@
 	bool is_done = false;
 	int err;
 	u64 chk_time = 0;
+	struct sched_param scheduler_params = {0};
+
+	/* Set as RT priority */
+	scheduler_params.sched_priority = 1;
+	sched_setscheduler(current, SCHED_FIFO, &scheduler_params);
 
 	pr_info("[CQ] start cmdq thread\n");
 	mt_bio_queue_alloc(current, NULL, false);
@@ -1098,6 +1104,9 @@
 			schedule();
 
 		set_current_state(TASK_RUNNING);
+
+		if (kthread_should_stop())
+			break;
 	}
 	mt_bio_queue_free(current);
 	return 0;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值