lkml.org 
[lkml]   [2017]   [Nov]   [3]   [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 Fri, 3 Nov 2017 11:19:53 +0100
Jan Kara <jack@suse.cz> wrote:

> Hi,
>
> On Thu 02-11-17 13:06:05, Steven Rostedt wrote:
> > + if (spin) {
> > + /* We spin waiting for the owner to release us */
> > + spin_acquire(&console_owner_dep_map, 0, 0, _THIS_IP_);
> > + /* Owner will clear console_waiter on hand off */
> > + while (!READ_ONCE(console_waiter))
> > + cpu_relax();
>
> Hum, what prevents us from rescheduling here? And what if the process
> stored in console_owner is scheduled out? Both seem to be possible with
> CONFIG_PREEMPT kernel? Unless I'm missing something you will need to
> disable preemption in some places...

Yes you are missing something ;-)

>
> Other than that I like the simplicity of your approach.
>
> Honza
>
> > +
> > + spin_release(&console_owner_dep_map, 1, _THIS_IP_);
> > + printk_safe_exit_irqrestore(flags);

The above line re-enables interrupts. And is done for both the
console_owner and the console_waiter. These are only held with
interrupts disabled. Nothing will preempt it. In fact, if it could,
lockdep would complain (it did in when I screwed it up at first ;-)


-- Steve

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