From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934515AbcATKJQ (ORCPT ); Wed, 20 Jan 2016 05:09:16 -0500 Received: from mx2.suse.de ([195.135.220.15]:38484 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933591AbcATKJM (ORCPT ); Wed, 20 Jan 2016 05:09:12 -0500 Date: Wed, 20 Jan 2016 11:09:09 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: Sergey Senozhatsky , Andrew Morton , Tejun Heo , Jan Kara , Kyle McMartin , Dave Jones , Calvin Owens , linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCH -next 1/2] printk: move can_use_console out of console_trylock_for_printk Message-ID: <20160120100909.GA3305@pathway.suse.cz> References: <1452747443-9927-1-git-send-email-sergey.senozhatsky@gmail.com> <1452747443-9927-2-git-send-email-sergey.senozhatsky@gmail.com> <20160118154228.GY3178@pathway.suse.cz> <20160119004236.GA4963@swordfish> <20160119133136.GA2148@dhcp128.suse.cz> <20160119150040.GA558@swordfish> <20160119161656.GC2148@dhcp128.suse.cz> <20160120041804.GB506@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160120041804.GB506@swordfish> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2016-01-20 13:18:04, Sergey Senozhatsky wrote: > On (01/19/16 17:16), Petr Mladek wrote: > > do_cond_resched = console_may_schedule; > > console_may_schedule = 0; > > > > +again: > > + if (!can_use_console()) { > > + console_locked = 0; > > + up_console_sem(); > > + return; > > } > > > > /* flush buffered message fragment immediately to console */ > > console_cont_flush(text, sizeof(text)); > > -again: > > for (;;) { > > struct printk_log *msg; > > > > looks better. we do extra IRQ disable/enable (spin lock irq) when we jump > to `again' label, but I don't think this introduces any significant overhead. > however, if it does, we always can avoid extra console_cont_flush() by simply > checking @retry -- it's `false' only once, when we execute this part for > the first time in the current console_unlock() call; all goto-jumps imply > that @retry is `true'. IMHO, the extra spin_lock/unlock does not harm much. We do this for each line in the for(;;) cycle anyway. But the check for retry value is clever. We could use this if others would want to preserve the existing behavior and call console_cont_flush() only once. Best Regards, Petr