forked from mirrors/linux
		
	block: disable preemption before using sched_clock()
Commit 9195291e5f 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.
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
			
			
This commit is contained in:
		
							parent
							
								
									713b686494
								
							
						
					
					
						commit
						28f4197e5d
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		| 
						 | 
					@ -1211,14 +1211,23 @@ struct work_struct;
 | 
				
			||||||
int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
 | 
					int kblockd_schedule_work(struct request_queue *q, struct work_struct *work);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_BLK_CGROUP
 | 
					#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)
 | 
					static inline void set_start_time_ns(struct request *req)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						preempt_disable();
 | 
				
			||||||
	req->start_time_ns = sched_clock();
 | 
						req->start_time_ns = sched_clock();
 | 
				
			||||||
 | 
						preempt_enable();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline void set_io_start_time_ns(struct request *req)
 | 
					static inline void set_io_start_time_ns(struct request *req)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						preempt_disable();
 | 
				
			||||||
	req->io_start_time_ns = sched_clock();
 | 
						req->io_start_time_ns = sched_clock();
 | 
				
			||||||
 | 
						preempt_enable();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline uint64_t rq_start_time_ns(struct request *req)
 | 
					static inline uint64_t rq_start_time_ns(struct request *req)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue