Messages in this thread | | | Date | Mon, 14 Feb 2022 13:10:04 +0100 | From | Sebastian Andrzej Siewior <> | Subject | Re: [PATCH 7/8] kernel/fork: Only cache the VMAP stack in finish_task_switch(). |
| |
On 2022-02-11 15:55:01 [-0800], Andy Lutomirski wrote: > > Set the lowest bit of task_struct::stack if the stack was released via > > put_task_stack_sched() and needs a final free in > > delayed_put_task_struct(). If the bit is missing then a reference is > > held and put_task_stack() will release it. > > I don't understand what this bit is for or why the logic needs to be this > complicated. Can you set ->stack to NULL if and only if you freed it early?
What do I do if put_task_stack() is invoked from finish_task_switch() and I can't free but have to do something?
> > +static void free_thread_stack(struct task_struct *tsk, bool cache_only) > > This is messy. Please clean it up for real: > > static bool try_release_thread_stack_to_cache(struct vm_struct *vm) > { > for (...) try to put it in this slot; > } > > And the callers can do things like: > > if (try_release_thread_stack_to_cache(...)) > return; > > /* need to free for real */ > free it or delayed-free it.
I think I could use the first few bytes of the stack as a RCU-head. Let me try that.
> --Andy
Sebastian
| |