mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	sched: Use fair:prio_changed() instead of ad-hoc implementation
set_user_nice() implements its own version of fair::prio_changed() and therefore misses a specific optimization towards nohz_full CPUs that avoid sending an resched IPI to a reniced task running alone. Use the proper callback instead. Reported-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Ingo Molnar <mingo@kernel.org> Link: https://lkml.kernel.org/r/20191203160106.18806-3-frederic@kernel.org
This commit is contained in:
		
							parent
							
								
									7c2e8bbd87
								
							
						
					
					
						commit
						5443a0be61
					
				
					 1 changed files with 8 additions and 8 deletions
				
			
		| 
						 | 
					@ -4540,17 +4540,17 @@ void set_user_nice(struct task_struct *p, long nice)
 | 
				
			||||||
	p->prio = effective_prio(p);
 | 
						p->prio = effective_prio(p);
 | 
				
			||||||
	delta = p->prio - old_prio;
 | 
						delta = p->prio - old_prio;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (queued) {
 | 
						if (queued)
 | 
				
			||||||
		enqueue_task(rq, p, ENQUEUE_RESTORE | ENQUEUE_NOCLOCK);
 | 
							enqueue_task(rq, p, ENQUEUE_RESTORE | ENQUEUE_NOCLOCK);
 | 
				
			||||||
		/*
 | 
					 | 
				
			||||||
		 * If the task increased its priority or is running and
 | 
					 | 
				
			||||||
		 * lowered its priority, then reschedule its CPU:
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		if (delta < 0 || (delta > 0 && task_running(rq, p)))
 | 
					 | 
				
			||||||
			resched_curr(rq);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if (running)
 | 
						if (running)
 | 
				
			||||||
		set_next_task(rq, p);
 | 
							set_next_task(rq, p);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						 * If the task increased its priority or is running and
 | 
				
			||||||
 | 
						 * lowered its priority, then reschedule its CPU:
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						p->sched_class->prio_changed(rq, p, old_prio);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
out_unlock:
 | 
					out_unlock:
 | 
				
			||||||
	task_rq_unlock(rq, p, &rf);
 | 
						task_rq_unlock(rq, p, &rf);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue