From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756133AbcDDQDU (ORCPT ); Mon, 4 Apr 2016 12:03:20 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:32826 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755616AbcDDQDS (ORCPT ); Mon, 4 Apr 2016 12:03:18 -0400 Date: Tue, 5 Apr 2016 02:01:05 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Jan Kara , Sergey Senozhatsky , Andrew Morton , Jan Kara , Tejun Heo , Tetsuo Handa , linux-kernel@vger.kernel.org, Byungchul Park , Sergey Senozhatsky Subject: Re: [RFC][PATCH v8 1/2] printk: Make printk() completely async Message-ID: <20160404170105.GA573@swordfish> References: <1458834203-3392-1-git-send-email-sergey.senozhatsky@gmail.com> <1458834203-3392-2-git-send-email-sergey.senozhatsky@gmail.com> <20160331111229.GB1023@pathway.suse.cz> <20160331115250.GB6651@quack.suse.cz> <20160404094108.GI1023@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160404094108.GI1023@pathway.suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On (04/04/16 11:41), Petr Mladek wrote: [..] > > So what about having printk_kthread_func() like: > > > > while (1) { > > set_current_state(TASK_INTERRUPTIBLE); > > if (!need_flush_console) > > schedule(); > > __set_current_state(TASK_RUNNING); > > need_flush_console = false; > > console_lock(); > > console_unlock(); > > } > > > > In vprintk_emit() we do: > > > > if (!in_panic && printk_kthread) { > > /* Offload printing to a schedulable context. */ > > need_flush_console = true; > > wake_up_process(printk_kthread); > > } else { > > ... > > > > This guarantees that after message was appended to the buffer in > > vprintk_emit(), the message got either printed by console_unlock() or > > printk_kthread is in TASK_RUNNING state and will call console_unlock() once > > scheduled. It also guarantees that printk_kthread_func() won't loop forever > > when there's nothing to print. And that is all we need... > > > > I think the simplicity of this is worth the possible extra loops in > > printk_kthread_func(). > > I do not have strong opinion about this. I agree that the simplicity > of your proposal is nice. You are much more experienced kernel > developer. If you say that the potential extra loop is fine, I am > fine with it as well :-) > works for me, re-sent. the patch is even smaller now, and we almost have nothing else to cut off from it :) -ss