mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	sched: Fix more TASK_state comparisons
Boris reported hung_task splats after commit5aec788aeb("sched: Fix TASK_state comparisons"). Upon closer consideration of that change it doesn't only exclude TASK_KILLABLE, but also TASK_IDLE. Update the comment to reflect this fact and add an additional TASK_NOLOAD test to exclude them. Additionally, remove the TASK_FREEZABLE early exit from check_hung_task(), a freezable task is not a frozen task. Fixes:5aec788aeb("sched: Fix TASK_state comparisons") Reported-by: Borislav Petkov <bp@alien8.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Borislav Petkov <bp@alien8.de>
This commit is contained in:
		
							parent
							
								
									5aec788aeb
								
							
						
					
					
						commit
						fdf756f712
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -95,7 +95,7 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
 | 
			
		|||
	 * Ensure the task is not frozen.
 | 
			
		||||
	 * Also, skip vfork and any other user process that freezer should skip.
 | 
			
		||||
	 */
 | 
			
		||||
	if (unlikely(READ_ONCE(t->__state) & (TASK_FREEZABLE | TASK_FROZEN)))
 | 
			
		||||
	if (unlikely(READ_ONCE(t->__state) & TASK_FROZEN))
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
| 
						 | 
				
			
			@ -200,10 +200,14 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout)
 | 
			
		|||
				goto unlock;
 | 
			
		||||
			last_break = jiffies;
 | 
			
		||||
		}
 | 
			
		||||
		/* skip the TASK_KILLABLE tasks -- these can be killed */
 | 
			
		||||
		/*
 | 
			
		||||
		 * skip the TASK_KILLABLE tasks -- these can be killed
 | 
			
		||||
		 * skip the TASK_IDLE tasks -- those are genuinely idle
 | 
			
		||||
		 */
 | 
			
		||||
		state = READ_ONCE(t->__state);
 | 
			
		||||
		if ((state & TASK_UNINTERRUPTIBLE) &&
 | 
			
		||||
		    !(state & TASK_WAKEKILL))
 | 
			
		||||
		    !(state & TASK_WAKEKILL) &&
 | 
			
		||||
		    !(state & TASK_NOLOAD))
 | 
			
		||||
			check_hung_task(t, timeout);
 | 
			
		||||
	}
 | 
			
		||||
 unlock:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue