Re: [PATCH v2 1/1] sched: watchdog: Touch kernel watchdog with sched count

From: Peter Zijlstra
Date: Wed Oct 21 2020 - 06:00:08 EST


On Tue, Oct 20, 2020 at 01:57:04PM -0700, Xi Wang wrote:
> The main purpose of kernel watchdog is to test whether scheduler can
> still schedule tasks on a cpu. In order to reduce latency / jitter
> from periodically invoking watchdog reset in thread context, we can
> simply test if pick_next_task can run. This is done by forcing resched
> and checking rq->sched_count.

Whitespace exists for a reason, use more of it. Also, the above isn't
actually accurate anymore and carried over from the previous
implementation.

> Compared to actually resetting watchdog
> from cpu stop / migration threads, we lose coverage on: a migration
> thread actually get picked and we actually context switch to the
> migration thread. These steps are unlikely to silently fail. The
> change would provide nearly the same level of protection with less
> overhead.
>
> With this patch we can still switch back to the old method with the
> boot option watchdog_touch_with_thread. However code for the old
> method can be completely removed in the future.

I'd suggest removing all the #ifdef and config muck. Either its a good
idea or it's not.