Re: [PATCH v9] kernel/fork: beware of __put_task_struct calling context

From: Matthew Wilcox
Date: Tue May 16 2023 - 17:41:57 EST


On Tue, May 16, 2023 at 02:05:55PM -0700, Andrew Morton wrote:
> On Tue, 16 May 2023 20:24:04 +0100 Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote:
>
> > On Tue, May 16, 2023 at 04:14:41PM -0300, Wander Lairson Costa wrote:
> > > +void __put_task_struct_rcu_cb(struct rcu_head *rhp)
> > > +{
> > > + struct task_struct *task = container_of(rhp, struct task_struct, rcu);
> > > +
> > > + __put_task_struct(task);
> > > +}
> > > +EXPORT_SYMBOL_GPL(__put_task_struct_rcu_cb);
> >
> > Why does this need to be exported when its only caller is within the
> > main kernel and cannot possibly be built as a module?
>
> It's referenced by inlined put_task_struct(), which is called from all
> over.

Oh, I missed that put_task_struct() was still inlined. Should it be?
It seems quite large now.

> However I believe the above definition could be inside #ifdef
> CONFIG_PREEMPT_RT, to save a scrap of resources?