mmc: block: Add write packing control
Subsystems (3)
v3 cover mmc: block: Add write packing control
Our experiments showed that the write packing causes degradation of the read throughput, in parallel read and write operations.
Since the read latency is critical for user experience we added a write packing control mechanism that disables the write packing in case of read requests.
This will ensure that read requests latency is not increased due to long write packed commands.
The trigger for enabling the write packing is managing to pack several write requests. The number of potential packed requests that will trigger the packing can be configured via sysfs. The trigger for disabling the write packing is a fetch of a read request.
this patch is dependant in the following patches:
[PATCH v7 1/3] mmc: core: Add packed command feature of eMMC4.5 [PATCH v7 2/3] mmc: core: Support packed write command for eMMC4.5 device
Changes in v3:
- Fix the settings of num_of_potential_packed_wr_reqs
Changes in v2:
- Move the attribute for setting the packing enabling trigger to the block device
- Add documentation of the new attribute
Maya Erez (1):
mmc: block: Add write packing control
Documentation/mmc/mmc-dev-attrs.txt | 17 ++++++ drivers/mmc/card/block.c | 101 ++++++++++++++++++++++++++++++++++- drivers/mmc/card/queue.c | 8 +++ drivers/mmc/card/queue.h | 3 + include/linux/mmc/host.h | 1 + 5 files changed, 129 insertions(+), 1 deletions(-)
Signature · 4 lines
1.7.3.3 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH v3 1/1 mmc: block: Add write packing control
The write packing control will ensure that read requests latency is not increased due to long write packed commands.
The trigger for enabling the write packing is managing to pack several write requests. The number of potential packed requests that will trigger the packing can be configured via sysfs by writing the required value to:
/sys/block/<block_dev_name>/num_wr_reqs_to_start_packing.
The trigger for disabling the write packing is fetching a read request.
--- Documentation/mmc/mmc-dev-attrs.txt | 17 ++++++ drivers/mmc/card/block.c | 101 ++++++++++++++++++++++++++++++++++- drivers/mmc/card/queue.c | 8 +++ drivers/mmc/card/queue.h | 3 + include/linux/mmc/host.h | 1 + 5 files changed, 129 insertions(+), 1 deletions(-)
Documentation/mmc/mmc-dev-attrs.txt +17 -0
@@ -8,6 +8,23 @@ The following attributes are read/write. force_ro Enforce read-only access even if write protect switch is off. + num_wr_reqs_to_start_packing This attribute is used to determine + the trigger for activating the write packing, in case the write + packing control feature is enabled. + + When the MMC manages to reach a point where num_wr_reqs_to_start_packing + write requests could be packed, it enables the write packing feature. + This allows us to start the write packing only when it is beneficial + and has minimum affect on the read latency. + + The number of potential packed requests that will trigger the packing + can be configured via sysfs by writing the required value to: + /sys/block/<block_dev_name>/num_wr_reqs_to_start_packing. + + The default value of num_wr_reqs_to_start_packing was determined by + running parallel lmdd write and lmdd read operations and calculating + the max number of packed writes requests. + SD and MMC Device Attributes ============================
drivers/mmc/card/block.c +100 -1
149 lines not on this page · raw message
drivers/mmc/card/queue.c +8 -0
@@ -25,6 +25,13 @@#define MMC_QUEUE_SUSPENDED (1 << 0)/* +* Based on benchmark tests the default num of requests to trigger the write +* packing was determined, to keep the read latency as low as possible and +* manage to keep the high write throughput. +*/ +#define DEFAULT_NUM_REQS_TO_START_PACK 17 + +/* * Prepare a MMC request. This just filters out odd stuff. */ static int mmc_prep_request (struct request_queue *q,struct request *req)
@@ -181,6 +188,7 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, mq->mqrq_cur = mqrq_cur; mq->mqrq_prev = mqrq_prev; mq->queue->queuedata = mq; + mq->num_wr_reqs_to_start_packing =DEFAULT_NUM_REQS_TO_START_PACK ;blk_queue_prep_rq (mq->queue, mmc_prep_request);queue_flag_set_unlocked (QUEUE_FLAG_NONROT , mq->queue);
drivers/mmc/card/queue.h +3 -0
@@ -45,6 +45,9 @@ struct mmc_queue {struct mmc_queue_req mqrq[2 ];struct mmc_queue_req *mqrq_cur;struct mmc_queue_req *mqrq_prev; +bool wr_packing_enabled; +int num_of_potential_packed_wr_reqs; +int num_wr_reqs_to_start_packing; }; extern int mmc_init_queue(struct mmc_queue *, struct mmc_card *, spinlock_t *,
include/linux/mmc/host.h +1 -0
@@ -242,6 +242,7 @@ struct mmc_host {#define MMC_CAP2_PACKED_WR (1 << 11)/* Allow packed write */ #define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \ MMC_CAP2_PACKED_WR)/* Allow packed commands */ +#define MMC_CAP2_PACKED_WR_CONTROL (1 << 12)/* Allow write packing control */ mmc_pm_flag_t pm_caps;/* supported pm features */ unsigned int power_notify_type;
Signature · 4 lines
1.7.3.3 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.