Add support Weighted Round Robin for blkcg and nvme
Subsystems (4)
v5 cover Add support Weighted Round Robin for blkcg and nvme
Hi,
This series try to add Weighted Round Robin for block cgroup and nvme driver. When multiple containers share a single nvme device, we want to protect IO critical container from not be interfernced by other containers. We add blkio.wrr interface to user to control their IO priority. The blkio.wrr accept five level priorities, which contains "urgent", "high", "medium", "low" and "none", the "none" is used for disable WRR for this cgroup.
The first patch add an WRR infrastucture for block cgroup.
We add extra four hareware contexts at blk-mq layer, HCTX_TYPE_WRR_URGETN/HIGH/MEDIUM/LOW to allow device driver maps different hardsware queues to dirrenct hardware context.
The second patch add a nvme_ctrl_ops named get_ams to get the expect Arbitration Mechanism Selected, now this series only support nvme-pci. This operations will check both CAP.AMS and nvme-pci wrr queue count, to decide enable WRR or RR.
The third patch rename write_queues module parameter to read_queues, that can simplify the calculation the number of defaut,read,poll,wrr queue.
The last patch add support nvme-pci Weighted Round Robin with Urgent Priority Class, we add four module paranmeters as follow:
wrr_urgent_queues
wrr_high_queues
wrr_medium_queues
wrr_low_queues
nvme-pci will set CC.AMS=001b, if CAP.AMS[17]=1 and wrr_xxx_queues larger than 0. nvme driver will split hardware queues base on the read/pool/wrr_xxx_queues, then set proper value for Queue Priority (QPRIO) in DWORD11. This patch also extends IRQ_AFFINITY_MAX_SETS to 6, since nvme may use 6 irq sets, if read, default,wrr related queues are all not equal to 0.
fio test:
CPU: Intel(R) Xeon(R) Platinum 8160 CPU @ 2.10GHz
NVME: Intel SSDPE2KX020T8 P4510 2TB
[root@tmp-201812-d1802-818396173 low]# nvme show-regs /dev/nvme0n1
cap : 2078030fff
version : 10200
intms : 0
intmc : 0
cc : 460801 csts : 1 nssr : 0 aqa : 1f001f asq : 5f7cc08000 acq : 5f5ac23000 cmbloc : 0 cmbsz : 0
Run fio-1, fio-2, fio-3 in parallel,
For RR(round robin) these three fio nearly get same iops or bps, if we set blkio.wrr for different priority, the WRR "high" will get more iops/bps than "medium" and "low".
RR:
fio-1: echo "259:0 none" > /sys/fs/cgroup/blkio/high/blkio.wrr
fio-2: echo "259:0 none" > /sys/fs/cgroup/blkio/medium/blkio.wrr
fio-3: echo "259:0 none" > /sys/fs/cgroup/blkio/low/blkio.wrr
WRR:
fio-1: echo "259:0 high" > /sys/fs/cgroup/blkio/high/blkio.wrr
fio-2: echo "259:0 medium" > /sys/fs/cgroup/blkio/medium/blkio.wrr
fio-3: echo "259:0 low" > /sys/fs/cgroup/blkio/low/blkio.wrr
Test script:
https://github.com/dublio/nvme-wrr/blob/master/test_wrr.sh
Test result:
randread (RR)IOPS (RR)latency (WRR)IOPS (WRR)latency
--------------------------------------------------------------------------------
randread_high 217474 3528.49 404451 1897.17
randread_medium 217473 3528.56 202349 3793.54
randread_low 217978 3520.98 67419 11386.43
randwrite (RR)IOPS (RR)latency (WRR)IOPS (WRR)latency
--------------------------------------------------------------------------------
randwrite_high 144946 5295.34 277401 2766.66
randwrite_medium 144861 5296.85 138710 5532.28
randwrite_low 145105 5289.36 46316 16569.54
read (RR)BW (RR)latency (WRR)BW (WRR)latency
--------------------------------------------------------------------------------
read_high 956191 410823.48 1790273 219427.11
read_medium 920096 426887.25 897644 437760.17
read_low 928076 423248.05 302899 1297195.34
write (RR)BW (RR)latency (WRR)BW (WRR)latency
--------------------------------------------------------------------------------
write_high 737211 532359.31 1194013 328970.70
write_medium 759052 516902.66 600626 653876.69
write_low 782348 501309.47 203754 1928779.39Changes since V4:
* calculate the number of irq sets by the queue count of each HCTX type, and drops patch: genirq/affinity: allow driver's discontigous affinity set
* extends IRQ_AFFINITY_MAX_SETS to 6 instead of 7.
Changes since V3:
* only show blkio.wrr in non-root cgroups.
* give bs/iops and latency in test result.
Changes since V2:
* drop null_blk related patch, which adds a new NULL_Q_IRQ_WRR to simulte nvme wrr policy
* add urgent tagset map for nvme driver
* fix some problem in V2, suggested by Minwoo
Changes since V1:
* reorder HCTX_TYPE_POLL to the last one to adopt nvme driver easily.
* add support WRR(Weighted Round Robin) for nvme driver
Weiping Zhang (4):
block: add weighted round robin for blkcgroup
nvme: add get_ams for nvme_ctrl_ops
nvme-pci: rename module parameter write_queues to read_queues
nvme: add support weighted round robin queue
block/blk-cgroup.c | 91 ++++++++++++++++ block/blk-mq-debugfs.c | 4 + block/blk-mq-sched.c | 5 +- block/blk-mq-tag.c | 4 +- block/blk-mq-tag.h | 2 +- block/blk-mq.c | 12 ++- block/blk-mq.h | 20 +++- block/blk.h | 2 +- drivers/nvme/host/core.c | 9 +- drivers/nvme/host/nvme.h | 2 + drivers/nvme/host/pci.c | 260 ++++++++++++++++++++++++++++++++++++--------- include/linux/blk-cgroup.h | 2 + include/linux/blk-mq.h | 18 ++++ include/linux/interrupt.h | 2 +- include/linux/nvme.h | 3 + 15 files changed, 375 insertions(+), 61 deletions(-)
Signature · 1 line
2.14.1
PATCH v5 1/4 block: add weighted round robin for blkcgroup
Each block cgroup can select a weighted round robin type to make its io requests go to the specified haredware queue. Now we support four round robin type urgent, high, medium, low like what nvme specification dose.
--- block/blk-cgroup.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++ block/blk-mq-debugfs.c | 4 ++ block/blk-mq-sched.c | 5 ++- block/blk-mq-tag.c | 4 +- block/blk-mq-tag.h | 2 +- block/blk-mq.c | 12 ++++-- block/blk-mq.h | 20 +++++++++- block/blk.h | 2 +- include/linux/blk-cgroup.h | 2 + include/linux/blk-mq.h | 18 +++++++++ 10 files changed, 150 insertions(+), 10 deletions(-)
block/blk-cgroup.c +91 -0
@@ -830,6 +830,91 @@ static int blkcg_print_stat(struct seq_file *sf, void *v)return 0 ; } +static const char *blk_wrr_name[BLK_WRR_COUNT ] = { + [BLK_WRR_NONE ] ="none" , + [BLK_WRR_LOW ] ="low" , + [BLK_WRR_MEDIUM ] ="medium" , + [BLK_WRR_HIGH ] ="high" , + [BLK_WRR_URGENT ] ="urgent" , +}; + +static inline const char *blk_wrr_to_name (int wrr) +{ +if (wrr <BLK_WRR_NONE || wrr >=BLK_WRR_COUNT ) +return "wrong" ; + +return blk_wrr_name[wrr]; +} + +static ssize_t blkcg_wrr_write (struct kernfs_open_file *of, +char *buf,size_t nbytes,loff_t off) +{ +struct blkcg *blkcg =css_to_blkcg (of_css (of)); +struct gendisk *disk; +struct request_queue *q; +struct blkcg_gq *blkg; +unsigned int major, minor; +int wrr, key_len, part, ret; +char *body; + +if (sscanf (buf,"%u:%u%n" , &major, &minor, &key_len) !=2 ) +return -EINVAL ; + + body = buf + key_len; +if (!isspace (*body)) +return -EINVAL ; + body =skip_spaces (body); + wrr =sysfs_match_string (blk_wrr_name, body); +if (wrr ==BLK_WRR_COUNT ) +return -EINVAL ; + + disk =get_gendisk (MKDEV (major, minor), &part); +if (!disk) +return -ENODEV ; +if (part) { + ret = -EINVAL ; + goto fail; + } + + q = disk->queue; + + blkg =blkg_lookup_create (blkcg, q); + +atomic_set (&blkg->wrr, wrr); +put_disk_and_module (disk); + +return nbytes; +fail: +put_disk_and_module (disk); +return ret; +} + +static int blkcg_wrr_show (struct seq_file *sf,void *v) +{ +struct blkcg *blkcg =css_to_blkcg (seq_css (sf)); +struct blkcg_gq *blkg; + +rcu_read_lock (); + +hlist_for_each_entry_rcu (blkg, &blkcg->blkg_list, blkcg_node) { +const char *dname; +char *buf; +size_t size =seq_get_buf (sf, &buf), off =0 ; + + dname =blkg_dev_name (blkg); +if (!dname) +continue ; + + off +=scnprintf (buf+off, size-off,"%s %s\n" , dname, +blk_wrr_to_name (atomic_read (&blkg->wrr))); +seq_commit (sf, off); + } + +rcu_read_unlock (); +return 0 ; +} + +static struct cftype blkcg_files[] = { { .name ="stat" ,
@@ -844,6 +929,12 @@ static struct cftype blkcg_legacy_files[] = { .name = "reset_stats", .write_u64 = blkcg_reset_stats, }, + { + .name = "wrr", + .flags = CFTYPE_NOT_ON_ROOT, + .write = blkcg_wrr_write, + .seq_show = blkcg_wrr_show, + }, { }/* terminate */ };
block/blk-mq-debugfs.c +4 -0
@@ -420,6 +420,10 @@ static int hctx_busy_show(void *data, struct seq_file *m)static const char *const hctx_types[] = { [HCTX_TYPE_DEFAULT ] ="default" , [HCTX_TYPE_READ ] ="read" , + [HCTX_TYPE_WRR_LOW ] ="wrr_low" , + [HCTX_TYPE_WRR_MEDIUM ] ="wrr_medium" , + [HCTX_TYPE_WRR_HIGH ] ="wrr_high" , + [HCTX_TYPE_WRR_URGENT ] ="wrr_urgent" , [HCTX_TYPE_POLL ] ="poll" , };
block/blk-mq-sched.c +4 -1
@@ -7,6 +7,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/blk-mq.h> +#include <linux/blk-cgroup.h> #include <trace/events/block.h>
@@ -326,7 +327,9 @@ bool __blk_mq_sched_bio_merge(struct request_queue *q, struct bio *bio, {struct elevator_queue *e = q->elevator;struct blk_mq_ctx *ctx =blk_mq_get_ctx (q); -struct blk_mq_hw_ctx *hctx =blk_mq_map_queue (q, bio->bi_opf, ctx); +struct blkcg_gq *blkg = bio->bi_blkg; +int wrr = blkg ?atomic_read (&blkg->wrr) :BLK_WRR_NONE ; +struct blk_mq_hw_ctx *hctx =blk_mq_map_queue (q, bio->bi_opf, ctx, wrr);bool ret = false;enum hctx_type type;
block/blk-mq-tag.c +2 -2
@@ -99,7 +99,7 @@ static int __blk_mq_get_tag(struct blk_mq_alloc_data *data,return __sbitmap_queue_get (bt); } -unsigned int blk_mq_get_tag (struct blk_mq_alloc_data *data) +unsigned int blk_mq_get_tag (struct blk_mq_alloc_data *data,int wrr) {struct blk_mq_tags *tags =blk_mq_tags_from_data (data);struct sbitmap_queue *bt;
@@ -159,7 +159,7 @@ unsigned int blk_mq_get_tag(struct blk_mq_alloc_data *data) data->ctx =blk_mq_get_ctx (data->q); data->hctx =blk_mq_map_queue (data->q, data->cmd_flags, - data->ctx); + data->ctx, wrr); tags =blk_mq_tags_from_data (data);if (data->flags &BLK_MQ_REQ_RESERVED ) bt = &tags->breserved_tags;
block/blk-mq-tag.h +1 -1
@@ -25,7 +25,7 @@ struct blk_mq_tags {extern struct blk_mq_tags *blk_mq_init_tags (unsigned int nr_tags,unsigned int reserved_tags,int node,int alloc_policy);extern void blk_mq_free_tags (struct blk_mq_tags *tags); -extern unsigned int blk_mq_get_tag (struct blk_mq_alloc_data *data); +extern unsigned int blk_mq_get_tag (struct blk_mq_alloc_data *data,int wrr);extern void blk_mq_put_tag (struct blk_mq_hw_ctx *hctx,struct blk_mq_tags *tags,struct blk_mq_ctx *ctx,unsigned int tag); extern int blk_mq_tag_update_depth(struct blk_mq_hw_ctx *hctx,
block/blk-mq.c +9 -3
@@ -340,6 +340,12 @@ static struct request *blk_mq_get_request(struct request_queue *q,unsigned int tag;bool clear_ctx_on_error = false;u64 alloc_time_ns =0 ; +int wrr; + +if (bio && bio->bi_blkg) + wrr =atomic_read (&bio->bi_blkg->wrr); +else + wrr =BLK_WRR_NONE ;blk_queue_enter_live (q);
@@ -354,7 +360,7 @@ static struct request *blk_mq_get_request(struct request_queue *q, }if (likely (!data->hctx)) data->hctx =blk_mq_map_queue (q, data->cmd_flags, - data->ctx); + data->ctx, wrr);if (data->cmd_flags &REQ_NOWAIT ) data->flags |=BLK_MQ_REQ_NOWAIT ;
@@ -374,7 +380,7 @@ static struct request *blk_mq_get_request(struct request_queue *q,blk_mq_tag_busy (data->hctx); } - tag =blk_mq_get_tag (data); + tag =blk_mq_get_tag (data, wrr);if (tag ==BLK_MQ_TAG_FAIL ) {if (clear_ctx_on_error) data->ctx =NULL ;
@@ -1044,7 +1050,7 @@ bool blk_mq_get_driver_tag(struct request *rq) data.flags |=BLK_MQ_REQ_RESERVED ; shared =blk_mq_tag_busy (data.hctx); - rq->tag =blk_mq_get_tag (&data); + rq->tag =blk_mq_get_tag (&data,BLK_WRR_NONE );if (rq->tag >=0 ) {if (shared) { rq->rq_flags |=RQF_MQ_INFLIGHT ;
block/blk-mq.h +18 -2
@@ -101,7 +101,8 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue_type(struct request_queue **/ static inline struct blk_mq_hw_ctx *blk_mq_map_queue (struct request_queue *q,unsigned int flags, -struct blk_mq_ctx *ctx) +struct blk_mq_ctx *ctx, +int wrr) {enum hctx_type type =HCTX_TYPE_DEFAULT ;
@@ -110,7 +111,22 @@ static inline struct blk_mq_hw_ctx *blk_mq_map_queue(struct request_queue *q,*/ if (flags &REQ_HIPRI ) type =HCTX_TYPE_POLL ; -else if ((flags &REQ_OP_MASK ) ==REQ_OP_READ ) +else if (wrr >BLK_WRR_NONE && wrr <BLK_WRR_COUNT ) { +switch (wrr) { +case BLK_WRR_LOW : + type =HCTX_TYPE_WRR_LOW ; +break ; +case BLK_WRR_MEDIUM : + type =HCTX_TYPE_WRR_MEDIUM ; +break ; +case BLK_WRR_HIGH : + type =HCTX_TYPE_WRR_HIGH ; +break ; +default : + type =HCTX_TYPE_WRR_URGENT ; +break ; + } + }else if ((flags &REQ_OP_MASK ) ==REQ_OP_READ ) type =HCTX_TYPE_READ ;return ctx->hctxs[type];
block/blk.h +1 -1
@@ -40,7 +40,7 @@ extern struct ida blk_queue_ida;static inline struct blk_flush_queue *blk_get_flush_queue (struct request_queue *q,struct blk_mq_ctx *ctx) { -return blk_mq_map_queue (q,REQ_OP_FLUSH , ctx)->fq; +return blk_mq_map_queue (q,REQ_OP_FLUSH , ctx,BLK_WRR_NONE )->fq; }static inline void __blk_get_queue (struct request_queue *q)
include/linux/blk-cgroup.h +2 -0
@@ -138,6 +138,8 @@ struct blkcg_gq {atomic64_t delay_start;u64 last_delay;int last_use; +/* weighted round robin */ +atomic_t wrr;struct rcu_head rcu_head; };
include/linux/blk-mq.h +18 -0
@@ -193,17 +193,35 @@ struct blk_mq_queue_map {* enum hctx_type - Type of hardware queue * @HCTX_TYPE_DEFAULT: All I/O not otherwise accounted for. * @HCTX_TYPE_READ: Just for READ I/O. +* @HCTX_TYPE_WRR_LOW: Weighted Round Robin low priority, when I/O is not polled. +* @HCTX_TYPE_WRR_MEDIUM: Weighted Round Robin medium priority, when I/O is not polled. +* @HCTX_TYPE_WRR_HIGH: Weighted Round Robin high priority, when I/O is not polled. +* @HCTX_TYPE_WRR_URGENT: Weighted Round Robin urgent priority, when I/O is not polled. * @HCTX_TYPE_POLL: Polled I/O of any kind. * @HCTX_MAX_TYPES: Number of types of hctx. */ enum hctx_type {HCTX_TYPE_DEFAULT ,HCTX_TYPE_READ , +HCTX_TYPE_WRR_LOW , +HCTX_TYPE_WRR_MEDIUM , +HCTX_TYPE_WRR_HIGH , +HCTX_TYPE_WRR_URGENT ,HCTX_TYPE_POLL ,HCTX_MAX_TYPES , }; +enum blk_wrr { +BLK_WRR_NONE , +BLK_WRR_LOW , +BLK_WRR_MEDIUM , +BLK_WRR_HIGH , +BLK_WRR_URGENT , + +BLK_WRR_COUNT , +}; +/** * struct blk_mq_tag_set - tag set that can be shared between request queues * @map: One or more ctx -> hctx mappings. One map exists for each
Signature · 1 line
2.14.1
PATCH v5 2/4 nvme: add get_ams for nvme_ctrl_ops
In reply to Weiping ZhangThe get_ams() will return the AMS(Arbitration Mechanism Selected) from the driver.
--- drivers/nvme/host/core.c | 9 ++++++++- drivers/nvme/host/nvme.h | 1 + drivers/nvme/host/pci.c | 6 ++++++ include/linux/nvme.h | 1 + 4 files changed, 16 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +8 -1
@@ -2119,6 +2119,7 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl)*/ unsigned dev_page_min, page_shift =12 ;int ret; +u32 ams =NVME_CC_AMS_RR ; ret = ctrl->ops->reg_read64 (ctrl,NVME_REG_CAP , &ctrl->cap);if (ret) {
@@ -2134,11 +2135,17 @@ int nvme_enable_ctrl(struct nvme_ctrl *ctrl)return -ENODEV ; } +/* get Arbitration Mechanism Selected */ +if (ctrl->ops->get_ams) { + ctrl->ops->get_ams (ctrl, &ams); + ams &=NVME_CC_AMS_MASK ; + } + ctrl->page_size =1 << page_shift; ctrl->ctrl_config =NVME_CC_CSS_NVM ; ctrl->ctrl_config |= (page_shift -12 ) <<NVME_CC_MPS_SHIFT ; - ctrl->ctrl_config |=NVME_CC_AMS_RR |NVME_CC_SHN_NONE ; + ctrl->ctrl_config |= ams |NVME_CC_SHN_NONE ; ctrl->ctrl_config |=NVME_CC_IOSQES |NVME_CC_IOCQES ; ctrl->ctrl_config |=NVME_CC_ENABLE ;
drivers/nvme/host/nvme.h +1 -0
@@ -407,6 +407,7 @@ struct nvme_ctrl_ops {void (*submit_async_event)(struct nvme_ctrl *ctrl);void (*delete_ctrl)(struct nvme_ctrl *ctrl);int (*get_address)(struct nvme_ctrl *ctrl,char *buf,int size); +void (*get_ams)(struct nvme_ctrl *ctrl,u32 *ams); };#ifdef CONFIG_FAULT_INJECTION_DEBUG_FS
drivers/nvme/host/pci.c +6 -0
@@ -2688,6 +2688,11 @@ static int nvme_pci_get_address(struct nvme_ctrl *ctrl, char *buf, int size)return snprintf (buf, size,"%s" ,dev_name (&pdev->dev)); } +static void nvme_pci_get_ams (struct nvme_ctrl *ctrl,u32 *ams) +{ + *ams =NVME_CC_AMS_RR ; +} +static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = { .name ="pcie" , .module =THIS_MODULE ,
@@ -2699,6 +2704,7 @@ static const struct nvme_ctrl_ops nvme_pci_ctrl_ops = { .free_ctrl = nvme_pci_free_ctrl, .submit_async_event = nvme_pci_submit_async_event, .get_address = nvme_pci_get_address, + .get_ams = nvme_pci_get_ams, };static int nvme_dev_map (struct nvme_dev *dev)
include/linux/nvme.h +1 -0
@@ -171,6 +171,7 @@ enum {NVME_CC_AMS_RR =0 <<NVME_CC_AMS_SHIFT ,NVME_CC_AMS_WRRU =1 <<NVME_CC_AMS_SHIFT ,NVME_CC_AMS_VS =7 <<NVME_CC_AMS_SHIFT , +NVME_CC_AMS_MASK =7 <<NVME_CC_AMS_SHIFT ,NVME_CC_SHN_NONE =0 <<NVME_CC_SHN_SHIFT ,NVME_CC_SHN_NORMAL =1 <<NVME_CC_SHN_SHIFT , NVME_CC_SHN_ABRUPT = 2 << NVME_CC_SHN_SHIFT,
Signature · 1 line
2.14.1
PATCH v5 3/4 nvme-pci: rename module parameter write_queues to read_queues
In reply to Weiping ZhangNow nvme support three type hardware queues, read, poll and default, this patch rename write_queues to read_queues to set the number of read queues more explicitly. This patch alos is prepared for nvme support WRR(weighted round robin) that we can get the number of each queue type easily.
--- drivers/nvme/host/pci.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/nvme/host/pci.c +11 -13
@@ -68,10 +68,10 @@ static int io_queue_depth = 1024;module_param_cb (io_queue_depth, &io_queue_depth_ops, &io_queue_depth,0644 );MODULE_PARM_DESC (io_queue_depth,"set io queue depth, should >= 2" ); -static unsigned int write_queues; -module_param (write_queues, uint,0644 ); -MODULE_PARM_DESC (write_queues, -"Number of queues to use for writes. If not set, reads and writes " +static unsigned int read_queues; +module_param (read_queues, uint,0644 ); +MODULE_PARM_DESC (read_queues, +"Number of queues to use for read. If not set, reads and writes " "will share a queue set." );static unsigned int poll_queues;
@@ -211,7 +211,7 @@ struct nvme_iod {static unsigned int max_io_queues (void ) { -return num_possible_cpus () + write_queues + poll_queues; +return num_possible_cpus () + read_queues + poll_queues; }static unsigned int max_queue_count (void )
@@ -2016,18 +2016,16 @@ static void nvme_calc_irq_sets(struct irq_affinity *affd, unsigned int nrirqs)* If only one interrupt is available or 'write_queue' == 0, combine * write and read queues. * -* If 'write_queues' > 0, ensure it leaves room for at least one read +* If 'read_queues' > 0, ensure it leaves room for at least one write * queue. */ -if (!nrirqs) { +if (!nrirqs || nrirqs ==1 ) { nrirqs =1 ; nr_read_queues =0 ; - }else if (nrirqs ==1 || !write_queues) { - nr_read_queues =0 ; - }else if (write_queues >= nrirqs) { - nr_read_queues =1 ; + }else if (read_queues >= nrirqs) { + nr_read_queues = nrirqs -1 ; }else { - nr_read_queues = nrirqs - write_queues; + nr_read_queues = read_queues; } dev->io_queues[HCTX_TYPE_DEFAULT ] = nrirqs - nr_read_queues;
@@ -3143,7 +3141,7 @@ static int __init nvme_init(void)BUILD_BUG_ON (sizeof (struct nvme_delete_queue ) !=64 );BUILD_BUG_ON (IRQ_AFFINITY_MAX_SETS <2 ); - write_queues =min (write_queues,num_possible_cpus ()); + read_queues =min (read_queues,num_possible_cpus ()); poll_queues =min (poll_queues,num_possible_cpus ());return pci_register_driver (&nvme_driver); }
Signature · 1 line
2.14.1
PATCH v5 4/4 nvme: add support weighted round robin queue
In reply to Weiping ZhangThis patch enalbe Weithed Round Robin if nvme device support it. We add four module parameters wrr_urgent_queues, wrr_high_queeus, wrr_medium_queues, wrr_low_queues to control the number of queues for specified priority. If device doesn't support WRR, all these four parameters will be forced reset to 0. If device support WRR, but all of these four parameters are 0, nvme dirver will not enable WRR when set CC.EN to 1.
Now nvme support five types hardware queue:
poll: if io was marked for pollwrr_low: weighted round robin lowwrr_medium: weighted round robin mediumwrr_high: weighted round robin highwrr_urgent: weighted round robin urgent
read: io read, if blkcg's wrr is none and the io is not poll
defaut: for write/flush, if blkcg's wrr is none and is not poll
The read, default and poll submission queue's priority is medium, when nvme's wrr was enabled.
Test result:
CPU: Intel(R) Xeon(R) Platinum 8160 CPU @ 2.10GHz NVME: Intel SSDPE2KX020T8 P4510 2TB
[root@tmp-201812-d1802-818396173 low]# nvme show-regs /dev/nvme0n1
cap : 2078030fff
version : 10200
intms : 0
intmc : 0
cc : 460801 csts : 1 nssr : 0 aqa : 1f001f asq : 5f7cc08000 acq : 5f5ac23000 cmbloc : 0 cmbsz : 0
Run fio-1, fio-2, fio-3 in parallel,
For RR(round robin) these three fio nearly get same iops or bps, if we set blkio.wrr for different priority, the WRR "high" will get more iops/bps than "medium" and "low".
RR:
fio-1: echo "259:0 none" > /sys/fs/cgroup/blkio/high/blkio.wrr
fio-2: echo "259:0 none" > /sys/fs/cgroup/blkio/medium/blkio.wrr
fio-3: echo "259:0 none" > /sys/fs/cgroup/blkio/low/blkio.wrr
WRR:
fio-1: echo "259:0 high" > /sys/fs/cgroup/blkio/high/blkio.wrr
fio-2: echo "259:0 medium" > /sys/fs/cgroup/blkio/medium/blkio.wrr
fio-3: echo "259:0 low" > /sys/fs/cgroup/blkio/low/blkio.wrr
Test script:
https://github.com/dublio/nvme-wrr
Test result:
randread (RR)IOPS (RR)latency (WRR)IOPS (WRR)latency
--------------------------------------------------------------------------------
randread_high 217474 3528.49 404451 1897.17 randread_medium 217473 3528.56 202349 3793.54 randread_low 217978 3520.98 67419 11386.43
randwrite (RR)IOPS (RR)latency (WRR)IOPS (WRR)latency
--------------------------------------------------------------------------------
randwrite_high 144946 5295.34 277401 2766.66 randwrite_medium 144861 5296.85 138710 5532.28 randwrite_low 145105 5289.36 46316 16569.54
read (RR)BW (RR)latency (WRR)BW (WRR)latency
--------------------------------------------------------------------------------
read_high 956191 410823.48 1790273 219427.11 read_medium 920096 426887.25 897644 437760.17 read_low 928076 423248.05 302899 1297195.34
write (RR)BW (RR)latency (WRR)BW (WRR)latency
--------------------------------------------------------------------------------
write_high 737211 532359.31 1194013 328970.70 write_medium 759052 516902.66 600626 653876.69 write_low 782348 501309.47 203754 1928779.39
--- drivers/nvme/host/nvme.h | 1 + drivers/nvme/host/pci.c | 240 ++++++++++++++++++++++++++++++++++++++-------- include/linux/interrupt.h | 2 +- include/linux/nvme.h | 2 + 4 files changed, 203 insertions(+), 42 deletions(-)
drivers/nvme/host/nvme.h +1 -0
@@ -250,6 +250,7 @@ struct nvme_ctrl {unsigned int shutdown_timeout;unsigned int kato;bool subsystem; +bool wrr_enabled;unsigned long quirks;struct nvme_id_power_state psd[32 ];struct nvme_effects_log *effects;
drivers/nvme/host/pci.c +199 -41
331 lines not on this page · raw message
include/linux/interrupt.h +1 -1
@@ -273,7 +273,7 @@ struct irq_affinity_notify {void (*release)(struct kref *ref); }; -#define IRQ_AFFINITY_MAX_SETS 4 +#define IRQ_AFFINITY_MAX_SETS 6/** * struct irq_affinity - Description for automatic irq affinity assignements
include/linux/nvme.h +2 -0
@@ -127,6 +127,7 @@ enum { };#define NVME_CAP_MQES (cap) ((cap) & 0xffff) +#define NVME_CAP_AMS_WRRU (cap) ((cap) & (1 << 17))#define NVME_CAP_TIMEOUT (cap) (((cap) >> 24) & 0xff)#define NVME_CAP_STRIDE (cap) (((cap) >> 32) & 0xf)#define NVME_CAP_NSSRC (cap) (((cap) >> 36) & 0x1)
@@ -895,6 +896,7 @@ enum {NVME_SQ_PRIO_HIGH = (1 <<1 ),NVME_SQ_PRIO_MEDIUM = (2 <<1 ),NVME_SQ_PRIO_LOW = (3 <<1 ), +NVME_SQ_PRIO_IGNORE =NVME_SQ_PRIO_URGENT ,NVME_FEAT_ARBITRATION =0x01 ,NVME_FEAT_POWER_MGMT =0x02 , NVME_FEAT_LBA_RANGE = 0x03,
Signature · 1 line
2.14.1
Keith Busch
maintainerQuoted 7 lines · Weiping Zhang
This series try to add Weighted Round Robin for block cgroup and nvme driver. When multiple containers share a single nvme device, we want to protect IO critical container from not be interfernced by other containers. We add blkio.wrr interface to user to control their IO priority. The blkio.wrr accept five level priorities, which contains "urgent", "high", "medium", "low" and "none", the "none" is used for disable WRR for this cgroup.
The NVMe protocol really doesn't define WRR to be a mechanism to mitigate interference, though. It defines credits among the weighted queues only for command fetching, and an urgent strict priority class that starves the rest. It has nothing to do with how the controller should prioritize completion of those commands, even if it may be reasonable to assume influencing when the command is fetched should affect its completion.
On the "weighted" strict priority, there's nothing separating "high" from "low" other than the name: the "set features" credit assignment can invert which queues have higher command fetch rates such that the "low" is favoured over the "high".
There's no protection against the "urgent" class starving others: normal IO will timeout and trigger repeated controller resets, while polled IO will consume 100% of CPU cycles without making any progress if we make this type of queue available without any additional code to ensure the host behaves..
On the driver implementation, the number of module parameters being added here is problematic. We already have 2 special classes of queues, and defining this at the module level is considered too coarse when the system has different devices on opposite ends of the capability spectrum. For example, users want polled queues for the fast devices, and none for the slower tier. We just don't have a good mechanism to define per-controller resources, and more queue classes will make this problem worse.
On the blk-mq side, this implementation doesn't work with the IO schedulers. If one is in use, requests may be reordered such that a request on your high-priority hctx may be dispatched later than more recent ones associated with lower priority. I don't think that's what you'd want to happen, so priority should be considered with schedulers too.
But really, though, NVMe's WRR is too heavy weight and difficult to use. The techincal work group can come up with something better, but it looks like they've lost interest in TPAR 4011 (no discussion in 2 years, afaics).
Quoted 10 lines · Keith Busch <[email protected]> 于2020年2月4日周二…
Quoted 7 lines · Weiping Zhang
This series try to add Weighted Round Robin for block cgroup and nvme driver. When multiple containers share a single nvme device, we want to protect IO critical container from not be interfernced by other containers. We add blkio.wrr interface to user to control their IO priority. The blkio.wrr accept five level priorities, which contains "urgent", "high", "medium", "low" and "none", the "none" is used for disable WRR for this cgroup.
Hi Bush,
Quoted 8 lines
The NVMe protocol really doesn't define WRR to be a mechanism to mitigate interference, though. It defines credits among the weighted queues only for command fetching, and an urgent strict priority class that starves the rest. It has nothing to do with how the controller should prioritize completion of those commands, even if it may be reasonable to assume influencing when the command is fetched should affect its completion.
Thanks your feedback, the fio test result on WRR shows that, the high-wrr-fio get more bandwidth/iops and low latency. I think it's a good feature for the case
that run multiple workload with different priority, especially for container colocation.
Quoted 5 lines
On the "weighted" strict priority, there's nothing separating "high" from "low" other than the name: the "set features" credit assignment can invert which queues have higher command fetch rates such that the "low" is favoured over the "high".
If there is no limitation in the hardware controller, we can add more checking in
"set feature command". I think mostly people won't give "low" more credits than "high",
it really does not make sense.
Quoted 6 lines
There's no protection against the "urgent" class starving others: normal IO will timeout and trigger repeated controller resets, while polled IO will consume 100% of CPU cycles without making any progress if we make this type of queue available without any additional code to ensure the host behaves..
I think we can just disable it in the software layer , actually, I have no real application need this.
Quoted 9 lines
On the driver implementation, the number of module parameters being added here is problematic. We already have 2 special classes of queues, and defining this at the module level is considered too coarse when the system has different devices on opposite ends of the capability spectrum. For example, users want polled queues for the fast devices, and none for the slower tier. We just don't have a good mechanism to define per-controller resources, and more queue classes will make this problem worse.
We can add a new "string" module parameter, which contains a model number, in most cases, the save product with a common prefix model number, so in this way
nvme can distinguish the different performance devices(hign or low end). Before create io queue, nvme driver can get the device's Model number(40 Bytes), then nvme driver can compare device's model number with module parameter, to decide how many io queues for each disk;
/* if model_number is MODEL_ANY, these parameters will be applied to all nvme devices. */
char dev_io_queues[1024] = "model_number=MODEL_ANY, poll=0,read=0,wrr_low=0,wrr_medium=0,wrr_high=0,wrr_urgent=0"; /* these paramters only affect nvme disk whose model number is "XXX" */ char dev_io_queues[1024] = "model_number=XXX, poll=1,read=2,wrr_low=3,wrr_medium=4,wrr_high=5,wrr_urgent=0;";
struct dev_io_queues {
char model_number[40];
unsigned int poll;
unsgined int read;
unsigned int wrr_low;
unsigned int wrr_medium;
unsigned int wrr_high;
unsigned int wrr_urgent;
};We can use these two variable to store io queue configurations:
/* default values for the all disk, except whose model number is not in io_queues_cfg */
struct dev_io_queues io_queues_def = {};
/* user defined values for a specific model number */ struct dev_io_queues io_queues_cfg = {};
If we need multiple configurations( > 2), we can also extend dev_io_queues to support it.
Quoted 7 lines
On the blk-mq side, this implementation doesn't work with the IO schedulers. If one is in use, requests may be reordered such that a request on your high-priority hctx may be dispatched later than more recent ones associated with lower priority. I don't think that's what you'd want to happen, so priority should be considered with schedulers too.
Currently, nvme does not use io scheduler by defalut, if user want to make wrr compatible with io scheduler, we can add other patches to handle this.
Quoted 3 lines
But really, though, NVMe's WRR is too heavy weight and difficult to use. The techincal work group can come up with something better, but it looks like they've lost interest in TPAR 4011 (no discussion in 2 years, afaics).
For the test result, I think it's a useful feature.
It really gives high priority applications high iops/bandwith and low latency, and it makes software very thin and simple.
Quoted 41 lines
Quoted 9 lines
On the driver implementation, the number of module parameters being added here is problematic. We already have 2 special classes of queues, and defining this at the module level is considered too coarse when the system has different devices on opposite ends of the capability spectrum. For example, users want polled queues for the fast devices, and none for the slower tier. We just don't have a good mechanism to define per-controller resources, and more queue classes will make this problem worse.
We can add a new "string" module parameter, which contains a model number, in most cases, the save product with a common prefix model number, so in this way
nvme can distinguish the different performance devices(hign or low end). Before create io queue, nvme driver can get the device's Model number(40 Bytes), then nvme driver can compare device's model number with module parameter, to decide how many io queues for each disk;/* if
model_numberisMODEL_ANY, these parameters will be applied to all nvme devices. */
char dev_io_queues[1024] = "model_number=MODEL_ANY, poll=0,read=0,wrr_low=0,wrr_medium=0,wrr_high=0,wrr_urgent=0"; /* these paramters only affect nvme disk whose model number is "XXX" */ char dev_io_queues[1024] = "model_number=XXX, poll=1,read=2,wrr_low=3,wrr_medium=4,wrr_high=5,wrr_urgent=0;";struct dev_io_queues { char model_number[40]; unsigned int poll; unsgined int read; unsigned int wrr_low; unsigned int wrr_medium; unsigned int wrr_high; unsigned int wrr_urgent; };We can use these two variable to store io queue configurations:
/* default values for the all disk, except whose model number is not in
io_queues_cfg*/
structdev_io_queuesio_queues_def= {};
Quoted 6 lines
/* user defined values for a specific model number */ struct
dev_io_queuesio_queues_cfg= {};If we need multiple configurations( > 2), we can also extend
dev_io_queuesto support it.
Hi Maintainers,
If we add patch to support these queue count at controller level, instead moudle level,
shall we add WRR ?
Recently I do some cgroup io weight testing,
https://github.com/dublio/iotrack/wiki/cgroup-io-weight-test
I think a proper io weight policy
should consider high weight cgroup's iops, latency and also take whole disk's throughput
into account, that is to say, the policy should do more carfully trade off between cgroup's
IO performance and whole disk's throughput. I know one policy cannot do all things perfectly,
but from the test result nvme-wrr can work well.
From the following test result, nvme-wrr work well for both cgroup's latency, iops, and whole
disk's throughput.
Notes:
blk-iocost: only set qos.model, not set percentage latency.
nvme-wrr: set weight by:
h=64;m=32;l=8;ab=0; nvme set-feature /dev/nvme1n1 -f 1 -v $(printf
"0x%x\n" $(($ab<<0|$l<<8|$m<<16|$h<<24)))
echo "$major:$minor high" > /sys/fs/cgroup/test1/io.wrr echo "$major:$minor low" > /sys/fs/cgroup/test2/io.wrr
Randread vs Randread:
cgroup.test1.weight : cgroup.test2.weight = 8 : 1
high weight cgroup test1: randread, fio: numjobs=8, iodepth=32, bs=4K low weight cgroup test2: randread, fio: numjobs=8, iodepth=32, bs=4K
test case bw iops rd_avg_lat wr_avg_latrd_p99_lat wr_p99_lat
=======================================================================================bfq_test1 767226 191806 1333.30 0.00
536.00 0.00bfq_test2 94607 23651 10816.06 0.00
610.00 0.00iocost_test1 1457718 364429 701.76 0.00
1630.00 0.00iocost_test2 1466337 366584 697.62 0.00
1613.00 0.00none_test1 1456585 364146 702.22 0.00
1646.00 0.00none_test2 1463090 365772 699.12 0.00
1613.00 0.00wrr_test1 2635391 658847 387.94 0.00
1236.00 0.00wrr_test2 365428 91357 2801.00 0.00
5537.00 0.00
https://github.com/dublio/iotrack/wiki/cgroup-io-weight-test#215-summary-fio-output
Randread vs Seq Write:
cgroup.test1.weight : cgroup.test2.weight = 8 : 1
high weight cgroup test1: randread, fio: numjobs=8, iodepth=32, bs=4K low weight cgroup test2: seq write, fio: numjobs=1, iodepth=32, bs=256K
test case bw iops rd_avg_lat wr_avg_latrd_p99_lat wr_p99_lat
=======================================================================================
bfq_test1 814327 203581 1256.19 0.00 593.00 0.00
bfq_test2 104758 409 0.00 78196.32 0.00
1052770.00
iocost_test1 270467 67616 3784.02 0.00 9371.00 0.00
iocost_test2 1541575 6021 0.00 5313.02 0.00
6848.00
none_test1 271708 67927 3767.01 0.00 9502.00 0.00
none_test2 1541951 6023 0.00 5311.50 0.00
6848.00
wrr_test1 775005 193751 1320.17 0.00 4112.00 0.00
wrr_test2 1198319 4680 0.00 6835.30 0.00
8847.00https://github.com/dublio/iotrack/wiki/cgroup-io-weight-test#225-summary-fio-output
Thanks
Weiping
Quoted 107 lines
Il giorno 31 mar 2020, alle ore 08:17, Weiping Zhang <[email protected]> ha scritto:
Quoted 41 lines
Quoted 9 lines
On the driver implementation, the number of module parameters being added here is problematic. We already have 2 special classes of queues, and defining this at the module level is considered too coarse when the system has different devices on opposite ends of the capability spectrum. For example, users want polled queues for the fast devices, and none for the slower tier. We just don't have a good mechanism to define per-controller resources, and more queue classes will make this problem worse.
We can add a new "string" module parameter, which contains a model number, in most cases, the save product with a common prefix model number, so in this way
nvme can distinguish the different performance devices(hign or low end). Before create io queue, nvme driver can get the device's Model number(40 Bytes), then nvme driver can compare device's model number with module parameter, to decide how many io queues for each disk;/* if
model_numberisMODEL_ANY, these parameters will be applied to all nvme devices. */
char dev_io_queues[1024] = "model_number=MODEL_ANY, poll=0,read=0,wrr_low=0,wrr_medium=0,wrr_high=0,wrr_urgent=0"; /* these paramters only affect nvme disk whose model number is "XXX" */ char dev_io_queues[1024] = "model_number=XXX, poll=1,read=2,wrr_low=3,wrr_medium=4,wrr_high=5,wrr_urgent=0;";struct dev_io_queues { char model_number[40]; unsigned int poll; unsgined int read; unsigned int wrr_low; unsigned int wrr_medium; unsigned int wrr_high; unsigned int wrr_urgent; };We can use these two variable to store io queue configurations:
/* default values for the all disk, except whose model number is not in
io_queues_cfg*/
structdev_io_queuesio_queues_def= {};Quoted 6 lines
/* user defined values for a specific model number */ struct
dev_io_queuesio_queues_cfg= {};If we need multiple configurations( > 2), we can also extend
dev_io_queuesto support it.Hi Maintainers,
If we add patch to support these queue count at controller level, instead moudle level,
shall we add WRR ?Recently I do some cgroup io weight testing,
https://github.com/dublio/iotrack/wiki/cgroup-io-weight-test
I think a proper io weight policy
should consider high weight cgroup's iops, latency and also take whole disk's throughput
into account, that is to say, the policy should do more carfully trade off between cgroup's
IO performance and whole disk's throughput. I know one policy cannot do all things perfectly,
but from the test result nvme-wrr can work well.From the following test result, nvme-wrr work well for both cgroup's latency, iops, and whole
disk's throughput.Notes:
blk-iocost: only set qos.model, not set percentage latency.
nvme-wrr: set weight by:h=64;m=32;l=8;ab=0; nvme set-feature /dev/nvme1n1 -f 1 -v $(printf"0x%x\n" $(($ab<<0|$l<<8|$m<<16|$h<<24)))
echo "$major:$minor high" >/sys/fs/cgroup/test1/io.wrrecho "$major:$minor low" >/sys/fs/cgroup/test2/io.wrrRandread vs Randread:
cgroup.test1.weight : cgroup.test2.weight = 8 : 1
high weight cgroup test1: randread, fio: numjobs=8, iodepth=32, bs=4K low weight cgroup test2: randread, fio: numjobs=8, iodepth=32, bs=4Ktest case bw iops
rd_avg_latwr_avg_latrd_p99_latwr_p99_lat
=======================================================================================bfq_test1767226 191806 1333.30 0.00
536.00 0.00bfq_test294607 23651 10816.06 0.00
610.00 0.00iocost_test11457718 364429 701.76 0.00
1630.00 0.00iocost_test21466337 366584 697.62 0.00
1613.00 0.00none_test11456585 364146 702.22 0.00
1646.00 0.00none_test21463090 365772 699.12 0.00
1613.00 0.00wrr_test12635391 658847 387.94 0.00
1236.00 0.00wrr_test2365428 91357 2801.00 0.00
5537.00 0.00
Glad to see that BFQ meets weights. Sad to see how it is suffering in terms of IOPS on your system.
Good job with your scheduler!
However, as for I/O control, the hard-to-control cases are not the ones with constantly-full deep queues. BFQ complexity stems from the need to control also the tough cases. An example is sync I/O with I/O depth one against async I/O. On the other hand, those use cases may not be of interest for your scheduler.
Thanks,
Paolo
Quoted 26 lines
Randread vs Seq Write:
cgroup.test1.weight : cgroup.test2.weight = 8 : 1
high weight cgroup test1: randread, fio: numjobs=8, iodepth=32, bs=4K low weight cgroup test2: seq write, fio: numjobs=1, iodepth=32, bs=256Ktest case bw iops
rd_avg_latwr_avg_latrd_p99_latwr_p99_lat
=======================================================================================bfq_test1 814327 203581 1256.19 0.00 593.00 0.00 bfq_test2 104758 409 0.00 78196.32 0.00 1052770.00 iocost_test1 270467 67616 3784.02 0.00 9371.00 0.00 iocost_test2 1541575 6021 0.00 5313.02 0.00 6848.00 none_test1 271708 67927 3767.01 0.00 9502.00 0.00 none_test2 1541951 6023 0.00 5311.50 0.00 6848.00 wrr_test1 775005 193751 1320.17 0.00 4112.00 0.00 wrr_test2 1198319 4680 0.00 6835.30 0.00 8847.00https://github.com/dublio/iotrack/wiki/cgroup-io-weight-test#225-summary-fio-output
Thanks
Weiping
Tejun Heo
maintainerHello, Weiping.
Quoted 10 lines · Weiping Zhang
Recently I do some cgroup io weight testing,
https://github.com/dublio/iotrack/wiki/cgroup-io-weight-test
I think a proper io weight policy
should consider high weight cgroup's iops, latency and also take whole disk's throughput
into account, that is to say, the policy should do more carfully trade off between cgroup's
IO performance and whole disk's throughput. I know one policy cannot do all things perfectly,
but from the test result nvme-wrr can work well.
That's w/o iocost QoS targets configured, right? iocost should be able to achieve similar results as wrr with QoS configured.
Quoted 3 lines
From the following test result, nvme-wrr work well for both cgroup's latency, iops, and whole
disk's throughput.
As I wrote before, the issues I see with wrr are the followings.
* Hardware dependent. Some will work ok or even fantastic. Many others will do horribly.
* Lack of configuration granularity. We can't configure it granular enough to serve hierarchical configuration.
* Likely not a huge problem with the deep QD of nvmes but lack of queue depth control can lead to loss of latency control and thus loss of protection for low concurrency workloads when pitched against workloads which can saturate QD.
All that said, given the feature is available, I don't see any reason to not allow to use it, but I don't think it fits the cgroup interface model given the hardware dependency and coarse granularity. For these cases, I think the right thing to do is using cgroups to provide tagging information - ie. build a dedicated interface which takes cgroup fd or ino as the tag and associate configurations that way. There already are other use cases which use cgroup this way (e.g. perf).
Thanks.
Signature · 1 line
tejun
Quoted 15 lines · Tejun Heo <[email protected]> 于2020年3月31日周二 下午10:36写道:
Hello, Weiping.
Quoted 10 lines · Weiping Zhang
Recently I do some cgroup io weight testing,
https://github.com/dublio/iotrack/wiki/cgroup-io-weight-test
I think a proper io weight policy
should consider high weight cgroup's iops, latency and also take whole disk's throughput
into account, that is to say, the policy should do more carfully trade off between cgroup's
IO performance and whole disk's throughput. I know one policy cannot do all things perfectly,
but from the test result nvme-wrr can work well.
Quoted 3 lines
That's w/o iocost QoS targets configured, right? iocost should be able to achieve similar results as wrr with QoS configured.
Yes, I have not set Qos target.
Quoted 17 lines
Quoted 3 lines
From the following test result, nvme-wrr work well for both cgroup's latency, iops, and whole
disk's throughput.As I wrote before, the issues I see with wrr are the followings.
* Hardware dependent. Some will work ok or even fantastic. Many others will do horribly.
* Lack of configuration granularity. We can't configure it granular enough to serve hierarchical configuration.
* Likely not a huge problem with the deep QD of nvmes but lack of queue depth control can lead to loss of latency control and thus loss of protection for low concurrency workloads when pitched against workloads which can saturate QD.
Quoted 8 lines
All that said, given the feature is available, I don't see any reason to not allow to use it, but I don't think it fits the cgroup interface model given the hardware dependency and coarse granularity. For these cases, I think the right thing to do is using cgroups to provide tagging information - ie. build a dedicated interface which takes cgroup fd or ino as the tag and associate configurations that way. There already are other use cases which use cgroup this way (e.g. perf).
Do you means drop the "io.wrr" or "blkio.wrr" in cgroup, and use a dedicated interface
like /dev/xxx or /proc/xxx?
I see the perf code:
struct fd f = fdget(fd)
struct cgroup_subsys_state *css =
css_tryget_online_from_dir(f.file->f_path.dentry,
&perf_event_cgrp_subsys);
Looks can be applied to block cgroup in same way.
Thanks your help.
Tejun Heo
maintainerHello,
Quoted 3 lines · Weiping Zhang
Do you means drop the "io.wrr" or "blkio.wrr" in cgroup, and use a dedicated interface
like/dev/xxxor/proc/xxx?
Yes, something along that line. Given that it's nvme specific, it'd be best if the interface reflects that too - e.g. through a file under /sys/block/nvme*/device/. Jens, Christoph, what do you guys think?
Quoted 7 lines
I see the perf code:
struct fd f = fdget(fd)
structcgroup_subsys_state*css =
css_tryget_online_from_dir(f.file->f_path.dentry,&perf_event_cgrp_subsys);Looks can be applied to block cgroup in same way.
Yeah, either fd or ino can be used to identify a cgroup.
Thanks.
Signature · 1 line
tejun
Christoph Hellwig
maintainerQuoted 10 lines · Tejun Heo
Hello,
Quoted 3 lines · Weiping Zhang
Do you means drop the "io.wrr" or "blkio.wrr" in cgroup, and use a dedicated interface
like/dev/xxxor/proc/xxx?Yes, something along that line. Given that it's nvme specific, it'd be best if the interface reflects that too - e.g. through a file under
/sys/block/nvme*/device/. Jens, Christoph, what do you guys think?
I'm pretty sure I voiced my opinion before - I think the NVMe WRR queueing concept is completely broken and I do not thing we should support it at all.
Tejun Heo
maintainerQuoted 8 lines · Christoph Hellwig
Quoted 7 lines · Tejun Heo
Hello,
Quoted 3 lines · Weiping Zhang
Do you means drop the "io.wrr" or "blkio.wrr" in cgroup, and use a dedicated interface
like/dev/xxxor/proc/xxx?
Quoted 7 lines
Quoted 3 lines
Yes, something along that line. Given that it's nvme specific, it'd be best if the interface reflects that too - e.g. through a file under
/sys/block/nvme*/device/. Jens, Christoph, what do you guys think?I'm pretty sure I voiced my opinion before - I think the NVMe WRR queueing concept is completely broken and I do not thing we should support it at all.
Ah, okay, I completely forgot about that. I don't have a strong opinion either way.
Thanks.
Signature · 1 line
tejun
Quoted 9 lines · Christoph Hellwig <[email protected]> 于2020年3月31日周二 下午11:52写道:
Quoted 7 lines · Tejun Heo
Hello,
Quoted 3 lines · Weiping Zhang
Do you means drop the "io.wrr" or "blkio.wrr" in cgroup, and use a dedicated interface
like/dev/xxxor/proc/xxx?
Quoted 7 lines
Quoted 3 lines
Yes, something along that line. Given that it's nvme specific, it'd be best if the interface reflects that too - e.g. through a file under
/sys/block/nvme*/device/. Jens, Christoph, what do you guys think?I'm pretty sure I voiced my opinion before - I think the NVMe WRR queueing concept is completely broken and I do not thing we should support it at all.
Hi Christoph,
Would you like to share more detail about why NVMe WRR is broken?
Christoph Hellwig
maintainerQuoted 1 line · Weiping Zhang
Would you like to share more detail about why NVMe WRR is broken?
Because it only weights command fetching. It says absolutely nothing about command execution.
Quoted 6 lines · Christoph Hellwig <[email protected]> 于2020年4月1日周三 上午12:33写道:
Quoted 1 line · Weiping Zhang
Would you like to share more detail about why NVMe WRR is broken?
Because it only weights command fetching. It says absolutely nothing about command execution.
I know that different ssd vendor may have different implementation, even some device can work well, seems you have no plan support it. I drop this patchset.
@Tejun Heo @Keith Busch
Thanks all of you