From patchwork Thu Jun 4 18:36:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 6549121 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 33CA99F326 for ; Thu, 4 Jun 2015 18:44:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3DD63207B6 for ; Thu, 4 Jun 2015 18:44:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22251207B2 for ; Thu, 4 Jun 2015 18:44:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932235AbbFDSov (ORCPT ); Thu, 4 Jun 2015 14:44:51 -0400 Received: from smtprelay0204.hostedemail.com ([216.40.44.204]:48442 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932224AbbFDSot (ORCPT ); Thu, 4 Jun 2015 14:44:49 -0400 Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave04.hostedemail.com (Postfix) with ESMTP id D0486B30DC for ; Thu, 4 Jun 2015 18:37:02 +0000 (UTC) Received: from filter.hostedemail.com (unknown [216.40.38.60]) by smtprelay06.hostedemail.com (Postfix) with ESMTP id BCA689ED5F; Thu, 4 Jun 2015 18:37:00 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::::, RULES_HIT:2:41:69:355:379:541:800:960:965:966:968:973:988:989:1260:1345:1359:1434:1437:1535:1606:1730:1747:1777:1792:1801:2196:2199:2393:2559:2562:2896:3138:3139:3140:3141:3142:3354:3865:3866:3867:3871:3874:4250:4321:4385:4390:4395:4605:5007:6261:7875:10004:10848:11026:11473:11658:11914:12043:12048:12050:12291:12296:12438:12517:12519:12555:12679:12683:13181:13229:14394:21080, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-HE-Tag: drink86_2dab1f1c805e X-Filterd-Recvd-Size: 5874 Received: from joe-laptop.perches.com (pool-173-51-221-2.lsanca.fios.verizon.net [173.51.221.2]) (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA; Thu, 4 Jun 2015 18:36:59 +0000 (UTC) From: Joe Perches To: linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , Pavel Machek Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/6] power: process: Standardize "freezing process" messages Date: Thu, 4 Jun 2015 11:36:45 -0700 Message-Id: <8d64d7556b2ad9f216c9c36afff46943d0c71138.1433442778.git.joe@perches.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Always emit the "freezing ... processes" on 2 separate lines so that these messages can't be interleaved. Start to standardize the printk "PM: doing something...done" messages on two separate lines. Miscellanea: o Add an argument for the elapsed time to try_to_freeze_tasks. o Remove some trailing whitespace Signed-off-by: Joe Perches --- kernel/power/process.c | 53 +++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/kernel/power/process.c b/kernel/power/process.c index 564f786..f072ae6 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -1,5 +1,5 @@ /* - * drivers/power/process.c - Functions for starting/stopping processes on + * drivers/power/process.c - Functions for starting/stopping processes on * suspend transitions. * * Originally from swsusp. @@ -19,12 +19,12 @@ #include #include -/* +/* * Timeout for stopping processes */ unsigned int __read_mostly freeze_timeout_msecs = 20 * MSEC_PER_SEC; -static int try_to_freeze_tasks(bool user_only) +static int try_to_freeze_tasks(bool user_only, unsigned int *elapsed_msecs) { struct task_struct *g, *p; unsigned long end_time; @@ -32,7 +32,6 @@ static int try_to_freeze_tasks(bool user_only) bool wq_busy = false; struct timeval start, end; u64 elapsed_msecs64; - unsigned int elapsed_msecs; bool wakeup = false; int sleep_usecs = USEC_PER_MSEC; @@ -81,14 +80,12 @@ static int try_to_freeze_tasks(bool user_only) do_gettimeofday(&end); elapsed_msecs64 = timeval_to_ns(&end) - timeval_to_ns(&start); do_div(elapsed_msecs64, NSEC_PER_MSEC); - elapsed_msecs = elapsed_msecs64; + *elapsed_msecs = elapsed_msecs64; if (todo) { - pr_cont("\n"); - pr_err("Freezing of tasks %s after %d.%03d seconds " - "(%d tasks refusing to freeze, wq_busy=%d):\n", + pr_err("Freezing of tasks %s after %d.%03d seconds (%d tasks refusing to freeze, wq_busy=%d)\n", wakeup ? "aborted" : "failed", - elapsed_msecs / 1000, elapsed_msecs % 1000, + *elapsed_msecs / 1000, *elapsed_msecs % 1000, todo - wq_busy, wq_busy); if (!wakeup) { @@ -100,9 +97,6 @@ static int try_to_freeze_tasks(bool user_only) } read_unlock(&tasklist_lock); } - } else { - pr_cont("(elapsed %d.%03d seconds) ", elapsed_msecs / 1000, - elapsed_msecs % 1000); } return todo ? -EBUSY : 0; @@ -118,6 +112,7 @@ static int try_to_freeze_tasks(bool user_only) int freeze_processes(void) { int error; + unsigned int msecs; error = __usermodehelper_disable(UMH_FREEZING); if (error) @@ -130,18 +125,22 @@ int freeze_processes(void) atomic_inc(&system_freezing_cnt); pm_wakeup_clear(); - pr_info("Freezing user space processes ... "); + pr_info("Freezing user space processes...\n"); pm_freezing = true; - error = try_to_freeze_tasks(true); - if (!error) { + error = try_to_freeze_tasks(true, &msecs); + if (error < 0) { + pr_info("Freezing user space processes: done (error: %d)\n", + error); + } else { __usermodehelper_set_disable_depth(UMH_DISABLED); - pr_cont("done."); + pr_info("Freezing user space processes: done (elapsed %u.%03u seconds)\n", + msecs / 1000, msecs % 1000); } - pr_cont("\n"); + BUG_ON(in_atomic()); /* - * Now that the whole userspace is frozen we need to disbale + * Now that the whole userspace is frozen we need to disable * the OOM killer to disallow any further interference with * killable tasks. */ @@ -164,15 +163,15 @@ int freeze_processes(void) int freeze_kernel_threads(void) { int error; + unsigned int msecs; - pr_info("Freezing remaining freezable tasks ... "); + pr_info("Freezing remaining freezable tasks...\n"); pm_nosig_freezing = true; - error = try_to_freeze_tasks(false); - if (!error) - pr_cont("done."); + error = try_to_freeze_tasks(false, &msecs); + if (error >= 0) + pr_info("Freezing remaining freezable tasks: done\n"); - pr_cont("\n"); BUG_ON(in_atomic()); if (error) @@ -193,7 +192,7 @@ void thaw_processes(void) oom_killer_enable(); - pr_info("Restarting tasks ... "); + pr_info("Restarting tasks...\n"); __usermodehelper_set_disable_depth(UMH_FREEZING); thaw_workqueues(); @@ -212,7 +211,7 @@ void thaw_processes(void) usermodehelper_enable(); schedule(); - pr_cont("done.\n"); + pr_info("Restarting tasks: done\n"); trace_suspend_resume(TPS("thaw_processes"), 0, false); } @@ -221,7 +220,7 @@ void thaw_kernel_threads(void) struct task_struct *g, *p; pm_nosig_freezing = false; - pr_info("Restarting kernel threads ... "); + pr_info("Restarting kernel threads...\n"); thaw_workqueues(); @@ -233,5 +232,5 @@ void thaw_kernel_threads(void) read_unlock(&tasklist_lock); schedule(); - pr_cont("done.\n"); + pr_info("Restarting kernel threads: done\n"); }