diff options
author | Omar Sandoval <osandov@fb.com> | 2018-07-23 17:33:08 +0300 |
---|---|---|
committer | Davide Garberi <dade.garberi@gmail.com> | 2022-07-27 18:58:38 +0200 |
commit | 479ed3e13994141b42b5c650a07aa2043c79f21c (patch) | |
tree | 70ea8574302779f5a484fa37a7512b6f4e7aec9d /include | |
parent | f87408386728989f23faa5b1f8b656cb38c5e2d5 (diff) |
BACKPORT: block: use ktime_get_ns() instead of sched_clock() for cfq
cfq has some internal fields that use sched_clock() which can
trivially use ktime_get_ns() instead. Their timestamp fields in struct
request can also use ktime_get_ns(), which resolves the 8 year old
comment added by commit 28f4197e5d47 ("block: disable preemption before
using sched_clock()").
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: celtare21 <celtare21@gmail.com>
Signed-off-by: Yaroslav Furman <yaro330@gmail.com> - improved comment.
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/blkdev.h | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8ba034b90e9b..0d6082119489 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1453,42 +1453,33 @@ int kblockd_schedule_delayed_work(struct delayed_work *dwork, unsigned long dela int kblockd_schedule_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay); #ifdef CONFIG_BLK_CGROUP -/* - * This should not be using sched_clock(). A real patch is in progress - * to fix this up, until that is in place we need to disable preemption - * around sched_clock() in this function and set_io_start_time_ns(). - */ static inline void set_start_time_ns(struct request *req) { - preempt_disable(); - req->start_time_ns = sched_clock(); - preempt_enable(); + req->start_time_ns = ktime_get_ns(); } static inline void set_io_start_time_ns(struct request *req) { - preempt_disable(); - req->io_start_time_ns = sched_clock(); - preempt_enable(); + req->io_start_time_ns = ktime_get_ns(); } -static inline uint64_t rq_start_time_ns(struct request *req) +static inline u64 rq_start_time_ns(struct request *req) { return req->start_time_ns; } -static inline uint64_t rq_io_start_time_ns(struct request *req) +static inline u64 rq_io_start_time_ns(struct request *req) { return req->io_start_time_ns; } #else static inline void set_start_time_ns(struct request *req) {} static inline void set_io_start_time_ns(struct request *req) {} -static inline uint64_t rq_start_time_ns(struct request *req) +static inline u64 rq_start_time_ns(struct request *req) { return 0; } -static inline uint64_t rq_io_start_time_ns(struct request *req) +static inline u64 rq_io_start_time_ns(struct request *req) { return 0; } |