lkml.org 
[lkml]   [2022]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH printk v3 03/15] printk: add missing memory barrier to wake_up_klogd()
On Wed 2022-04-20 01:52:25, John Ogness wrote:
> It is important that any new records are visible to preparing
> waiters before the waker checks if the wait queue is empty.
> Otherwise it is possible that:
>
> - there are new records available
> - the waker sees an empty wait queue and does not wake
> - the preparing waiter sees no new records and begins to wait
>
> This is exactly the problem that the function description of
> waitqueue_active() warns about.
>
> Use wq_has_sleeper() instead of waitqueue_active() because it
> includes the necessary full memory barrier.
>
> Signed-off-by: John Ogness <john.ogness@linutronix.de>

Great catch! Looks good to me.

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

\
 
 \ /
  Last update: 2022-04-20 14:35    [W:0.174 / U:0.156 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site