Re: [PATCH] lib/klist: Remove mb() before wake_up_process

Greg KH
2022-06-15T07:41:18Z

On Wed, Jun 15, 2022 at 11:30:51AM +0800, chi wu wrote:
> Greg KH <gregkh@linuxfoundation.org> 于2022年6月14日周二 22:58写道：
> >
> > On Tue, Jun 14, 2022 at 10:44:43PM +0800, wuchi wrote:
> > > Function wake_up_process always executes a general memory barrier,
> > > so remove the mb() before it.
> >
> > Really? On all systems? I do not see that, where does it happen?
> >
> As I understand it, it is on all systems. Please help correct the
> mistake, thanks.
>
> 1. Follow Documentation/memory-barriers.txt line 2128 ~ 2278,
> especially line 2187 ~ 2202 snippet:
> A general memory barrier is executed by wake_up() if it wakes
> something up.
> If it doesn't wake anything up then a memory barrier may or may not be
> executed; you must not rely on it.

So as the documentation states, it might not be there, so if you have to
have a memory barrier, you must not rely on this function to provide it.

So unless you have testing proof otherwise, the code should be correct
as-is.

thanks,

greg k-h