mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	io_uring: minor io_cqring_wait() optimization
Move up the block manipulating the sig variable to execute code that may encounter an error and exit first before continuing executing the rest of the function and avoid useless computations Signed-off-by: Olivier Langlois <olivier@trillion01.com> Link: https://lore.kernel.org/r/84513f7cc1b1fb31d8f4cb910aee033391d036b4.1646777484.git.olivier@trillion01.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
		
							parent
							
								
									4f57f06ce2
								
							
						
					
					
						commit
						950e79dd73
					
				
					 1 changed files with 8 additions and 8 deletions
				
			
		| 
						 | 
				
			
			@ -7919,14 +7919,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
 | 
			
		|||
			break;
 | 
			
		||||
	} while (1);
 | 
			
		||||
 | 
			
		||||
	if (uts) {
 | 
			
		||||
		struct timespec64 ts;
 | 
			
		||||
 | 
			
		||||
		if (get_timespec64(&ts, uts))
 | 
			
		||||
			return -EFAULT;
 | 
			
		||||
		timeout = ktime_add_ns(timespec64_to_ktime(ts), ktime_get_ns());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (sig) {
 | 
			
		||||
#ifdef CONFIG_COMPAT
 | 
			
		||||
		if (in_compat_syscall())
 | 
			
		||||
| 
						 | 
				
			
			@ -7940,6 +7932,14 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
 | 
			
		|||
			return ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (uts) {
 | 
			
		||||
		struct timespec64 ts;
 | 
			
		||||
 | 
			
		||||
		if (get_timespec64(&ts, uts))
 | 
			
		||||
			return -EFAULT;
 | 
			
		||||
		timeout = ktime_add_ns(timespec64_to_ktime(ts), ktime_get_ns());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	init_waitqueue_func_entry(&iowq.wq, io_wake_function);
 | 
			
		||||
	iowq.wq.private = current;
 | 
			
		||||
	INIT_LIST_HEAD(&iowq.wq.entry);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue