storage:rbd: make the size of request is equal to the, size of the object
Subsystems (2)
RFC PATCH 1/1 storage:rbd: make the size of request is equal to the, size of the object
From 6213215bd19926d1063d4e01a248107dab8a899b Mon Sep 17 00:00:00 2001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the object
ensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request, so the max size of request is 512k if the max segments of request is BLK_MAX_SEGMENTS.
--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/block/rbd.c +2 -0
@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );blk_queue_io_min (q, segment_size);blk_queue_io_opt (q, segment_size);
Ilya Dryomov
maintainerQuoted 24 lines · juncheng bai
From
6213215bd19926d1063d4e01a248107dab8a899bMon Sep 17 00:00:00 2001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request, so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +0
-0
drivers/block/rbd.c static int rbd_init_disk(struct rbd_device *rbd_dev) · line 3763
Quoted 7 lines
drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );blk_queue_io_min (q, segment_size);blk_queue_io_opt (q, segment_size);
I made a similar patch on Friday, investigating blk-mq plugging issue reported by Nick. My patch sets it to BIO_MAX_PAGES unconditionally - AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given that BIO_MAX_PAGES is 256, this gives is 1M direct I/Os.
Thanks,
Ilya
Quoted 31 lines · Ilya Dryomov
Quoted 29 lines · juncheng bai
From
6213215bd19926d1063d4e01a248107dab8a899bMon Sep 17 00:00:00 2001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request, so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );
Quoted 8 lines
drivers/block/rbd.c static int rbd_init_disk(struct rbd_device *rbd_dev) · line 3763
Quoted 2 lines
drivers/block/rbd.c +0
-0blk_queue_io_min (q, segment_size);blk_queue_io_opt (q, segment_size);I made a similar patch on Friday, investigating blk-mq plugging issue reported by Nick. My patch sets it to
BIO_MAX_PAGESunconditionally - AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given thatBIO_MAX_PAGESis 256, this gives is 1M direct I/Os.
Hi. For signal bio, the max number of bio_vec is BIO_MAX_PAGES, but a request can be merged from multiple bios. We can see the below function:ll_back_merge_fn, ll_front_merge_fn and etc.
And I test in kernel 3.18 use this patch, and do:
echo 4096 > /sys/block/rbd0/queue/max_sectors_kb
We use systemtap to trace the request size, It is upto 4M.
Thanks.
---------
juncheng bai
Quoted 9 lines
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ilya Dryomov
maintainerQuoted 47 lines · juncheng bai
Quoted 35 lines · Ilya Dryomov
Quoted 32 lines · juncheng bai
From
6213215bd19926d1063d4e01a248107dab8a899bMon Sep 17 00:00:00 2001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request, so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );blk_queue_io_min (q, segment_size);Quoted 8 lines
drivers/block/rbd.c static int rbd_init_disk(struct rbd_device *rbd_dev) · line 3763
Quoted 1 line
drivers/block/rbd.c +0
-0blk_queue_io_opt (q, segment_size);I made a similar patch on Friday, investigating blk-mq plugging issue reported by Nick. My patch sets it to
BIO_MAX_PAGESunconditionally - AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given thatBIO_MAX_PAGESis 256, this gives is 1M direct I/Os.
Quoted 6 lines
Hi. For signal bio, the max number of
bio_vecisBIO_MAX_PAGES, but a request can be merged from multiple bios. We can see the below function:ll_back_merge_fn,ll_front_merge_fnand etc.
And I test in kernel 3.18 use this patch, and do:
echo 4096 >/sys/block/rbd0/queue/max_sectors_kb
We use systemtap to trace the request size, It is upto 4M.
Kernel 3.18 is pre rbd blk-mq transition, which happened in 4.0. You should test whatever patches you have with at least 4.0.
Putting that aside, I must be missing something. You'll get 4M requests on 3.18 both with your patch and without it, the only difference would be the size of bios being merged - 512k vs 1M. Can you describe your test workload and provide before and after traces?
Thanks,
Ilya
Quoted 56 lines · Ilya Dryomov
Quoted 47 lines · juncheng bai
Quoted 35 lines · Ilya Dryomov
Quoted 32 lines · juncheng bai
From
6213215bd19926d1063d4e01a248107dab8a899bMon Sep 17 00:00:00 2001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request, so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );blk_queue_io_min (q, segment_size);Quoted 8 lines
drivers/block/rbd.c static int rbd_init_disk(struct rbd_device *rbd_dev) · line 3763
Quoted 1 line
drivers/block/rbd.c +0
-0blk_queue_io_opt (q, segment_size);I made a similar patch on Friday, investigating blk-mq plugging issue reported by Nick. My patch sets it to
BIO_MAX_PAGESunconditionally - AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given thatBIO_MAX_PAGESis 256, this gives is 1M direct I/Os.Quoted 6 lines
Hi. For signal bio, the max number of
bio_vecisBIO_MAX_PAGES, but a request can be merged from multiple bios. We can see the below function:ll_back_merge_fn,ll_front_merge_fnand etc.
And I test in kernel 3.18 use this patch, and do:
echo 4096 >/sys/block/rbd0/queue/max_sectors_kb
We use systemtap to trace the request size, It is upto 4M.
Quoted 8 lines
Kernel 3.18 is pre rbd blk-mq transition, which happened in 4.0. You should test whatever patches you have with at least 4.0.
Putting that aside, I must be missing something. You'll get 4M requests on 3.18 both with your patch and without it, the only difference would be the size of bios being merged - 512k vs 1M. Can you describe your test workload and provide before and after traces?
Hi. I update kernel version to 4.0.5. The test information as shown below:
The base information:
03:28:13-root@server-186:~$uname -r
4.0.5
My simple systemtap script:
probe module("rbd").function("rbd_img_request_create")
{
printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3));
}I use dd to execute the test case:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1 oflag=direct
Case one: Without patch
03:30:23-root@server-186:~$cat /sys/block/rbd0/queue/max_sectors_kb 4096
03:30:35-root@server-186:~$cat /sys/block/rbd0/queue/max_segments 128
The output of systemtap for nornal data:
offset:0 length:524288
offset:524288 length:524288
offset:1048576 length:524288
offset:1572864 length:524288
offset:2097152 length:524288
offset:2621440 length:524288
offset:3145728 length:524288
offset:3670016 length:524288
Case two:With patch
cat /sys/block/rbd0/queue/max_sectors_kb
4096
03:49:14-root@server-186:linux-4.0.5$cat /sys/block/rbd0/queue/max_segments 1024
The output of systemtap for nornal data:
offset:0 length:1048576
offset:1048576 length:1048576
offset:2097152 length:1048576
offset:3145728 length:1048576
According to the test, you are right.
Because the blk-mq doesn't use any scheduling policy. 03:52:13-root@server-186:linux-4.0.5$cat /sys/block/rbd0/queue/scheduler none
In previous versions of the kernel 4.0, the rbd use the defualt scheduler:cfq
So, I think that the blk-mq need to do more?
Quoted 4 lines
Thanks,
Ilya
Ilya Dryomov
maintainerQuoted 121 lines · juncheng bai
Quoted 64 lines · Ilya Dryomov
Quoted 53 lines · juncheng bai
Quoted 42 lines · Ilya Dryomov
Quoted 27 lines · juncheng bai
From
6213215bd19926d1063d4e01a248107dab8a899bMon Sep 17 00:00:00
2001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request, so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +0
-0drivers/block/rbd.c static int rbd_init_disk(struct rbd_device · line 3764
Quoted 8 lines
drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );blk_queue_io_min (q, segment_size);blk_queue_io_opt (q, segment_size);Quoted 5 lines
I made a similar patch on Friday, investigating blk-mq plugging issue reported by Nick. My patch sets it to
BIO_MAX_PAGESunconditionally - AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given thatBIO_MAX_PAGESis 256, this gives is 1M direct I/Os.Quoted 6 lines
Hi. For signal bio, the max number of
bio_vecisBIO_MAX_PAGES, but a request can be merged from multiple bios. We can see the below function:ll_back_merge_fn,ll_front_merge_fnand etc.
And I test in kernel 3.18 use this patch, and do:
echo 4096 >/sys/block/rbd0/queue/max_sectors_kb
We use systemtap to trace the request size, It is upto 4M.Quoted 8 lines
Kernel 3.18 is pre rbd blk-mq transition, which happened in 4.0. You should test whatever patches you have with at least 4.0.
Putting that aside, I must be missing something. You'll get 4M requests on 3.18 both with your patch and without it, the only difference would be the size of bios being merged - 512k vs 1M. Can you describe your test workload and provide before and after traces?
Hi. I update kernel version to 4.0.5. The test information as shown below:
The base information:
03:28:13-root@server-186:~$uname -r
4.0.5My simple systemtap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }I use dd to execute the test case:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1 oflag=directCase one: Without patch
03:30:23-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4096
03:30:35-root@server-186:~$cat/sys/block/rbd0/queue/max_segments128The output of systemtap for nornal data:
offset:0 length:524288
offset:524288 length:524288
offset:1048576 length:524288
offset:1572864 length:524288
offset:2097152 length:524288
offset:2621440 length:524288
offset:3145728 length:524288
offset:3670016 length:524288Case two:With patch
cat/sys/block/rbd0/queue/max_sectors_kb
4096
03:49:14-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/max_segments1024
The output of systemtap for nornal data:
offset:0 length:1048576
offset:1048576 length:1048576
offset:2097152 length:1048576
offset:3145728 length:1048576According to the test, you are right.
Because the blk-mq doesn't use any scheduling policy. 03:52:13-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/schedulernone
Quoted 4 lines
In previous versions of the kernel 4.0, the rbd use the defualt scheduler:cfq
So, I think that the blk-mq need to do more?
There is no scheduler support in blk-mq as of now but your numbers don't have anything to do with that. The current behaviour is a result of a bug in blk-mq. It's fixed by [1], if you apply it you should see 4M requests with your stap script.
[1] http://article.gmane.org/gmane.linux.kernel/1941750
Thanks,
Ilya
Quoted 126 lines · Ilya Dryomov
Quoted 124 lines · juncheng bai
Quoted 64 lines · Ilya Dryomov
Quoted 53 lines · juncheng bai
Quoted 42 lines · Ilya Dryomov
Quoted 27 lines · juncheng bai
From 6213215bd19926d1063d4e01a248107dab8a899b Mon Sep 17 00:00:002001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request, so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +0
-0drivers/block/rbd.c static int rbd_init_disk(struct rbd_device · line 3764
Quoted 8 lines
drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );blk_queue_io_min (q, segment_size);blk_queue_io_opt (q, segment_size);Quoted 5 lines
I made a similar patch on Friday, investigating blk-mq plugging issue reported by Nick. My patch sets it to
BIO_MAX_PAGESunconditionally - AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given thatBIO_MAX_PAGESis 256, this gives is 1M direct I/Os.Quoted 6 lines
Hi. For signal bio, the max number of
bio_vecisBIO_MAX_PAGES, but a request can be merged from multiple bios. We can see the below function:ll_back_merge_fn,ll_front_merge_fnand etc.
And I test in kernel 3.18 use this patch, and do:
echo 4096 >/sys/block/rbd0/queue/max_sectors_kb
We use systemtap to trace the request size, It is upto 4M.Quoted 8 lines
Kernel 3.18 is pre rbd blk-mq transition, which happened in 4.0. You should test whatever patches you have with at least 4.0.
Putting that aside, I must be missing something. You'll get 4M requests on 3.18 both with your patch and without it, the only difference would be the size of bios being merged - 512k vs 1M. Can you describe your test workload and provide before and after traces?
Hi. I update kernel version to 4.0.5. The test information as shown below:
The base information:
03:28:13-root@server-186:~$uname -r
4.0.5My simple systemtap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }I use dd to execute the test case:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1 oflag=directCase one: Without patch
03:30:23-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4096
03:30:35-root@server-186:~$cat/sys/block/rbd0/queue/max_segments128The output of systemtap for nornal data:
offset:0 length:524288
offset:524288 length:524288
offset:1048576 length:524288
offset:1572864 length:524288
offset:2097152 length:524288
offset:2621440 length:524288
offset:3145728 length:524288
offset:3670016 length:524288Case two:With patch
cat/sys/block/rbd0/queue/max_sectors_kb
4096
03:49:14-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/max_segments1024
The output of systemtap for nornal data:
offset:0 length:1048576
offset:1048576 length:1048576
offset:2097152 length:1048576
offset:3145728 length:1048576According to the test, you are right.
Because the blk-mq doesn't use any scheduling policy. 03:52:13-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/schedulernoneIn previous versions of the kernel 4.0, the rbd use the defualt scheduler:cfq
Quoted 9 lines
Quoted 1 line
So, I think that the blk-mq need to do more?
There is no scheduler support in blk-mq as of now but your numbers don't have anything to do with that. The current behaviour is a result of a bug in blk-mq. It's fixed by [1], if you apply it you should see 4M requests with your stap script.
Hi.
First, Let's look at the result in the kernel version 3.18
The function blk_limits_max_hw_sectors different implemention between 3.18 and 4.0+. We need do:
echo 4094 >/sys/block/rbd0/queue/max_sectors_kb
The rbd device information:
11:13:18-root@server-186:~$cat /sys/block/rbd0/queue/max_sectors_kb 4094
11:15:28-root@server-186:~$cat /sys/block/rbd0/queue/max_segments 1024
The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1
The simple stap script:
probe module("rbd").function("rbd_img_request_create")
{
printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3));
}The output from stap:
offset:0 length:4190208
offset:21474770944 length:4096
Second, thanks for your patch [1].
I use the patch [1], and recompile the kernel.
The test information as shown below:
12:26:12-root@server-186:$cat /sys/block/rbd0/queue/max_segments 1024
12:26:23-root@server-186:$cat /sys/block/rbd0/queue/max_sectors_kb 4096
The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=2 oflag=direct
The simple systemtap script:
probe module("rbd").function("rbd_img_request_create")
{
printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3));
}The output of systemtap for nornal data:
offset:0 length:4194304
offset:4194304 length:4194304
offset:21474770944 length:4096
So, I think that the max_segments of request_limits should be divide the object size by PAGE_SIZE.
[1] http://article.gmane.org/gmane.linux.kernel/1941750
Thanks.
----
juncheng bai
Quoted 8 lines
Thanks,
Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Ilya Dryomov
maintainerQuoted 191 lines · juncheng bai
Quoted 143 lines · Ilya Dryomov
Quoted 134 lines · juncheng bai
Quoted 74 lines · Ilya Dryomov
Quoted 60 lines · juncheng bai
Quoted 47 lines · Ilya Dryomov
Quoted 30 lines · juncheng bai
From 6213215bd19926d1063d4e01a248107dab8a899b Mon Sep 17 00:00:002001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request,
so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +0
-0drivers/block/rbd.c static int rbd_init_disk(struct rbd_device · line 3764
Quoted 8 lines
drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );blk_queue_io_min (q, segment_size);blk_queue_io_opt (q, segment_size);Quoted 5 lines
I made a similar patch on Friday, investigating blk-mq plugging issue reported by Nick. My patch sets it to
BIO_MAX_PAGESunconditionally - AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given thatBIO_MAX_PAGESis 256, this gives is 1M direct I/Os.Quoted 7 lines
Hi. For signal bio, the max number of
bio_vecisBIO_MAX_PAGES, but a request can be merged from multiple bios. We can see the below function:ll_back_merge_fn,ll_front_merge_fnand etc.
And I test in kernel 3.18 use this patch, and do:
echo 4096 >/sys/block/rbd0/queue/max_sectors_kb
We use systemtap to trace the request size, It is upto 4M.Quoted 8 lines
Kernel 3.18 is pre rbd blk-mq transition, which happened in 4.0. You should test whatever patches you have with at least 4.0.
Putting that aside, I must be missing something. You'll get 4M requests on 3.18 both with your patch and without it, the only difference would be the size of bios being merged - 512k vs 1M. Can you describe your test workload and provide before and after traces?
Hi. I update kernel version to 4.0.5. The test information as shown below:
The base information:
03:28:13-root@server-186:~$uname -r
4.0.5My simple systemtap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }I use dd to execute the test case:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1 oflag=directCase one: Without patch
03:30:23-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4096
03:30:35-root@server-186:~$cat/sys/block/rbd0/queue/max_segments128The output of systemtap for nornal data:
offset:0 length:524288
offset:524288 length:524288
offset:1048576 length:524288
offset:1572864 length:524288
offset:2097152 length:524288
offset:2621440 length:524288
offset:3145728 length:524288
offset:3670016 length:524288Case two:With patch
cat/sys/block/rbd0/queue/max_sectors_kb
4096
03:49:14-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/max_segments
1024
The output of systemtap for nornal data:
offset:0 length:1048576
offset:1048576 length:1048576
offset:2097152 length:1048576
offset:3145728 length:1048576According to the test, you are right.
Because the blk-mq doesn't use any scheduling policy. 03:52:13-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/schedulernoneQuoted 4 lines
In previous versions of the kernel 4.0, the rbd use the defualt scheduler:cfq
So, I think that the blk-mq need to do more?
Quoted 7 lines
There is no scheduler support in blk-mq as of now but your numbers don't have anything to do with that. The current behaviour is a result of a bug in blk-mq. It's fixed by [1], if you apply it you should see 4M requests with your stap script.
Hi.
First, Let's look at the result in the kernel version 3.18
The functionblk_limits_max_hw_sectorsdifferent implemention between 3.18 and 4.0+. We need do:
echo 4094 >/sys/block/rbd0/queue/max_sectors_kbThe rbd device information:
11:13:18-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4094
11:15:28-root@server-186:~$cat/sys/block/rbd0/queue/max_segments1024The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1The simple stap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }The output from stap:
offset:0 length:4190208
offset:21474770944 length:4096Second, thanks for your patch [1].
I use the patch [1], and recompile the kernel.
The test information as shown below:
12:26:12-root@server-186:$cat/sys/block/rbd0/queue/max_segments1024
12:26:23-root@server-186:$cat/sys/block/rbd0/queue/max_sectors_kb4096The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=2 oflag=directThe simple systemtap script:
probe module("rbd").function("rbd_img_request_create")
Quoted 8 lines
{ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }The output of systemtap for nornal data:
offset:0 length:4194304
offset:4194304 length:4194304
offset:21474770944 length:4096
Sorry, I fail to see the purpose of the above tests. The test commands differ, the kernels differ and it looks like you had your patch applied for both tests. What I'm trying to get you to do is to show me some data that will back your claim (which your patch is based on):
Quoted 3 lines
So, I think that the
max_segmentsofrequest_limitsshould be divide the object size byPAGE_SIZE.
For that you need to use the same kernel and run the same workload. The only difference should be whether your patch is applied or not. I still think that setting rbd max_segments to anything above BIO_MAX_PAGES is bogus, but I'd be happy to be shown wrong on that since that would mean better performance, at least in some workloads.
Thanks,
Ilya
Quoted 211 lines · Ilya Dryomov
Quoted 191 lines · juncheng bai
Quoted 143 lines · Ilya Dryomov
Quoted 134 lines · juncheng bai
Quoted 74 lines · Ilya Dryomov
Quoted 60 lines · juncheng bai
Quoted 47 lines · Ilya Dryomov
Quoted 30 lines · juncheng bai
From 6213215bd19926d1063d4e01a248107dab8a899b Mon Sep 17 00:00:002001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request,
so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +0
-0drivers/block/rbd.c static int rbd_init_disk(struct rbd_device · line 3764
Quoted 8 lines
drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );blk_queue_io_min (q, segment_size);blk_queue_io_opt (q, segment_size);Quoted 5 lines
I made a similar patch on Friday, investigating blk-mq plugging issue reported by Nick. My patch sets it to
BIO_MAX_PAGESunconditionally - AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given thatBIO_MAX_PAGESis 256, this gives is 1M direct I/Os.Quoted 7 lines
Hi. For signal bio, the max number of
bio_vecisBIO_MAX_PAGES, but a request can be merged from multiple bios. We can see the below function:ll_back_merge_fn,ll_front_merge_fnand etc.
And I test in kernel 3.18 use this patch, and do:
echo 4096 >/sys/block/rbd0/queue/max_sectors_kb
We use systemtap to trace the request size, It is upto 4M.Quoted 8 lines
Kernel 3.18 is pre rbd blk-mq transition, which happened in 4.0. You should test whatever patches you have with at least 4.0.
Putting that aside, I must be missing something. You'll get 4M requests on 3.18 both with your patch and without it, the only difference would be the size of bios being merged - 512k vs 1M. Can you describe your test workload and provide before and after traces?
Hi. I update kernel version to 4.0.5. The test information as shown below:
The base information:
03:28:13-root@server-186:~$uname -r
4.0.5My simple systemtap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }I use dd to execute the test case:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1 oflag=directCase one: Without patch
03:30:23-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4096
03:30:35-root@server-186:~$cat/sys/block/rbd0/queue/max_segments128The output of systemtap for nornal data:
offset:0 length:524288
offset:524288 length:524288
offset:1048576 length:524288
offset:1572864 length:524288
offset:2097152 length:524288
offset:2621440 length:524288
offset:3145728 length:524288
offset:3670016 length:524288Case two:With patch
cat/sys/block/rbd0/queue/max_sectors_kb
4096
03:49:14-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/max_segments
1024
The output of systemtap for nornal data:
offset:0 length:1048576
offset:1048576 length:1048576
offset:2097152 length:1048576
offset:3145728 length:1048576According to the test, you are right.
Because the blk-mq doesn't use any scheduling policy. 03:52:13-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/schedulernoneQuoted 4 lines
In previous versions of the kernel 4.0, the rbd use the defualt scheduler:cfq
So, I think that the blk-mq need to do more?
Quoted 7 lines
There is no scheduler support in blk-mq as of now but your numbers don't have anything to do with that. The current behaviour is a result of a bug in blk-mq. It's fixed by [1], if you apply it you should see 4M requests with your stap script.
Hi.
First, Let's look at the result in the kernel version 3.18
The functionblk_limits_max_hw_sectorsdifferent implemention between 3.18 and 4.0+. We need do:
echo 4094 >/sys/block/rbd0/queue/max_sectors_kbThe rbd device information:
11:13:18-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4094
11:15:28-root@server-186:~$cat/sys/block/rbd0/queue/max_segments1024The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1The simple stap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }The output from stap:
offset:0 length:4190208
offset:21474770944 length:4096Second, thanks for your patch [1].
I use the patch [1], and recompile the kernel.
The test information as shown below:
12:26:12-root@server-186:$cat/sys/block/rbd0/queue/max_segments1024
12:26:23-root@server-186:$cat/sys/block/rbd0/queue/max_sectors_kb4096The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=2 oflag=directThe simple systemtap script:
probe module("rbd").function("rbd_img_request_create")Quoted 8 lines
{ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }The output of systemtap for nornal data:
offset:0 length:4194304
offset:4194304 length:4194304
offset:21474770944 length:4096Sorry, I fail to see the purpose of the above tests. The test commands differ, the kernels differ and it looks like you had your patch applied for both tests. What I'm trying to get you to do is to show me some data that will back your claim (which your patch is based on):
Quoted 3 lines
So, I think that the
max_segmentsofrequest_limitsshould be divide the object size byPAGE_SIZE.
Quoted 7 lines
For that you need to use the same kernel and run the same workload. The only difference should be whether your patch is applied or not. I still think that setting rbd
max_segmentsto anything aboveBIO_MAX_PAGESis bogus, but I'd be happy to be shown wrong on that since that would mean better performance, at least in some workloads.
Hi.
For cloned image, it will avoid doing copyup if the request size is equal to the object size, I think that it is the key effect of this patch.
The big request would result in overtime if the ceph backend is busy or the network bandwidth is too low.
I suggest that add a module parameter to control the value which decided by the user settings.
Thanks.
----
juncheng bai
Quoted 4 lines
Thanks,
Ilya
Ilya Dryomov
maintainerQuoted 243 lines · juncheng bai
Quoted 233 lines · Ilya Dryomov
Quoted 210 lines · juncheng bai
Quoted 160 lines · Ilya Dryomov
Quoted 149 lines · juncheng bai
Quoted 87 lines · Ilya Dryomov
Quoted 71 lines · juncheng bai
Quoted 54 lines · Ilya Dryomov
Quoted 41 lines · juncheng bai
From 6213215bd19926d1063d4e01a248107dab8a899b Mon Sep 1700:00:00
2001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request,
so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );Quoted 2 lines
blk_queue_io_min(q, segment_size); blk_queue_io_opt(q, segment_size);Quoted 7 lines
I made a similar patch on Friday, investigating blk-mq plugging issue
reported by Nick. My patch sets it toBIO_MAX_PAGESunconditionally -
AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given thatBIO_MAX_PAGESis 256, this gives is 1M direct I/Os.Quoted 7 lines
Hi. For signal bio, the max number of
bio_vecisBIO_MAX_PAGES, but a request can be merged from multiple bios. We can see the below function:ll_back_merge_fn,ll_front_merge_fnand etc.
And I test in kernel 3.18 use this patch, and do:
echo 4096 >/sys/block/rbd0/queue/max_sectors_kb
We use systemtap to trace the request size, It is upto 4M.Quoted 8 lines
Kernel 3.18 is pre rbd blk-mq transition, which happened in 4.0. You should test whatever patches you have with at least 4.0.
Putting that aside, I must be missing something. You'll get 4M requests on 3.18 both with your patch and without it, the only difference would be the size of bios being merged - 512k vs 1M. Can you describe your test workload and provide before and after traces?
Hi. I update kernel version to 4.0.5. The test information as shown below:
The base information:
03:28:13-root@server-186:~$uname -r
4.0.5My simple systemtap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }I use dd to execute the test case:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1 oflag=directCase one: Without patch
03:30:23-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4096
03:30:35-root@server-186:~$cat/sys/block/rbd0/queue/max_segments128The output of systemtap for nornal data:
offset:0 length:524288
offset:524288 length:524288
offset:1048576 length:524288
offset:1572864 length:524288
offset:2097152 length:524288
offset:2621440 length:524288
offset:3145728 length:524288
offset:3670016 length:524288Case two:With patch
cat/sys/block/rbd0/queue/max_sectors_kb
4096
03:49:14-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/max_segments
1024
The output of systemtap for nornal data:
offset:0 length:1048576
offset:1048576 length:1048576
offset:2097152 length:1048576
offset:3145728 length:1048576According to the test, you are right.
Because the blk-mq doesn't use any scheduling policy. 03:52:13-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/scheduler
noneQuoted 4 lines
In previous versions of the kernel 4.0, the rbd use the defualt scheduler:cfq
So, I think that the blk-mq need to do more?
Quoted 7 lines
There is no scheduler support in blk-mq as of now but your numbers don't have anything to do with that. The current behaviour is a result of a bug in blk-mq. It's fixed by [1], if you apply it you should see 4M requests with your stap script.
Hi.
First, Let's look at the result in the kernel version 3.18 The functionblk_limits_max_hw_sectorsdifferent implemention between 3.18
and 4.0+. We need do:
echo 4094 >/sys/block/rbd0/queue/max_sectors_kbThe rbd device information:
11:13:18-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4094
11:15:28-root@server-186:~$cat/sys/block/rbd0/queue/max_segments1024The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1The simple stap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }The output from stap:
offset:0 length:4190208
offset:21474770944 length:4096Second, thanks for your patch [1].
I use the patch [1], and recompile the kernel.
The test information as shown below:
12:26:12-root@server-186:$cat/sys/block/rbd0/queue/max_segments1024
12:26:23-root@server-186:$cat/sys/block/rbd0/queue/max_sectors_kb4096The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=2 oflag=directThe simple systemtap script:
probe module("rbd").function("rbd_img_request_create")Quoted 8 lines
{ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }The output of systemtap for nornal data:
offset:0 length:4194304
offset:4194304 length:4194304
offset:21474770944 length:4096Sorry, I fail to see the purpose of the above tests. The test commands differ, the kernels differ and it looks like you had your patch applied for both tests. What I'm trying to get you to do is to show me some data that will back your claim (which your patch is based on):
Quoted 3 lines
So, I think that the
max_segmentsofrequest_limitsshould be divide the object size byPAGE_SIZE.Quoted 7 lines
For that you need to use the same kernel and run the same workload. The only difference should be whether your patch is applied or not. I still think that setting rbd
max_segmentsto anything aboveBIO_MAX_PAGESis bogus, but I'd be happy to be shown wrong on that since that would mean better performance, at least in some workloads.
Quoted 6 lines
Hi.
For cloned image, it will avoid doing copyup if the request size is equal to the object size, I think that it is the key effect of this patch.
The big request would result in overtime if the ceph backend is busy or the network bandwidth is too low.
You are right, but then again: we get rbd object size sized requests even with the default max_segments. This is true for both < 4.0 and
Quoted 4 lines
= 4.0 kernels (with the plugging fix applied).
I suggest that add a module parameter to control the value which decided by the user settings.
A module parameter for what exactly?
Thanks,
Ilya
Quoted 252 lines · Ilya Dryomov
Quoted 243 lines · juncheng bai
Quoted 233 lines · Ilya Dryomov
Quoted 210 lines · juncheng bai
Quoted 160 lines · Ilya Dryomov
Quoted 149 lines · juncheng bai
Quoted 87 lines · Ilya Dryomov
Quoted 71 lines · juncheng bai
Quoted 54 lines · Ilya Dryomov
Quoted 41 lines · juncheng bai
From 6213215bd19926d1063d4e01a248107dab8a899b Mon Sep 1700:00:00
2001
From: juncheng bai <[email protected]>
Date: Mon, 15 Jun 2015 18:34:00 +0800
Subject: [PATCH] storage:rbd: make the size of request is equal to the
size of the objectensures that the merged size of request can achieve the size of the object.
when merge a bio to request or merge a request to request, the sum of the segment number of the current request and the segment number of the bio is not greater than the max segments of the request,
so the max size of request is 512k if the max segments of request isBLK_MAX_SEGMENTS.Signed-off-by juncheng bai <[email protected]>--- drivers/block/rbd.c | 2 ++ 1 file changed, 2 insertions(+)drivers/block/rbd.c +2
-0@@ -3757,6 +3757,8 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) segment_size =rbd_obj_bytes (&rbd_dev->header);blk_queue_max_hw_sectors (q, segment_size /SECTOR_SIZE );blk_queue_max_segment_size (q, segment_size); +if (segment_size >BLK_MAX_SEGMENTS *PAGE_SIZE ) +blk_queue_max_segments (q, segment_size /PAGE_SIZE );Quoted 2 lines
blk_queue_io_min(q, segment_size); blk_queue_io_opt(q, segment_size);Quoted 7 lines
I made a similar patch on Friday, investigating blk-mq plugging issue
reported by Nick. My patch sets it toBIO_MAX_PAGESunconditionally -
AFAIU there is no point in setting to anything bigger since the bios will be clipped to that number of vecs. Given thatBIO_MAX_PAGESis 256, this gives is 1M direct I/Os.Quoted 7 lines
Hi. For signal bio, the max number of
bio_vecisBIO_MAX_PAGES, but a request can be merged from multiple bios. We can see the below function:ll_back_merge_fn,ll_front_merge_fnand etc.
And I test in kernel 3.18 use this patch, and do:
echo 4096 >/sys/block/rbd0/queue/max_sectors_kb
We use systemtap to trace the request size, It is upto 4M.Quoted 8 lines
Kernel 3.18 is pre rbd blk-mq transition, which happened in 4.0. You should test whatever patches you have with at least 4.0.
Putting that aside, I must be missing something. You'll get 4M requests on 3.18 both with your patch and without it, the only difference would be the size of bios being merged - 512k vs 1M. Can you describe your test workload and provide before and after traces?
Hi. I update kernel version to 4.0.5. The test information as shown below:
The base information:
03:28:13-root@server-186:~$uname -r
4.0.5My simple systemtap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }I use dd to execute the test case:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1 oflag=directCase one: Without patch
03:30:23-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4096
03:30:35-root@server-186:~$cat/sys/block/rbd0/queue/max_segments128The output of systemtap for nornal data:
offset:0 length:524288
offset:524288 length:524288
offset:1048576 length:524288
offset:1572864 length:524288
offset:2097152 length:524288
offset:2621440 length:524288
offset:3145728 length:524288
offset:3670016 length:524288Case two:With patch
cat/sys/block/rbd0/queue/max_sectors_kb
4096
03:49:14-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/max_segments
1024
The output of systemtap for nornal data:
offset:0 length:1048576
offset:1048576 length:1048576
offset:2097152 length:1048576
offset:3145728 length:1048576According to the test, you are right.
Because the blk-mq doesn't use any scheduling policy. 03:52:13-root@server-186:linux-4.0.5$cat/sys/block/rbd0/queue/scheduler
noneQuoted 4 lines
In previous versions of the kernel 4.0, the rbd use the defualt scheduler:cfq
So, I think that the blk-mq need to do more?
Quoted 7 lines
There is no scheduler support in blk-mq as of now but your numbers don't have anything to do with that. The current behaviour is a result of a bug in blk-mq. It's fixed by [1], if you apply it you should see 4M requests with your stap script.
Hi.
First, Let's look at the result in the kernel version 3.18 The functionblk_limits_max_hw_sectorsdifferent implemention between 3.18
and 4.0+. We need do:
echo 4094 >/sys/block/rbd0/queue/max_sectors_kbThe rbd device information:
11:13:18-root@server-186:~$cat/sys/block/rbd0/queue/max_sectors_kb4094
11:15:28-root@server-186:~$cat/sys/block/rbd0/queue/max_segments1024The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=1The simple stap script:
probe module("rbd").function("rbd_img_request_create"){ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }The output from stap:
offset:0 length:4190208
offset:21474770944 length:4096Second, thanks for your patch [1].
I use the patch [1], and recompile the kernel.
The test information as shown below:
12:26:12-root@server-186:$cat/sys/block/rbd0/queue/max_segments1024
12:26:23-root@server-186:$cat/sys/block/rbd0/queue/max_sectors_kb4096The test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=2 oflag=directThe simple systemtap script:
probe module("rbd").function("rbd_img_request_create")Quoted 8 lines
{ printf("offset:%lu length:%lu\n", ulong_arg(2), ulong_arg(3)); }The output of systemtap for nornal data:
offset:0 length:4194304
offset:4194304 length:4194304
offset:21474770944 length:4096Sorry, I fail to see the purpose of the above tests. The test commands differ, the kernels differ and it looks like you had your patch applied for both tests. What I'm trying to get you to do is to show me some data that will back your claim (which your patch is based on):
Quoted 3 lines
So, I think that the
max_segmentsofrequest_limitsshould be divide the object size byPAGE_SIZE.Quoted 7 lines
For that you need to use the same kernel and run the same workload. The only difference should be whether your patch is applied or not. I still think that setting rbd
max_segmentsto anything aboveBIO_MAX_PAGESis bogus, but I'd be happy to be shown wrong on that since that would mean better performance, at least in some workloads.Quoted 6 lines
Hi.
For cloned image, it will avoid doing copyup if the request size is equal to the object size, I think that it is the key effect of this patch.
The big request would result in overtime if the ceph backend is busy or the network bandwidth is too low.
Quoted 3 lines
You are right, but then again: we get rbd object size sized requests even with the default
max_segments. This is true for both < 4.0 andQuoted 1 line
= 4.0 kernels (with the plugging fix applied).
Hi.
Yeah, you are right, use the default max_segments, the request size can
be the object size, because the bi_phys_segments of bio could be recount, there's just a possibility.
I want to fully understand the bi_phys_segments, hope you can give me some information, thanks.
The test information as shown below:
The systemtap script:
global greq=0;
probe kernel.function("bio_attempt_back_merge")
{
greq=pointer_arg(2);
}probe kernel.function("bio_attempt_back_merge").return {
printf("after req addr:%p req segments:%d req offset:%lu req
length:%lu\n",
greq,
@cast(greq, "request")->nr_phys_segments,
@cast(greq, "request")->__sector * 512,
@cast(greq, "request")->__data_len);
}probe kernel.function("blk_mq_start_request")
{
printf("req addr:%p nr_phys_segments:%d, offset:%lu len:%lu\n",
pointer_arg(1),
@cast(pointer_arg(1), "request")->nr_phys_segments,
@cast(pointer_arg(1), "request")->__sector * 512,
@cast(pointer_arg(1), "request")->__data_len);
}Test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=2 oflag=direct seek=100
Cast one:blk_queue_max_segments(q, 256);
The output of stap:
after req addr:0xffff880ff60a08c0 req segments:73 req offset:419430400 req length:2097152 after req addr:0xffff880ff60a08c0 req segments:73 req offset:419430400 req length:2097152 after req addr:0xffff880ff60a0a80 req segments:186 req offset:421527552 req length:1048576 req addr:0xffff880ff60a08c0 nr_phys_segments:73, offset:419430400 len:2097152 req addr:0xffff880ff60a0a80 nr_phys_segments:186, offset:421527552 len:1048576 req addr:0xffff880ff60a0c40 nr_phys_segments:232, offset:422576128 len:1048576
after req addr:0xffff880ff60a0c40 req segments:73 req offset:423624704 req length:2097152 after req addr:0xffff880ff60a0c40 req segments:73 req offset:423624704 req length:2097152 after req addr:0xffff880ff60a0e00 req segments:186 req offset:425721856 req length:1048576 req addr:0xffff880ff60a0c40 nr_phys_segments:73, offset:423624704 len:2097152 req addr:0xffff880ff60a0e00 nr_phys_segments:186, offset:425721856 len:1048576 req addr:0xffff880ff60a0fc0 nr_phys_segments:232, offset:426770432 len:1048576
Case two:blk_queue_max_segments(q, segment_size / PAGE_SIZE);
The output of stap:
after req addr:0xffff88101c9a0000 req segments:478 req offset:419430400 req length:4194304 req addr:0xffff88101c9a0000 nr_phys_segments:478, offset:419430400 len:4194304
after req addr:0xffff88101c9a0000 req segments:478 req offset:423624704 req length:4194304 req addr:0xffff88101c9a0000 nr_phys_segments:478, offset:423624704 len:4194304
1.Based on the setting of max_sectors and max_segments, decides the
size of a request.
2.We have already set max_sectors to an object's size, so we should try
to ensure that a request to the size as possible as merge bio.
Thanks.
----
juncheng bai
Quoted 5 lines
Quoted 3 lines
I suggest that add a module parameter to control the value which decided by the user settings.
A module parameter for what exactly?
It likes the single_major of module rbd.
Quoted 5 lines
Thanks,
Ilya
Ilya Dryomov
maintainerQuoted 82 lines · juncheng bai
Hi.
Yeah, you are right, use the defaultmax_segments, the request size can be the object size, because thebi_phys_segmentsof bio could be recount, there's just a possibility.I want to fully understand the
bi_phys_segments, hope you can give me some information, thanks.The test information as shown below:
The systemtap script:
global greq=0;
probekernel.function("bio_attempt_back_merge"){ greq=pointer_arg(2); }probe kernel.function("bio_attempt_back_merge").return {
printf("after req addr:%p req segments:%d req offset:%lu req
length:%lu\n",greq, @cast(greq, "request")->nr_phys_segments, @cast(greq, "request")->__sector * 512, @cast(greq, "request")->__data_len); }probe
kernel.function("blk_mq_start_request"){ printf("req addr:%p nr_phys_segments:%d, offset:%lu len:%lu\n", pointer_arg(1), @cast(pointer_arg(1), "request")->nr_phys_segments, @cast(pointer_arg(1), "request")->__sector * 512, @cast(pointer_arg(1), "request")->__data_len); }Test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=2 oflag=direct seek=100Cast one:
blk_queue_max_segments(q, 256);The output of stap:
after req addr:0xffff880ff60a08c0 req segments:73 req offset:419430400 req length:2097152
after req addr:0xffff880ff60a08c0 req segments:73 req offset:419430400 req length:2097152
after req addr:0xffff880ff60a0a80 req segments:186 req offset:421527552 req length:1048576
req addr:0xffff880ff60a08c0 nr_phys_segments:73, offset:419430400 len:2097152
req addr:0xffff880ff60a0a80 nr_phys_segments:186, offset:421527552 len:1048576
req addr:0xffff880ff60a0c40 nr_phys_segments:232, offset:422576128 len:1048576after req addr:0xffff880ff60a0c40 req segments:73 req offset:423624704 req length:2097152
after req addr:0xffff880ff60a0c40 req segments:73 req offset:423624704 req length:2097152
after req addr:0xffff880ff60a0e00 req segments:186 req offset:425721856 req length:1048576
req addr:0xffff880ff60a0c40 nr_phys_segments:73, offset:423624704 len:2097152
req addr:0xffff880ff60a0e00 nr_phys_segments:186, offset:425721856 len:1048576
req addr:0xffff880ff60a0fc0 nr_phys_segments:232, offset:426770432 len:1048576Case two:
blk_queue_max_segments(q, segment_size / PAGE_SIZE);The output of stap:
after req addr:0xffff88101c9a0000 req segments:478 req offset:419430400 req length:4194304
req addr:0xffff88101c9a0000 nr_phys_segments:478, offset:419430400 len:4194304after req addr:0xffff88101c9a0000 req segments:478 req offset:423624704 req length:4194304
req addr:0xffff88101c9a0000 nr_phys_segments:478, offset:423624704 len:4194304
Quoted 4 lines
1.Based on the setting of
max_sectorsandmax_segments, decides the
size of a request.
2.We have already setmax_sectorsto an object's size, so we should try
to ensure that a request to the size as possible as merge bio.
Yeah, I also tried to explain this in the commit description [1]. Initially I had BIO_MAX_PAGES in there, and realistically I still think it's enough for most cases, but discussion with you made me consider readv/writev case and so I changed it in my patch to max_hw_sectors (i.e. segment_size / SECTOR_SIZE) - this ensures that max_segments will never be a limiting factor even in theory.
[1] https://github.com/ceph/ceph-client/commit/2d8006795564fbc0fa68d75758f605fe9f7a108e
Thanks,
Ilya
Quoted 96 lines · Ilya Dryomov
Quoted 82 lines · juncheng bai
Hi.
Yeah, you are right, use the defaultmax_segments, the request size can be the object size, because thebi_phys_segmentsof bio could be recount, there's just a possibility.I want to fully understand the
bi_phys_segments, hope you can give me some information, thanks.The test information as shown below:
The systemtap script:
global greq=0;
probekernel.function("bio_attempt_back_merge"){ greq=pointer_arg(2); }probe kernel.function("bio_attempt_back_merge").return {
printf("after req addr:%p req segments:%d req offset:%lu req
length:%lu\n",greq, @cast(greq, "request")->nr_phys_segments, @cast(greq, "request")->__sector * 512, @cast(greq, "request")->__data_len); }probe
kernel.function("blk_mq_start_request"){ printf("req addr:%p nr_phys_segments:%d, offset:%lu len:%lu\n", pointer_arg(1), @cast(pointer_arg(1), "request")->nr_phys_segments, @cast(pointer_arg(1), "request")->__sector * 512, @cast(pointer_arg(1), "request")->__data_len); }Test command:
dd if=/dev/zero of=/dev/rbd0 bs=4M count=2 oflag=direct seek=100Cast one:
blk_queue_max_segments(q, 256);The output of stap:
after req addr:0xffff880ff60a08c0 req segments:73 req offset:419430400 req length:2097152
after req addr:0xffff880ff60a08c0 req segments:73 req offset:419430400 req length:2097152
after req addr:0xffff880ff60a0a80 req segments:186 req offset:421527552 req length:1048576
req addr:0xffff880ff60a08c0 nr_phys_segments:73, offset:419430400 len:2097152
req addr:0xffff880ff60a0a80 nr_phys_segments:186, offset:421527552 len:1048576
req addr:0xffff880ff60a0c40 nr_phys_segments:232, offset:422576128 len:1048576after req addr:0xffff880ff60a0c40 req segments:73 req offset:423624704 req length:2097152
after req addr:0xffff880ff60a0c40 req segments:73 req offset:423624704 req length:2097152
after req addr:0xffff880ff60a0e00 req segments:186 req offset:425721856 req length:1048576
req addr:0xffff880ff60a0c40 nr_phys_segments:73, offset:423624704 len:2097152
req addr:0xffff880ff60a0e00 nr_phys_segments:186, offset:425721856 len:1048576
req addr:0xffff880ff60a0fc0 nr_phys_segments:232, offset:426770432 len:1048576Case two:
blk_queue_max_segments(q, segment_size / PAGE_SIZE);The output of stap:
after req addr:0xffff88101c9a0000 req segments:478 req offset:419430400 req length:4194304
req addr:0xffff88101c9a0000 nr_phys_segments:478, offset:419430400 len:4194304after req addr:0xffff88101c9a0000 req segments:478 req offset:423624704 req length:4194304
req addr:0xffff88101c9a0000 nr_phys_segments:478, offset:423624704 len:4194304Quoted 4 lines
1.Based on the setting of
max_sectorsandmax_segments, decides the
size of a request.
2.We have already setmax_sectorsto an object's size, so we should try
to ensure that a request to the size as possible as merge bio.Yeah, I also tried to explain this in the commit description [1]. Initially I had
BIO_MAX_PAGESin there, and realistically I still think it's enough for most cases, but discussion with you made me consider readv/writev case and so I changed it in my patch tomax_hw_sectors(i.e.segment_size/SECTOR_SIZE) - this ensures thatmax_segmentswill never be a limiting factor even in theory.
Quoted 6 lines
[1] https://github.com/ceph/ceph-client/commit/2d8006795564fbc0fa68d75758f605fe9f7a108e
Thanks,
Ilya
Yeah, I agree with you.
Thanks.
----
juncheng bai