Re: Qestion about device link
From: Rafael J. Wysocki
Date: Wed May 12 2021 - 07:32:35 EST
On Wed, May 12, 2021 at 8:38 AM Hillf Danton <hdanton@xxxxxxxx> wrote:
>
> On Tue, 11 May 2021 21:43:40 Rafael J. Wysocki wrote:
> > > #ifdef CONFIG_SRCU
> > > +static void __device_link_free_fn(struct work_struct *work)
> > > +{
> > > + device_link_free(container_of(work, struct device_link, srcu.work));
> > > +}
> > > +
> > > static void __device_link_free_srcu(struct rcu_head *rhead)
> > > {
> > > - device_link_free(container_of(rhead, struct device_link, rcu_head));
> > > + struct device_link *link = container_of(rhead, struct device_link,
> > > + srcu.rhead);
> > > + struct work_struct *work = &link->srcu.work;
> > > +
> > > + /*
> > > + * Because device_link_free() may sleep in some cases, schedule the
> > > + * execution of it instead of invoking it directly.
> > > + */
> > > + INIT_WORK(work, __device_link_free_fn);
> > > + schedule_work(work);
> > > }
>
> Nope, you need something like queue_work(system_unbound_wq, work); instead
> because of the blocking wq callback.
system_long_wq rather, as it really doesn't matter when it gets completed.