[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171102131059.4d8935a9@gandalf.local.home>
Date: Thu, 2 Nov 2017 13:10:59 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, Cong Wang <xiyou.wangcong@...il.com>,
Dave Hansen <dave.hansen@...el.com>,
Johannes Weiner <hannes@...xchg.org>,
Mel Gorman <mgorman@...e.de>, Michal Hocko <mhocko@...nel.org>,
Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Vlastimil Babka <vbabka@...e.cz>,
"yuwang.yuwang" <yuwang.yuwang@...baba-inc.com>,
Peter Zijlstra <peterz@...radead.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jan Kara <jack@...e.cz>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [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@...dmis.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
Powered by blists - more mailing lists