[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+HUmGjX4_4_UXWNn=EehQ_3QtFPZq8RJU146r-nc0nA8apx7w@mail.gmail.com>
Date: Wed, 16 Sep 2020 23:33:21 -0700
From: Francesco Ruggeri <fruggeri@...sta.com>
To: open list <linux-kernel@...r.kernel.org>,
netdev <netdev@...r.kernel.org>, xiyou.wangcong@...il.com,
ap420073@...il.com, andriin@...com,
Eric Dumazet <edumazet@...gle.com>, jiri@...lanox.com,
ast@...nel.org, Jakub Kicinski <kuba@...nel.org>,
David Miller <davem@...emloft.net>,
Francesco Ruggeri <fruggeri@...sta.com>
Subject: Re: [PATCH] net: make netdev_wait_allrefs wake-able
> static inline void dev_put(struct net_device *dev)
> {
> + struct task_struct *destroy_task = dev->destroy_task;
> +
> this_cpu_dec(*dev->pcpu_refcnt);
> + if (destroy_task)
> + wake_up_process(destroy_task);
> }
I just realized that this introduces a race, if dev_put drops the last
reference, an already running netdev_wait_allrefs runs to completion
and then dev_put tries to wake it up.
Any suggestions on how to avoid this without resorting to
locking?
Thanks,
Francesco
Powered by blists - more mailing lists