lkml.org 
[lkml]   [2017]   [Nov]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] printk: Add console owner and waiter logic to load balance console writes
On Thu, 2 Nov 2017 13:06:05 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> + raw_spin_lock(&console_owner_lock);
> + waiter = console_waiter;
> + console_owner = NULL;
> + raw_spin_unlock(&console_owner_lock);
> +
> + /*
> + * If there is a waiter waiting for us, then pass the
> + * rest of the work load over to that waiter.
> + */
> + if (waiter)
> + break;
> +

Hmm, do I need a READ_ONCE() here?

Can gcc do the load of console_waiter outside the spin lock where
if (waiter) is done?

Although it doesn't really matter, but it just makes the code more
fragile if it can. Should this be:

raw_spin_lock(&console_owner_lock);
waiter = READ_ONCE(console_waiter);
console_owner = NULL;
raw_spin_unlock(&console_owner_lock);

/*
* If there is a waiter waiting for us, then pass the
* rest of the work load over to that waiter.
*/
if (waiter)
break;

?

-- Steve

\
 
 \ /
  Last update: 2017-11-02 18:11    [W:0.214 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site