Re: [RFC][PATCH v6 1/2] printk: Make printk() completely async
From: Sergey Senozhatsky
Date:  Wed Mar 23 2016 - 04:40:48 EST
On (03/23/16 09:37), Sergey Senozhatsky wrote:
[..]
> ok, I'll take a look.
> 
> eventually (after 0003) vprintk_emit() is
> 
> 	if (in_sched) {
> 		__this_cpu_or(printk_pending,
> 				PRINTK_PENDING_OUTPUT);
> 		irq_work_queue(this_cpu_ptr(&wake_up_klogd_work));
> 	}
> 	local_irq_restore(flags);
> 	if (!in_sched) {
> 		lockdep_off();
> 		if (console_trylock())
> 			console_unlock();
> 		lockdep_on();
> 	}
> 
> > I do not say that it is a "dream-of-like" code. One important thing for
> > me is that it does not use "sync_printk" variable.
> >
> > You original code modified "sync_printk" according to "in_sched" and
> > "in_panic" variables earlier in vprintk_emit. Then it again checked
> > all three variables here which produced strange twists in my head ;-)
> 
hm... may be we can do even better.
move printk_pending and irq_work_queue() back to printk_deferred() and
do the preemption magic there. so vprintk_emit() can be lighter. will
take a look later today.
	-ss