Skip to content

kthread: kill task_get_live_kthread()

Oleg Nesterov lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kthread: introduce to_live_kthread()kernel/kthread.c+16 -100 replies
2/2kthread: kill task_get_live_kthread()kernel/kthread.c+7 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] kthread: kill task_get_live_kthread()

Hello.

Imho, task_get_live_kthread() is very confusing and unneeded. 2a1d4460 copied get_task_struct() + "vfork_done != NULL" from kthread_stop(), but only kthread_stop() needs them both.

It needs get_task_struct() because kthread_stop() can be used when the caller doesn't have a reference but we know that this thread can't exit itself.

At the same time, if it can exit we do not need get_task_struct() (the caller must have a reference) but we need to ensure we do not use to_kthread(NULL) if it has exited.

I think that kthread_park/unpark can simply use to_kthread(), but this series only removes get_task_struct() and keeps "alive" check.

But the actual reason for this cleanup is that I do not understand why park/unpark abuse kthread.c.

Thomas, can't we move kthread->parked/cpu to smpboot_thread_data and move all this code into kernel/smpboot.c? Just for example, why kthread() does __kthread_parkme() ? smpboot_thread_fn() can do this at the start.

Or this would be wrong/undesirable by some reason?

Oleg.