On Tue, Jun 28, 2016 at 2:35 PM, Linus Torvalds
<[email protected]> wrote:
> On Tue, Jun 28, 2016 at 2:21 PM, Andy Lutomirski <[email protected]> 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