mmc: fix read latency of urgent request
In order to improve read request latency, urgent notification allowed
anytime, when current or previous requests are existing in the mmc layer.
It is not allowed to stop following running requests:
- urgent request: block layer should serialize urgent request notification.
- read request: it can't be packed, therefore it is better
to wait for its completion.
- REQ_FUA: interruption and delay in such request will impact sync process
of upper layers.
Change-Id: Id7d1480cce2059c1f23a5f29ad8f74e858be1ee6
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Tatyana Brokhman <tlinder@codeaurora.org>
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 65a1322..169ccf1 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -78,7 +78,15 @@
mq->issue_fn(mq, req);
if (mq->flags & MMC_QUEUE_NEW_REQUEST) {
continue; /* fetch again */
- } else if (mq->flags & MMC_QUEUE_URGENT_REQUEST) {
+ } else if ((mq->flags & MMC_QUEUE_URGENT_REQUEST) &&
+ (mq->mqrq_cur->req &&
+ !(mq->mqrq_cur->req->cmd_flags & REQ_URGENT))) {
+ /*
+ * clean current request when urgent request
+ * processing in progress and current request is
+ * not urgent (all existing requests completed
+ * or reinserted to the block layer
+ */
mq->mqrq_cur->brq.mrq.data = NULL;
mq->mqrq_cur->req = NULL;
}
@@ -98,6 +106,7 @@
break;
}
mmc_start_delayed_bkops(card);
+ mq->card->host->context_info.is_urgent = false;
up(&mq->thread_sem);
schedule();
down(&mq->thread_sem);
@@ -172,7 +181,7 @@
spin_lock_irqsave(&cntx->lock, flags);
/* do stop flow only when mmc thread is waiting for done */
- if (cntx->is_waiting) {
+ if (mq->mqrq_cur->req || mq->mqrq_prev->req) {
/*
* Urgent request must be executed alone
* so disable the write packing