mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	workqueue: use system_highpri_wq for highpri workers in rebind_workers()
In rebind_workers(), we do inserting a work to rebind to cpu for busy workers. Currently, in this case, we use only system_wq. This makes a possible error situation as there is mismatch between cwq->pool and worker->pool. To prevent this, we should use system_highpri_wq for highpri worker to match theses. This implements it. tj: Rephrased comment a bit. Signed-off-by: Joonsoo Kim <js1304@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
		
							parent
							
								
									1aabe902ca
								
							
						
					
					
						commit
						e2b6a6d570
					
				
					 1 changed files with 14 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -1741,6 +1741,7 @@ static void rebind_workers(struct global_cwq *gcwq)
 | 
			
		|||
	/* rebind busy workers */
 | 
			
		||||
	for_each_busy_worker(worker, i, pos, gcwq) {
 | 
			
		||||
		struct work_struct *rebind_work = &worker->rebind_work;
 | 
			
		||||
		struct workqueue_struct *wq;
 | 
			
		||||
 | 
			
		||||
		/* morph UNBOUND to REBIND */
 | 
			
		||||
		worker->flags &= ~WORKER_UNBOUND;
 | 
			
		||||
| 
						 | 
				
			
			@ -1750,11 +1751,20 @@ static void rebind_workers(struct global_cwq *gcwq)
 | 
			
		|||
				     work_data_bits(rebind_work)))
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		/* wq doesn't matter, use the default one */
 | 
			
		||||
		debug_work_activate(rebind_work);
 | 
			
		||||
		insert_work(get_cwq(gcwq->cpu, system_wq), rebind_work,
 | 
			
		||||
			    worker->scheduled.next,
 | 
			
		||||
			    work_color_to_flags(WORK_NO_COLOR));
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * wq doesn't really matter but let's keep @worker->pool
 | 
			
		||||
		 * and @cwq->pool consistent for sanity.
 | 
			
		||||
		 */
 | 
			
		||||
		if (worker_pool_pri(worker->pool))
 | 
			
		||||
			wq = system_highpri_wq;
 | 
			
		||||
		else
 | 
			
		||||
			wq = system_wq;
 | 
			
		||||
 | 
			
		||||
		insert_work(get_cwq(gcwq->cpu, wq), rebind_work,
 | 
			
		||||
			worker->scheduled.next,
 | 
			
		||||
			work_color_to_flags(WORK_NO_COLOR));
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue