mmc: core: Reduce the time to check for BKOPS need on idle
In order to allow the card to perform BKOPS as early as possible without
causing degradation to a flow of requests, we reduce the time of the
BKOPS delayed work to 200ms.
Based on experience, 200ms will allow requests to be performed without
a delay of checking the BKOPS.
This patch also allows the host controller to set any other time if
required.
Change-Id: I1e56bfd0c9471abf4da50befe6d14fe0199129e7
Signed-off-by: Maya Erez <merez@codeaurora.org>
(cherry picked from commit 70b00220e7564b00e3b0747260fe2c2dbe62f45d)
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 47fd9b9..26be54f 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -1324,17 +1324,16 @@
/*
* Calculate the time to start the BKOPs checking.
- * The idle time of the host controller should be taken
- * into account in order to prevent a race condition
- * before starting BKOPs and going into suspend.
- * If the host controller didn't set its idle time,
+ * The host controller can set this time in order to
+ * prevent a race condition before starting BKOPs
+ * and going into suspend.
+ * If the host controller didn't set this time,
* a default value is used.
*/
card->bkops_info.delay_ms = MMC_IDLE_BKOPS_TIME_MS;
- if (card->bkops_info.host_suspend_tout_ms)
- card->bkops_info.delay_ms = min(
- card->bkops_info.delay_ms,
- card->bkops_info.host_suspend_tout_ms/2);
+ if (card->bkops_info.host_delay_ms)
+ card->bkops_info.delay_ms =
+ card->bkops_info.host_delay_ms;
card->bkops_info.min_sectors_to_queue_delayed_work =
BKOPS_MIN_SECTORS_TO_QUEUE_DELAYED_WORK;
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 8b6b0c1..f714e8a 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -233,8 +233,7 @@
/**
* struct mmc_bkops_info - BKOPS data
* @dw: Idle time bkops delayed work
- * @host_suspend_tout_ms: The host controller idle time,
- * before getting into suspend
+ * @host_delay_ms: The host controller time to start bkops
* @delay_ms: The time to start the BKOPS
* delayed work once MMC thread is idle
* @poll_for_completion: Poll on BKOPS completion
@@ -247,14 +246,14 @@
*/
struct mmc_bkops_info {
struct delayed_work dw;
- unsigned int host_suspend_tout_ms;
+ unsigned int host_delay_ms;
unsigned int delay_ms;
unsigned int min_sectors_to_queue_delayed_work;
/*
* A default time for checking the need for non urgent BKOPS once mmcqd
* is idle.
*/
-#define MMC_IDLE_BKOPS_TIME_MS 2000
+#define MMC_IDLE_BKOPS_TIME_MS 200
struct work_struct poll_for_completion;
/* Polling timeout and interval for waiting on non-blocking BKOPs completion */
#define BKOPS_COMPLETION_POLLING_TIMEOUT_MS 10000 /* in ms */