On Sat, Jun 25, 2016 at 4:30 PM, Andy Lutomirski <l...@amacapital.net> wrote: > > Maybe I'm misunderstanding the role of release_task. It looks like > there's this path in the scheduler I can borrow: > > if (unlikely(prev_state == TASK_DEAD)) { > > With a kludge in place to free the stack in there and release_task and > __put_task_struct, whichever is first, I get a nice speedup. > Benchmarks coming later on. Can I rely on that code path always being > called?
Absolutely. That's the normal "task is done, put the thread struct". IOW, that's the final "put_task_struct()" that the task "itself" calls as it exits - there may be other things that hold a reference to the task struct, but that's where you should free the stack because the thread itself is done with it.. Linus