Skip to content

Commit 34cdb84

Browse files
committed
SUNLIGHT: Stable 12/28/2023 - ANDROID
Description: - Stable 12/28/2023 - ANDROID Change-Id: I099a86ecfa99d71e03c0a56457fdca35ae0171a5 Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
2 parents c8f012f + c351de7 commit 34cdb84

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

drivers/mmc/core/queue.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,7 @@ static blk_status_t mmc_mq_queue_rq(struct blk_mq_hw_ctx *hctx,
260260
}
261261
break;
262262
case MMC_ISSUE_ASYNC:
263-
/*
264-
* For MMC host software queue, we only allow 2 requests in
265-
* flight to avoid a long latency.
266-
*/
267-
if (host->hsq_enabled && mq->in_flight[issue_type] > 2) {
263+
if (host->hsq_enabled && mq->in_flight[issue_type] > host->hsq_depth) {
268264
spin_unlock_irq(&mq->lock);
269265
return BLK_STS_RESOURCE;
270266
}

drivers/mmc/host/mmc_hsq.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,25 @@ static void mmc_hsq_retry_handler(struct work_struct *work)
2121
mmc->ops->request(mmc, hsq->mrq);
2222
}
2323

24+
static void mmc_hsq_modify_threshold(struct mmc_hsq *hsq)
25+
{
26+
struct mmc_host *mmc = hsq->mmc;
27+
struct mmc_request *mrq;
28+
unsigned int tag, need_change = 0;
29+
30+
mmc->hsq_depth = HSQ_NORMAL_DEPTH;
31+
for (tag = 0; tag < HSQ_NUM_SLOTS; tag++) {
32+
mrq = hsq->slot[tag].mrq;
33+
if (mrq && mrq->data &&
34+
(mrq->data->blksz * mrq->data->blocks == 4096) &&
35+
(mrq->data->flags & MMC_DATA_WRITE) &&
36+
(++need_change == 2)) {
37+
mmc->hsq_depth = HSQ_PERFORMANCE_DEPTH;
38+
break;
39+
}
40+
}
41+
}
42+
2443
static void mmc_hsq_pump_requests(struct mmc_hsq *hsq)
2544
{
2645
struct mmc_host *mmc = hsq->mmc;
@@ -42,6 +61,8 @@ static void mmc_hsq_pump_requests(struct mmc_hsq *hsq)
4261
return;
4362
}
4463

64+
mmc_hsq_modify_threshold(hsq);
65+
4566
slot = &hsq->slot[hsq->next_tag];
4667
hsq->mrq = slot->mrq;
4768
hsq->qcnt--;
@@ -337,6 +358,7 @@ int mmc_hsq_init(struct mmc_hsq *hsq, struct mmc_host *mmc)
337358
hsq->mmc = mmc;
338359
hsq->mmc->cqe_private = hsq;
339360
mmc->cqe_ops = &mmc_hsq_ops;
361+
mmc->hsq_depth = HSQ_NORMAL_DEPTH;
340362

341363
for (i = 0; i < HSQ_NUM_SLOTS; i++)
342364
hsq->tag_slot[i] = HSQ_INVALID_TAG;

drivers/mmc/host/mmc_hsq.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
#define HSQ_NUM_SLOTS 64
66
#define HSQ_INVALID_TAG HSQ_NUM_SLOTS
77

8+
/*
9+
* For MMC host software queue, we only allow 2 requests in
10+
* flight to avoid a long latency.
11+
*/
12+
#define HSQ_NORMAL_DEPTH 2
13+
/*
14+
* For 4k random writes, we allow hsq_depth to increase to 5
15+
* for better performance.
16+
*/
17+
#define HSQ_PERFORMANCE_DEPTH 5
18+
819
struct hsq_slot {
920
struct mmc_request *mrq;
1021
};

include/linux/mmc/host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ struct mmc_host {
526526

527527
/* Host Software Queue support */
528528
bool hsq_enabled;
529+
int hsq_depth;
529530

530531
u32 err_stats[MMC_ERR_MAX];
531532
unsigned long private[] ____cacheline_aligned;

0 commit comments

Comments
 (0)