[PATCH] arm64/sve: Delay freeing memory in fpsimd_flush_thread()

Dave Martin Dave.Martin at arm.com
Thu Jul 29 08:37:44 PDT 2021


On Thu, Jul 29, 2021 at 04:39:04PM +0200, Sebastian Andrzej Siewior wrote:
> On 2021-07-29 15:26:16 [+0100], Mark Brown wrote:
> > On Thu, Jul 29, 2021 at 12:52:14PM +0200, Sebastian Andrzej Siewior wrote:
> > 
> > > +static void *sve_free_atomic(struct task_struct *task)
> > > +{
> > > +	void *sve_state = task->thread.sve_state;
> > > +
> > > +	WARN_ON(test_tsk_thread_flag(task, TIF_SVE));
> > > +
> > > +	task->thread.sve_state = NULL;
> > > +	return sve_state;
> > > +}
> > 
> > This has exactly one caller - why not just inline it there?  It'd
> > probably make it easier to follow what's going on.
> 
> In case someone makes changes to the non-atomic version which should
> also happen here. But I can inline it.

Not critical, but you could drop a

	/* defer kfree() while in atomic context */

or similar in the code just to make it absolutely clear why sve_state
is temporarily stashed rather than just being freed immediately.

The whole function would be small enough that it's probably still
reasonably obvious even without the comment, though.

Cheers
---Dave



More information about the linux-arm-kernel mailing list