Commit 7be2a03e3174cee3a3cdcdf17db357470f51caff

Authored by Dmitry Adamushko
Committed by Ingo Molnar
1 parent 2232c2d8e0

softlockup: fix task state setting

kthread_stop() can be called when a 'watchdog' thread is executing after
kthread_should_stop() but before set_task_state(TASK_INTERRUPTIBLE).

Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 1 changed file with 7 additions and 6 deletions Side-by-side Diff

... ... @@ -216,26 +216,27 @@
216 216 /* initialize timestamp */
217 217 touch_softlockup_watchdog();
218 218  
  219 + set_current_state(TASK_INTERRUPTIBLE);
219 220 /*
220 221 * Run briefly once per second to reset the softlockup timestamp.
221 222 * If this gets delayed for more than 60 seconds then the
222 223 * debug-printout triggers in softlockup_tick().
223 224 */
224 225 while (!kthread_should_stop()) {
225   - set_current_state(TASK_INTERRUPTIBLE);
226 226 touch_softlockup_watchdog();
227 227 schedule();
228 228  
229 229 if (kthread_should_stop())
230 230 break;
231 231  
232   - if (this_cpu != check_cpu)
233   - continue;
  232 + if (this_cpu == check_cpu) {
  233 + if (sysctl_hung_task_timeout_secs)
  234 + check_hung_uninterruptible_tasks(this_cpu);
  235 + }
234 236  
235   - if (sysctl_hung_task_timeout_secs)
236   - check_hung_uninterruptible_tasks(this_cpu);
237   -
  237 + set_current_state(TASK_INTERRUPTIBLE);
238 238 }
  239 + __set_current_state(TASK_RUNNING);
239 240  
240 241 return 0;
241 242 }