History

block: disable preemption before using sched_clock()

Commit 9195291e5f05e01d67f9a09c756b8aca8f009089 added calls to sched_clock() from preemptible code. sched_clock() is both the wrong interface AND cannot be called without preempt disabled. Apply a temporary fix to get rid of the warnings, a real patch is in the works.

Jens Axboe committed 16 years ago

Commit 28f41971 parent 713b6861 file · +9 −0Browse files

Showing the changes to include/linux/blkdev.h (1 of 1 file). Show all

Unified · Split

include/linux/blkdev.h+9−0
@@ -1211,14 +1211,23 @@ struct work_struct; · 1210 unmodified lines
12111211 int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
12121212
12131213 #ifdef CONFIG_BLK_CGROUP
1214+/*
1215+ * This should not be using sched_clock(). A real patch is in progress
1216+ * to fix this up, until that is in place we need to disable preemption
1217+ * around sched_clock() in this function and set_io_start_time_ns().
1218+ */
12141219 static inline void set_start_time_ns(struct request *req)
12151220 {
1221+ preempt_disable();
12161222 req->start_time_ns = sched_clock();
1223+ preempt_enable();
12171224 }
12181225
12191226 static inline void set_io_start_time_ns(struct request *req)
12201227 {
1228+ preempt_disable();
12211229 req->io_start_time_ns = sched_clock();
1230+ preempt_enable();
12221231 }
12231232
12241233 static inline uint64_t rq_start_time_ns(struct request *req)