Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: core: Allow dynamical updates of the number of requests for hsq

To allow dynamical updates of the current number of used in-flight
requests, let's move away from using a hard-coded value to a use a
corresponding variable in the struct mmc_host.

This can be valuable when optimizing for certain I/O request sequences, as
shown by subsequent changes.

Signed-off-by: Wenchao Chen <wenchao.chen@unisoc.com>
Link: https://lore.kernel.org/r/20230919074707.25517-2-wenchao.chen@unisoc.com
[Ulf: Re-wrote the commitmsg to clarify the change]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Wenchao Chen and committed by
Ulf Hansson
2e2b5479 d7133797

+9 -5
+1 -5
drivers/mmc/core/queue.c
··· 260 260 } 261 261 break; 262 262 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) { 268 264 spin_unlock_irq(&mq->lock); 269 265 return BLK_STS_RESOURCE; 270 266 }
+1
drivers/mmc/host/mmc_hsq.c
··· 337 337 hsq->mmc = mmc; 338 338 hsq->mmc->cqe_private = hsq; 339 339 mmc->cqe_ops = &mmc_hsq_ops; 340 + mmc->hsq_depth = HSQ_NORMAL_DEPTH; 340 341 341 342 for (i = 0; i < HSQ_NUM_SLOTS; i++) 342 343 hsq->tag_slot[i] = HSQ_INVALID_TAG;
+6
drivers/mmc/host/mmc_hsq.h
··· 5 5 #define HSQ_NUM_SLOTS 64 6 6 #define HSQ_INVALID_TAG HSQ_NUM_SLOTS 7 7 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 + 8 14 struct hsq_slot { 9 15 struct mmc_request *mrq; 10 16 };
+1
include/linux/mmc/host.h
··· 526 526 527 527 /* Host Software Queue support */ 528 528 bool hsq_enabled; 529 + int hsq_depth; 529 530 530 531 u32 err_stats[MMC_ERR_MAX]; 531 532 unsigned long private[] ____cacheline_aligned;