From patchwork Wed Aug 10 21:17:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 73700 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp598160qga; Wed, 10 Aug 2016 14:18:18 -0700 (PDT) X-Received: by 10.98.89.23 with SMTP id n23mr10769248pfb.34.1470863898394; Wed, 10 Aug 2016 14:18:18 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cc15si50250076pac.249.2016.08.10.14.18.18; Wed, 10 Aug 2016 14:18:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752575AbcHJVSB (ORCPT + 27 others); Wed, 10 Aug 2016 17:18:01 -0400 Received: from mail-yw0-f194.google.com ([209.85.161.194]:35251 "EHLO mail-yw0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752425AbcHJVR5 (ORCPT ); Wed, 10 Aug 2016 17:17:57 -0400 Received: by mail-yw0-f194.google.com with SMTP id r9so2522690ywg.2 for ; Wed, 10 Aug 2016 14:17:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Y9zFRf3ytpMpI5CYjR5vpHAspGTYWNWr3GsA2MiCrV0=; b=okmY+5PV12L/5Q+tLtmCtgEY7cs8o1DyaBGWzpT7yPzGjM0Md8E3TfxSD9mpAuG2XB VJ2HswL/AwAah2VszO0ZfSJ/uWphxw12nPsnbOHb0oeuLAchmwIzytZP0pzDpx2g9gIO 7nj4DqupieAPa78z9sOg3FBAqJQOovmqATu8STpkyoieOIzfVAljsk9elU13p2oLG8Cs ISNE5Ekfo1+HrxvBypxYj/r9qxnFt6SvcsysOLazumNosEfwhYPag/2AaC9mR5EbHL7G 3d7pLYUjx5VLTLak0vPEfmmxj+drttwv8LCm40z2T/3133s8V95jMQeJXGNaVisFnNv3 GUsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Y9zFRf3ytpMpI5CYjR5vpHAspGTYWNWr3GsA2MiCrV0=; b=E+h14K/2PVlAEZiaowh5vdt6Gb7UGsWIF2JkrtLcAIis+39ojEpH1Isydjme+0FiNt /Gb7qZNNIFUhuMDHEP+lqORtZb3LrPSMwxefQ1Reuer/QVw6ysP5NR3cuwv7ZDoewBZY dQO2ZsGMrGUHD7/nzDIJrgVpDsRwStumCjRuPluUXwCyDmgGbPBS4UyVL12U0fl6ngbH 7WxHSdY0IO33DbxV9TWss8twicl7hsCvWX9DP+ZODslvjC3WaHoMEwD11n8jlth/WjUp 3pYqMvBp0CrIdduyEccQ/7cOXNSTF8EgDlU7K7iTmchvgnq/V1asdpc3GPlt2cgBoghW D/pQ== X-Gm-Message-State: AEkooutKR0KY6w2s61dlKV5mlZy0VagY6rdjxbI9FSGrwcZBOrwg6c2mbUL9eQWRZ32hWAGHOsxi2RN2qeu8gA== X-Received: by 10.129.125.86 with SMTP id y83mr4266086ywc.167.1470863876592; Wed, 10 Aug 2016 14:17:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.25.136 with HTTP; Wed, 10 Aug 2016 14:17:55 -0700 (PDT) In-Reply-To: <20160406082758.GA3554@quack.suse.cz> References: <1459789048-1337-1-git-send-email-sergey.senozhatsky@gmail.com> <1459789048-1337-2-git-send-email-sergey.senozhatsky@gmail.com> <20160404155149.a3e3307def2d1315e2099c63@linux-foundation.org> <20160406082758.GA3554@quack.suse.cz> From: Viresh Kumar Date: Wed, 10 Aug 2016 14:17:55 -0700 X-Google-Sender-Auth: 9DDKU1wr9gZrPoDMT4XEAUyGxhk Message-ID: Subject: Re: [PATCH v10 1/2] printk: Make printk() completely async To: Jan Kara , Andrew Morton , Sergey Senozhatsky Cc: Jan Kara , Petr Mladek , Tejun Heo , Tetsuo Handa , "linux-kernel@vger.kernel.org" , Byungchul Park , Sergey Senozhatsky , vlevenetz@mm-sol.com, Greg Kroah-Hartman Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Vladi/Greg, On Wed, Apr 6, 2016 at 1:27 AM, Jan Kara wrote: > On Mon 04-04-16 15:51:49, Andrew Morton wrote: >> > +static int __init init_printk_kthread(void) >> > +{ >> > + struct task_struct *thread; >> > + >> > + if (printk_sync) >> > + return 0; >> > + >> > + thread = kthread_run(printk_kthread_func, NULL, "printk"); >> >> This gets normal scheduling policy, so a spinning userspace SCHED_FIFO >> task will block printk for ever. This seems bad. > > I have to research this a bit but won't the SCHED_FIFO task that has > potentially unbounded amount of work lockup the CPU even though it does > occasional cond_resched()? We are facing complete hogs because of the printk thread being a SCHED_FIFO task and have this patch to fix it up for now. Author: Vladislav Levenetz Date: Wed Aug 10 13:58:00 2016 -0700 SW-7786: printk: Lower the priority of printk thread Flooding the console (with a test module) in a tight loop indefinitely makes android user interface very sluggish. Opening YouTube app and the device hangs and becomes even more unresponsive to the point it completely hangs. The asynchronous printk thread is a SCHED FIFO thread with priority MAX_RT_PRIO - 1. If we create it as a simple thread (i.e. no SCHED FIFO) instead, we observe much better performance using the same printk flood test. We don't even notice any kind of sluggishness during device usage. We can play a YouTube clip smoothly and use the device normally in general. The kernel log looks fine as well, as the flood of messages continue normally. Signed-off-by: Vladislav Levenetz Signed-off-by: Viresh Kumar --- kernel/printk/printk.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index c32872872cb6..ad5b30e5e6d9 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2856,9 +2856,6 @@ static int printk_kthread_func(void *data) static int __init_printk_kthread(void) { struct task_struct *thread; - struct sched_param param = { - .sched_priority = MAX_RT_PRIO - 1, - }; if (!printk_kthread_can_run || printk_sync || printk_kthread) return 0; @@ -2870,7 +2867,6 @@ static int __init_printk_kthread(void) return PTR_ERR(thread); } - sched_setscheduler(thread, SCHED_FIFO, ¶m); printk_kthread = thread; return 0; }