[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgpGnFlTS+2Ugfw4@linutronix.de>
Date: Mon, 14 Feb 2022 13:10:04 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Andy Lutomirski <luto@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-ia64@...r.kernel.org,
Ben Segall <bsegall@...gle.com>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Ingo Molnar <mingo@...hat.com>,
Juri Lelli <juri.lelli@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
Vincent Guittot <vincent.guittot@...aro.org>
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
Powered by blists - more mailing lists