mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	sched: fix sync wakeups
Pawel Dziekonski reported that the openssl benchmark and his quantum chemistry application both show slowdowns due to the scheduler under-parallelizing execution. The reason are pipe wakeups still doing 'sync' wakeups which overrides the normal buddy wakeup logic - even if waker and wakee are loosely coupled. Fix an inversion of logic in the buddy wakeup code. Reported-by: Pawel Dziekonski <dzieko@gmail.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
		
							parent
							
								
									f90d4118ba
								
							
						
					
					
						commit
						d942fb6c7d
					
				
					 2 changed files with 6 additions and 9 deletions
				
			
		| 
						 | 
					@ -2266,6 +2266,10 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
 | 
				
			||||||
	if (!sched_feat(SYNC_WAKEUPS))
 | 
						if (!sched_feat(SYNC_WAKEUPS))
 | 
				
			||||||
		sync = 0;
 | 
							sync = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!sync && (current->se.avg_overlap < sysctl_sched_migration_cost &&
 | 
				
			||||||
 | 
								    p->se.avg_overlap < sysctl_sched_migration_cost))
 | 
				
			||||||
 | 
							sync = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_SMP
 | 
					#ifdef CONFIG_SMP
 | 
				
			||||||
	if (sched_feat(LB_WAKEUP_UPDATE)) {
 | 
						if (sched_feat(LB_WAKEUP_UPDATE)) {
 | 
				
			||||||
		struct sched_domain *sd;
 | 
							struct sched_domain *sd;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1179,20 +1179,15 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
 | 
				
			||||||
	    int idx, unsigned long load, unsigned long this_load,
 | 
						    int idx, unsigned long load, unsigned long this_load,
 | 
				
			||||||
	    unsigned int imbalance)
 | 
						    unsigned int imbalance)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct task_struct *curr = this_rq->curr;
 | 
					 | 
				
			||||||
	struct task_group *tg;
 | 
					 | 
				
			||||||
	unsigned long tl = this_load;
 | 
						unsigned long tl = this_load;
 | 
				
			||||||
	unsigned long tl_per_task;
 | 
						unsigned long tl_per_task;
 | 
				
			||||||
 | 
						struct task_group *tg;
 | 
				
			||||||
	unsigned long weight;
 | 
						unsigned long weight;
 | 
				
			||||||
	int balanced;
 | 
						int balanced;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!(this_sd->flags & SD_WAKE_AFFINE) || !sched_feat(AFFINE_WAKEUPS))
 | 
						if (!(this_sd->flags & SD_WAKE_AFFINE) || !sched_feat(AFFINE_WAKEUPS))
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (sync && (curr->se.avg_overlap > sysctl_sched_migration_cost ||
 | 
					 | 
				
			||||||
			p->se.avg_overlap > sysctl_sched_migration_cost))
 | 
					 | 
				
			||||||
		sync = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * If sync wakeup then subtract the (maximum possible)
 | 
						 * If sync wakeup then subtract the (maximum possible)
 | 
				
			||||||
	 * effect of the currently running task from the load
 | 
						 * effect of the currently running task from the load
 | 
				
			||||||
| 
						 | 
					@ -1419,9 +1414,7 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
 | 
				
			||||||
	if (!sched_feat(WAKEUP_PREEMPT))
 | 
						if (!sched_feat(WAKEUP_PREEMPT))
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (sched_feat(WAKEUP_OVERLAP) && (sync ||
 | 
						if (sched_feat(WAKEUP_OVERLAP) && sync) {
 | 
				
			||||||
			(se->avg_overlap < sysctl_sched_migration_cost &&
 | 
					 | 
				
			||||||
			 pse->avg_overlap < sysctl_sched_migration_cost))) {
 | 
					 | 
				
			||||||
		resched_task(curr);
 | 
							resched_task(curr);
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue