From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752561AbcCARWr (ORCPT ); Tue, 1 Mar 2016 12:22:47 -0500 Received: from mail-qg0-f46.google.com ([209.85.192.46]:33644 "EHLO mail-qg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751436AbcCARWp (ORCPT ); Tue, 1 Mar 2016 12:22:45 -0500 MIME-Version: 1.0 In-Reply-To: <1445835169-8203-2-git-send-email-jack@suse.com> References: <1445835169-8203-1-git-send-email-jack@suse.com> <1445835169-8203-2-git-send-email-jack@suse.com> From: Denys Vlasenko Date: Tue, 1 Mar 2016 18:22:25 +0100 Message-ID: Subject: Re: [PATCH 1/7] printk: Hand over printing to console if printing too long To: Jan Kara Cc: Andrew Morton , LKML , pmladek@suse.com, KY Srinivasan , Steven Rostedt , Jan Kara Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?