* [Drbd-dev] [PATCH RFC 2/5] drbd: remove unused argument from drbd_request_prepare and __drbd_make_request
[not found] <20200708075819.4531-1-guoqing.jiang@cloud.ionos.com>
@ 2020-10-12 15:43 ` Guoqing Jiang
2020-10-12 15:43 ` [Drbd-dev] [PATCH RFC 3/5] drbd: rename start_jif to start_ns Guoqing Jiang
2020-10-12 15:45 ` [Drbd-dev] [PATCH RFC 1/5] block: return ns precision from disk_start_io_acct Guoqing Jiang
2 siblings, 0 replies; 6+ messages in thread
From: Guoqing Jiang @ 2020-10-12 15:43 UTC (permalink / raw)
To: axboe; +Cc: linux-block, Guoqing Jiang, Philipp Reisner, Lars Ellenberg,
drbd-dev
We can remove start_jif since it is not used by drbd_request_prepare,
then remove it from __drbd_make_request further.
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: drbd-dev@lists.linbit.com
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
This had been sent before, now it is better to include it in the thread.
https://marc.info/?l=linux-block&m=159369644305325&w=2
drivers/block/drbd/drbd_int.h | 2 +-
drivers/block/drbd/drbd_main.c | 3 +--
drivers/block/drbd/drbd_req.c | 11 ++++-------
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index fe6cb99eb917..aacd2010b555 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1450,7 +1450,7 @@ extern void conn_free_crypto(struct drbd_connection *connection);
/* drbd_req */
extern void do_submit(struct work_struct *ws);
-extern void __drbd_make_request(struct drbd_device *, struct bio *, unsigned long);
+extern void __drbd_make_request(struct drbd_device *, struct bio *);
extern blk_qc_t drbd_submit_bio(struct bio *bio);
extern int drbd_read_remote(struct drbd_device *device, struct drbd_request *req);
extern int is_valid_ar_handle(struct drbd_request *, sector_t);
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 7c34cc0ad8cc..42f2a235417c 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2293,7 +2293,6 @@ static void do_retry(struct work_struct *ws)
list_for_each_entry_safe(req, tmp, &writes, tl_requests) {
struct drbd_device *device = req->device;
struct bio *bio = req->master_bio;
- unsigned long start_jif = req->start_jif;
bool expected;
expected =
@@ -2328,7 +2327,7 @@ static void do_retry(struct work_struct *ws)
/* We are not just doing submit_bio_noacct(),
* as we want to keep the start_time information. */
inc_ap_bio(device);
- __drbd_make_request(device, bio, start_jif);
+ __drbd_make_request(device, bio);
}
}
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index 674be09b2da9..f705128b4f27 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -1188,7 +1188,7 @@ static void drbd_queue_write(struct drbd_device *device, struct drbd_request *re
* Returns ERR_PTR(-ENOMEM) if we cannot allocate a drbd_request.
*/
static struct drbd_request *
-drbd_request_prepare(struct drbd_device *device, struct bio *bio, unsigned long start_jif)
+drbd_request_prepare(struct drbd_device *device, struct bio *bio)
{
const int rw = bio_data_dir(bio);
struct drbd_request *req;
@@ -1416,9 +1416,9 @@ static void drbd_send_and_submit(struct drbd_device *device, struct drbd_request
complete_master_bio(device, &m);
}
-void __drbd_make_request(struct drbd_device *device, struct bio *bio, unsigned long start_jif)
+void __drbd_make_request(struct drbd_device *device, struct bio *bio)
{
- struct drbd_request *req = drbd_request_prepare(device, bio, start_jif);
+ struct drbd_request *req = drbd_request_prepare(device, bio);
if (IS_ERR_OR_NULL(req))
return;
drbd_send_and_submit(device, req);
@@ -1596,19 +1596,16 @@ void do_submit(struct work_struct *ws)
blk_qc_t drbd_submit_bio(struct bio *bio)
{
struct drbd_device *device = bio->bi_disk->private_data;
- unsigned long start_jif;
blk_queue_split(&bio);
- start_jif = jiffies;
-
/*
* what we "blindly" assume:
*/
D_ASSERT(device, IS_ALIGNED(bio->bi_iter.bi_size, 512));
inc_ap_bio(device);
- __drbd_make_request(device, bio, start_jif);
+ __drbd_make_request(device, bio);
return BLK_QC_T_NONE;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Drbd-dev] [PATCH RFC 3/5] drbd: rename start_jif to start_ns
[not found] <20200708075819.4531-1-guoqing.jiang@cloud.ionos.com>
2020-10-12 15:43 ` [Drbd-dev] [PATCH RFC 2/5] drbd: remove unused argument from drbd_request_prepare and __drbd_make_request Guoqing Jiang
@ 2020-10-12 15:43 ` Guoqing Jiang
2020-10-12 15:45 ` [Drbd-dev] [PATCH RFC 1/5] block: return ns precision from disk_start_io_acct Guoqing Jiang
2 siblings, 0 replies; 6+ messages in thread
From: Guoqing Jiang @ 2020-10-12 15:43 UTC (permalink / raw)
To: axboe; +Cc: linux-block, Guoqing Jiang, Philipp Reisner, Lars Ellenberg,
drbd-dev
Let's rename start_jif to start_ns to reflect that bio_start_io_acct
returns ns presicion now.
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: drbd-dev@lists.linbit.com
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
drivers/block/drbd/drbd_debugfs.c | 8 ++++----
drivers/block/drbd/drbd_int.h | 2 +-
drivers/block/drbd/drbd_req.c | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/block/drbd/drbd_debugfs.c b/drivers/block/drbd/drbd_debugfs.c
index b3b9cd5628fd..672fd7e6587d 100644
--- a/drivers/block/drbd/drbd_debugfs.c
+++ b/drivers/block/drbd/drbd_debugfs.c
@@ -105,7 +105,7 @@ static void seq_print_one_request(struct seq_file *m, struct drbd_request *req,
(s & RQ_WRITE) ? "W" : "R");
#define RQ_HDR_2 "\tstart\tin AL\tsubmit"
- seq_printf(m, "\t%d", jiffies_to_msecs(now - req->start_jif));
+ seq_printf(m, "\t%llu", (ktime_get_ns() - req->start_ns) / NSEC_PER_MSEC);
seq_print_age_or_dash(m, s & RQ_IN_ACT_LOG, now - req->in_actlog_jif);
seq_print_age_or_dash(m, s & RQ_LOCAL_PENDING, now - req->pre_submit_jif);
@@ -161,7 +161,7 @@ static void seq_print_waiting_for_AL(struct seq_file *m, struct drbd_resource *r
seq_puts(m, "minor\tvnr\tage\t#waiting\n");
rcu_read_lock();
idr_for_each_entry(&resource->devices, device, i) {
- unsigned long jif;
+ unsigned long ns;
struct drbd_request *req;
int n = atomic_read(&device->ap_actlog_cnt);
if (n) {
@@ -171,7 +171,7 @@ static void seq_print_waiting_for_AL(struct seq_file *m, struct drbd_resource *r
/* if the oldest request does not wait for the activity log
* it is not interesting for us here */
if (req && !(req->rq_state & RQ_IN_ACT_LOG))
- jif = req->start_jif;
+ ns = req->start_ns;
else
req = NULL;
spin_unlock_irq(&device->resource->req_lock);
@@ -179,7 +179,7 @@ static void seq_print_waiting_for_AL(struct seq_file *m, struct drbd_resource *r
if (n) {
seq_printf(m, "%u\t%u\t", device->minor, device->vnr);
if (req)
- seq_printf(m, "%u\t", jiffies_to_msecs(now - jif));
+ seq_printf(m, "%llu\t", (ktime_get_ns() - ns) / NSEC_PER_MSEC);
else
seq_puts(m, "-\t");
seq_printf(m, "%u\n", n);
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index aacd2010b555..467d96316230 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -301,7 +301,7 @@ struct drbd_request {
struct list_head req_pending_local;
/* for generic IO accounting */
- unsigned long start_jif;
+ unsigned long start_ns;
/* for DRBD internal statistics */
diff --git a/drivers/block/drbd/drbd_req.c b/drivers/block/drbd/drbd_req.c
index f705128b4f27..6ad6b4470ebd 100644
--- a/drivers/block/drbd/drbd_req.c
+++ b/drivers/block/drbd/drbd_req.c
@@ -245,7 +245,7 @@ void drbd_req_complete(struct drbd_request *req, struct bio_and_error *m)
start_new_tl_epoch(first_peer_device(device)->connection);
/* Update disk stats */
- bio_end_io_acct(req->master_bio, req->start_jif);
+ bio_end_io_acct(req->master_bio, req->start_ns);
/* If READ failed,
* have it be pushed back to the retry work queue,
@@ -1206,7 +1206,7 @@ drbd_request_prepare(struct drbd_device *device, struct bio *bio)
}
/* Update disk stats */
- req->start_jif = bio_start_io_acct(req->master_bio);
+ req->start_ns = bio_start_io_acct(req->master_bio);
if (!get_ldev(device)) {
bio_put(req->private_bio);
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Drbd-dev] [PATCH RFC 1/5] block: return ns precision from disk_start_io_acct
2020-10-12 15:46 ` Ming Lei
@ 2020-10-12 15:44 ` Guoqing Jiang
2020-10-12 15:44 ` Guoqing Jiang
0 siblings, 1 reply; 6+ messages in thread
From: Guoqing Jiang @ 2020-10-12 15:44 UTC (permalink / raw)
To: Ming Lei; +Cc: axboe, linux-block, Lars Ellenberg, Philipp Reisner, drbd-dev
Hi Ming,
On 7/8/20 3:27 PM, Ming Lei wrote:
> On Wed, Jul 08, 2020 at 09:58:15AM +0200, Guoqing Jiang wrote:
>> Currently the duration accounting of bio based driver is converted from
>> jiffies to ns, means it could be less accurate as request based driver.
>>
>> So let disk_start_io_acct return from ns precision, instead of convert
>> jiffies to ns in disk_end_io_acct.
>>
>> Cc: Philipp Reisner <philipp.reisner@linbit.com>
>> Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
>> Cc: drbd-dev@lists.linbit.com
>> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
>> ---
>> block/blk-core.c | 7 ++++---
>> 1 file changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/block/blk-core.c b/block/blk-core.c
>> index d9d632639bd1..0e806a8c62fb 100644
>> --- a/block/blk-core.c
>> +++ b/block/blk-core.c
>> @@ -1466,6 +1466,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
>> struct hd_struct *part = &disk->part0;
>> const int sgrp = op_stat_group(op);
>> unsigned long now = READ_ONCE(jiffies);
>> + unsigned long start_ns = ktime_get_ns();
>>
>> part_stat_lock();
>> update_io_ticks(part, now, false);
>> @@ -1474,7 +1475,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
>> part_stat_local_inc(part, in_flight[op_is_write(op)]);
>> part_stat_unlock();
>>
>> - return now;
>> + return start_ns;
>> }
>> EXPORT_SYMBOL(disk_start_io_acct);
>>
>> @@ -1484,11 +1485,11 @@ void disk_end_io_acct(struct gendisk *disk, unsigned int op,
>> struct hd_struct *part = &disk->part0;
>> const int sgrp = op_stat_group(op);
>> unsigned long now = READ_ONCE(jiffies);
>> - unsigned long duration = now - start_time;
>> + unsigned long duration = ktime_get_ns() - start_time;
>>
>> part_stat_lock();
>> update_io_ticks(part, now, true);
>> - part_stat_add(part, nsecs[sgrp], jiffies_to_nsecs(duration));
>> + part_stat_add(part, nsecs[sgrp], duration);
>> part_stat_local_dec(part, in_flight[op_is_write(op)]);
>> part_stat_unlock();
> Hi Guoqing,
>
> Cost of ktime_get_ns() can be observed as not cheap in high IOPS device,
Could you share some links about it? Thanks.
> so not sure the conversion is good. Also could you share what benefit we can
> get with this change?
Without the conversion, we have to track io latency with jiffies in 4th
patch.
Then with HZ=100, some rows (such as 1ms, 2ms and 4ms) in that table
don't make sense.
Thanks,
Guoqing
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Drbd-dev] [PATCH RFC 1/5] block: return ns precision from disk_start_io_acct
2020-10-12 15:44 ` Guoqing Jiang
@ 2020-10-12 15:44 ` Guoqing Jiang
0 siblings, 0 replies; 6+ messages in thread
From: Guoqing Jiang @ 2020-10-12 15:44 UTC (permalink / raw)
To: Ming Lei; +Cc: axboe, linux-block, Lars Ellenberg, Philipp Reisner, drbd-dev
On 7/8/20 3:53 PM, Guoqing Jiang wrote:
>>
>> Cost of ktime_get_ns() can be observed as not cheap in high IOPS device,
>
> Could you share some links about it? Thanks.
>
>> so not sure the conversion is good. Also could you share what benefit
>> we can
>> get with this change?
>
> Without the conversion, we have to track io latency with jiffies in
> 4th patch.
> Then with HZ=100, some rows (such as 1ms, 2ms and 4ms) in that table
> don't make sense.
Hmm, I can still output those rows based on HZ_TO_MSEC_NUM, which means
this patch can be dropped since the cost of ktime_get_ns is more expensive.
Thanks,
Guoqing
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Drbd-dev] [PATCH RFC 1/5] block: return ns precision from disk_start_io_acct
[not found] <20200708075819.4531-1-guoqing.jiang@cloud.ionos.com>
2020-10-12 15:43 ` [Drbd-dev] [PATCH RFC 2/5] drbd: remove unused argument from drbd_request_prepare and __drbd_make_request Guoqing Jiang
2020-10-12 15:43 ` [Drbd-dev] [PATCH RFC 3/5] drbd: rename start_jif to start_ns Guoqing Jiang
@ 2020-10-12 15:45 ` Guoqing Jiang
2020-10-12 15:46 ` Ming Lei
2 siblings, 1 reply; 6+ messages in thread
From: Guoqing Jiang @ 2020-10-12 15:45 UTC (permalink / raw)
To: axboe; +Cc: linux-block, Guoqing Jiang, Philipp Reisner, Lars Ellenberg,
drbd-dev
Currently the duration accounting of bio based driver is converted from
jiffies to ns, means it could be less accurate as request based driver.
So let disk_start_io_acct return from ns precision, instead of convert
jiffies to ns in disk_end_io_acct.
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Cc: drbd-dev@lists.linbit.com
Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
---
block/blk-core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index d9d632639bd1..0e806a8c62fb 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1466,6 +1466,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
struct hd_struct *part = &disk->part0;
const int sgrp = op_stat_group(op);
unsigned long now = READ_ONCE(jiffies);
+ unsigned long start_ns = ktime_get_ns();
part_stat_lock();
update_io_ticks(part, now, false);
@@ -1474,7 +1475,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
part_stat_local_inc(part, in_flight[op_is_write(op)]);
part_stat_unlock();
- return now;
+ return start_ns;
}
EXPORT_SYMBOL(disk_start_io_acct);
@@ -1484,11 +1485,11 @@ void disk_end_io_acct(struct gendisk *disk, unsigned int op,
struct hd_struct *part = &disk->part0;
const int sgrp = op_stat_group(op);
unsigned long now = READ_ONCE(jiffies);
- unsigned long duration = now - start_time;
+ unsigned long duration = ktime_get_ns() - start_time;
part_stat_lock();
update_io_ticks(part, now, true);
- part_stat_add(part, nsecs[sgrp], jiffies_to_nsecs(duration));
+ part_stat_add(part, nsecs[sgrp], duration);
part_stat_local_dec(part, in_flight[op_is_write(op)]);
part_stat_unlock();
}
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Drbd-dev] [PATCH RFC 1/5] block: return ns precision from disk_start_io_acct
2020-10-12 15:45 ` [Drbd-dev] [PATCH RFC 1/5] block: return ns precision from disk_start_io_acct Guoqing Jiang
@ 2020-10-12 15:46 ` Ming Lei
2020-10-12 15:44 ` Guoqing Jiang
0 siblings, 1 reply; 6+ messages in thread
From: Ming Lei @ 2020-10-12 15:46 UTC (permalink / raw)
To: Guoqing Jiang
Cc: axboe, linux-block, Lars Ellenberg, Philipp Reisner, drbd-dev
On Wed, Jul 08, 2020 at 09:58:15AM +0200, Guoqing Jiang wrote:
> Currently the duration accounting of bio based driver is converted from
> jiffies to ns, means it could be less accurate as request based driver.
>
> So let disk_start_io_acct return from ns precision, instead of convert
> jiffies to ns in disk_end_io_acct.
>
> Cc: Philipp Reisner <philipp.reisner@linbit.com>
> Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
> Cc: drbd-dev@lists.linbit.com
> Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
> ---
> block/blk-core.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/block/blk-core.c b/block/blk-core.c
> index d9d632639bd1..0e806a8c62fb 100644
> --- a/block/blk-core.c
> +++ b/block/blk-core.c
> @@ -1466,6 +1466,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
> struct hd_struct *part = &disk->part0;
> const int sgrp = op_stat_group(op);
> unsigned long now = READ_ONCE(jiffies);
> + unsigned long start_ns = ktime_get_ns();
>
> part_stat_lock();
> update_io_ticks(part, now, false);
> @@ -1474,7 +1475,7 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
> part_stat_local_inc(part, in_flight[op_is_write(op)]);
> part_stat_unlock();
>
> - return now;
> + return start_ns;
> }
> EXPORT_SYMBOL(disk_start_io_acct);
>
> @@ -1484,11 +1485,11 @@ void disk_end_io_acct(struct gendisk *disk, unsigned int op,
> struct hd_struct *part = &disk->part0;
> const int sgrp = op_stat_group(op);
> unsigned long now = READ_ONCE(jiffies);
> - unsigned long duration = now - start_time;
> + unsigned long duration = ktime_get_ns() - start_time;
>
> part_stat_lock();
> update_io_ticks(part, now, true);
> - part_stat_add(part, nsecs[sgrp], jiffies_to_nsecs(duration));
> + part_stat_add(part, nsecs[sgrp], duration);
> part_stat_local_dec(part, in_flight[op_is_write(op)]);
> part_stat_unlock();
Hi Guoqing,
Cost of ktime_get_ns() can be observed as not cheap in high IOPS device,
so not sure the conversion is good. Also could you share what benefit we can
get with this change?
Thanks,
Ming
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-10-12 15:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200708075819.4531-1-guoqing.jiang@cloud.ionos.com>
2020-10-12 15:43 ` [Drbd-dev] [PATCH RFC 2/5] drbd: remove unused argument from drbd_request_prepare and __drbd_make_request Guoqing Jiang
2020-10-12 15:43 ` [Drbd-dev] [PATCH RFC 3/5] drbd: rename start_jif to start_ns Guoqing Jiang
2020-10-12 15:45 ` [Drbd-dev] [PATCH RFC 1/5] block: return ns precision from disk_start_io_acct Guoqing Jiang
2020-10-12 15:46 ` Ming Lei
2020-10-12 15:44 ` Guoqing Jiang
2020-10-12 15:44 ` Guoqing Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox