From 522a777566f5669606a1227bf13f3fb40963780b Mon Sep 17 00:00:00 2001 From: Omar Sandoval Date: Wed, 9 May 2018 02:08:53 -0700 Subject: block: consolidate struct request timestamp fields Currently, struct request has four timestamp fields: - A start time, set at get_request time, in jiffies, used for iostats - An I/O start time, set at start_request time, in ktime nanoseconds, used for blk-stats (i.e., wbt, kyber, hybrid polling) - Another start time and another I/O start time, used for cfq and bfq These can all be consolidated into one start time and one I/O start time, both in ktime nanoseconds, shaving off up to 16 bytes from struct request depending on the kernel config. Signed-off-by: Omar Sandoval Signed-off-by: Jens Axboe --- include/linux/blkdev.h | 38 ++------------------------------------ 1 file changed, 2 insertions(+), 36 deletions(-) (limited to 'include/linux/blkdev.h') diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 9ef412666df1..e42d510daf3c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -205,7 +205,8 @@ struct request { struct gendisk *rq_disk; struct hd_struct *part; - unsigned long start_time; + /* Time that I/O was submitted to the kernel. */ + u64 start_time_ns; /* Time that I/O was submitted to the device. */ u64 io_start_time_ns; @@ -277,8 +278,6 @@ struct request { #ifdef CONFIG_BLK_CGROUP struct request_list *rl; /* rl this rq is alloced from */ - unsigned long long cgroup_start_time_ns; - unsigned long long cgroup_io_start_time_ns; /* when passed to hardware */ #endif }; @@ -1798,39 +1797,6 @@ int kblockd_schedule_work(struct work_struct *work); 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 -static inline void set_start_time_ns(struct request *req) -{ - req->cgroup_start_time_ns = ktime_get_ns(); -} - -static inline void set_io_start_time_ns(struct request *req) -{ - req->cgroup_io_start_time_ns = ktime_get_ns(); -} - -static inline u64 rq_start_time_ns(struct request *req) -{ - return req->cgroup_start_time_ns; -} - -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 u64 rq_start_time_ns(struct request *req) -{ - return 0; -} -static inline u64 rq_io_start_time_ns(struct request *req) -{ - return 0; -} -#endif - #define MODULE_ALIAS_BLOCKDEV(major,minor) \ MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor)) #define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \ -- cgit