Messages in this thread | | | From | Linus Torvalds <> | Date | Sat, 25 Jun 2022 16:48:38 -0700 | Subject | Re: re. Spurious wakeup on a newly created kthread |
| |
On Sat, Jun 25, 2022 at 4:43 PM Linus Torvalds <torvalds@linux-foundation.org> wrote: > > I wonder if we could basically get rid of every use of 'current' in > kernel/fork.c with just a task pointer that is passed in, and then for > kernel threads pass in 'init_task'.
That might even help code generation. Instead of doing the 'look up current' all the time, just having the parent task as an argument might actually simplify things.
We historically used to do those kinds of things exactly because it helps generate better code (particularly with inline functions, and things like 'exit' that calls many different things), but have mostly avoided it because 'current' may generate some small asm snippet all the time, but it clarifies the "it can't be a random thread" and locking issues.
But if it's always 'current or init_task', we don't have many locking issues.
Of course, there might be some reason not to want to use init_task because it is _so_ special, and so parenting to something silly like kthreadd ends up being simpler. But..
Anyway, the whole "don't wake up thread until it's all done" is a separate and independent issue from the "odd use of kthreadd" issue.
Linus
| |