"Rafael J. Wysocki" <r...@rjwysocki.net> writes:

> On Thursday, September 13, 2018 6:08:51 PM CEST Vitaly Kuznetsov wrote:
...

>> +static int hungtask_pm_notify(struct notifier_block *self,
>> +                          unsigned long action, void *hcpu)
>> +{
>> +    switch (action) {
>> +    case PM_SUSPEND_PREPARE:
>> +    case PM_HIBERNATION_PREPARE:
>> +            hung_detector_suspended = true;
>> +            break;
>> +    case PM_POST_SUSPEND:
>> +    case PM_POST_HIBERNATION:
>> +            hung_detector_suspended = false;
>> +            break;
>> +    default:
>> +            break;
>> +    }
>> +    return NOTIFY_OK;
>> +}
>> +
>>  /*
>>   * kthread which checks for tasks stuck in D state
>>   */
>> @@ -261,7 +282,8 @@ static int watchdog(void *dummy)
>>              interval = min_t(unsigned long, interval, timeout);
>>              t = hung_timeout_jiffies(hung_last_checked, interval);
>
> Since you are adding the notifier anyway, what about designing it to make
> the thread wait on _PREPARE until the notifier kicks it again on exit
> fron suspend/hibernation?
>

We can either park the kthread (kthread_park/unpark) or make it go away
completely by doing kthread_stop/kthread_run(). I'm leaning toward
parking, what do you think?

-- 
  Vitaly

Reply via email to