On Tue, Jun 28, 2016 at 2:35 PM, Linus Torvalds
<torva...@linux-foundation.org> wrote:
> On Tue, Jun 28, 2016 at 2:21 PM, Andy Lutomirski <l...@amacapital.net> wrote:
>
>> If so, that seems considerably more complicated than just adding a reference 
>> count.
>
> Fair enough.

Ahh, and if you put the reference count just in the task_struct (next
to the ->stack pointer), then I guess that's particularly trivial.

Then try_get_task_stack(tsk) becomes

     void *try_get_task_stack(struct task_struct *tsk)
     {
          void *stack = tsk->stack;
          if (!atomic_inc_not_zero(&tsk->stackref))
               stack = NULL;
          return stack;
     }

ok, color me convinced.

               Linus

Reply via email to