From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754617AbcCBJag (ORCPT ); Wed, 2 Mar 2016 04:30:36 -0500 Received: from mx2.suse.de ([195.135.220.15]:33952 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753491AbcCBJad (ORCPT ); Wed, 2 Mar 2016 04:30:33 -0500 Date: Wed, 2 Mar 2016 10:30:53 +0100 From: Jan Kara To: Denys Vlasenko Cc: Jan Kara , Andrew Morton , LKML , pmladek@suse.com, KY Srinivasan , Steven Rostedt , Jan Kara Subject: Re: [PATCH 1/7] printk: Hand over printing to console if printing too long Message-ID: <20160302093053.GA19633@quack.suse.cz> References: <1445835169-8203-1-git-send-email-jack@suse.com> <1445835169-8203-2-git-send-email-jack@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 On Tue 01-03-16 18:22:25, Denys Vlasenko wrote: > On Mon, Oct 26, 2015 at 5:52 AM, Jan Kara wrote: > > This patch implements a mechanism where after printing specified number > > of characters (tunable as a kernel parameter printk.offload_chars), CPU > > doing printing asks for help by waking up one of dedicated kthreads. As > > soon as the printing CPU notices kthread got scheduled and is spinning > > on print_lock dedicated for that purpose, it drops console_sem, > > print_lock, and exits console_unlock(). Kthread then takes over printing > > instead. This way no CPU should spend printing too long even if there > > is heavy printk traffic. > > > > +/* > > + * Number of kernel threads for offloading printing. We need at least two so > > + * that they can hand over printing from one to another one and thus switch > > + * CPUs. > > + */ > > +#define PRINTING_TASKS 2 > > + > > +/* Wait queue printing kthreads sleep on when idle */ > > +static DECLARE_WAIT_QUEUE_HEAD(print_queue); > > Having two tasks, not one, for printking for the case > when console output is slow... sounds wasteful. > > Can this be improved so that only one task is needed? Probably we'll go with workqueue in the next version of the patch series. But at least in this version you needed two tasks so that one task can hand over printing to the other one and thus relieve the load from a CPU. Honza -- Jan Kara SUSE Labs, CR