On Tue, Jun 28, 2016 at 2:14 PM, Linus Torvalds <torva...@linux-foundation.org> wrote: > > I think the other way to handle the kernel stack reading would be to > simply make the stack freeing be RCU-delayed, and use the RCU list > itself as the stack cache.
That said, if you end up having to have a stack reference count for other reasons anyway, then I guess that creating a try_get_task_stack()/put_task_stack() model is fine. The RCU thing would only work for pure readers that can handle stale data (which would be the stack trace thing). It wouldn't work for the kthread to_live_kthread() case. Linus