Nack! This is not a correct solution. The task is still accounted as contributor to load avarage which is inacceptable.
Look how other kthreads do it. Ancient mechanism used TASK_INTERUPTIBLE and blocked signals or cleared them. Also we had to handle freeze. Generally it was chumbersome. What's about modern state: I still did not figure this out. On Fri, Jun 5, 2026 at 5:26 PM Liu Kui <[email protected]> wrote: > > The indefinite wait_event() makes the watcher in TASK_UNINTERRUPTIBLE, > so a long-lived watched process triggers khungtaskd: > > INFO: task krpc_watcher:225326 blocked for more than 1228 seconds. > > Use wait_event_timeout() with a 60s period in a while-loop so the > task periodically reschedules and the warning goes away. > > Signed-off-by: Liu Kui <[email protected]> > --- > fs/fuse/kio/pcs/pcs_krpc.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/fs/fuse/kio/pcs/pcs_krpc.c b/fs/fuse/kio/pcs/pcs_krpc.c > index 7d5a9619276d..03ae995eaf55 100644 > --- a/fs/fuse/kio/pcs/pcs_krpc.c > +++ b/fs/fuse/kio/pcs/pcs_krpc.c > @@ -665,12 +665,22 @@ static bool process_has_exited(struct pid *pid) > return exited; > } > > +static inline bool krpc_watcher_should_stop(struct pid *watched_pid) > +{ > + return process_has_exited(watched_pid) || kthread_should_stop(); > +} > + > static int krpc_watcher_fn(void *data) > { > struct pcs_krpc_set *krpcs = data; > + struct pid *watched_pid = krpcs->watched_pid; > > - wait_event(krpcs->watched_pid->wait_pidfd, > - process_has_exited(krpcs->watched_pid) || > kthread_should_stop()); > + while (!krpc_watcher_should_stop(watched_pid)) { > + /* Periodic wakeup so khungtaskd doesn't flag the watcher. */ > + wait_event_timeout(watched_pid->wait_pidfd, > + krpc_watcher_should_stop(watched_pid), > + 60 * HZ); > + } > > kthread_stop(krpcs->sender_task); > put_task_struct(krpcs->sender_task); > -- > 2.50.1 (Apple Git-155) _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
