mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-19 05:12:39 +00:00
block: use ktime_get_ns() instead of sched_clock() for cfq and bfq
cfq and bfq have 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 28f4197e5d
("block: disable preemption before
using sched_clock()").
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
544ccc8dc9
commit
84c7afcebe
4 changed files with 57 additions and 63 deletions
|
@ -1799,42 +1799,33 @@ int kblockd_schedule_work_on(int cpu, struct work_struct *work);
|
|||
int kblockd_mod_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->cgroup_start_time_ns = sched_clock();
|
||||
preempt_enable();
|
||||
req->cgroup_start_time_ns = ktime_get_ns();
|
||||
}
|
||||
|
||||
static inline void set_io_start_time_ns(struct request *req)
|
||||
{
|
||||
preempt_disable();
|
||||
req->cgroup_io_start_time_ns = sched_clock();
|
||||
preempt_enable();
|
||||
req->cgroup_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->cgroup_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->cgroup_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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue