From patchwork Fri Jan 21 20:25:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Travis X-Patchwork-Id: 496491 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p0LKQehL004203 for ; Fri, 21 Jan 2011 20:27:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754645Ab1AUUZh (ORCPT ); Fri, 21 Jan 2011 15:25:37 -0500 Received: from relay1.sgi.com ([192.48.179.29]:49022 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753463Ab1AUUZG (ORCPT ); Fri, 21 Jan 2011 15:25:06 -0500 Received: from gulag1.americas.sgi.com (gulag1.americas.sgi.com [128.162.236.41]) by relay1.corp.sgi.com (Postfix) with ESMTP id 983D68F8096; Fri, 21 Jan 2011 12:25:05 -0800 (PST) Received: by gulag1.americas.sgi.com (Postfix, from userid 5508) id 3CB5010377FE9; Fri, 21 Jan 2011 14:25:05 -0600 (CST) Message-Id: <20110121202504.796868924@gulag1.americas.sgi.com> References: <20110121202502.090169599@gulag1.americas.sgi.com> User-Agent: quilt/0.46-1 Date: Fri, 21 Jan 2011 14:25:08 -0600 From: Mike Travis To: Andrew Morton , Ingo Molnar , Len Brown , "H. Peter Anvin" Cc: Thomas Gleixner , Jack Steiner , Robin Holt , Lori Gilbertson , x86@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] printk: Minimize time zero output Content-Disposition: inline; filename=minimize-time-zero-msgs Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 21 Jan 2011 20:27:02 +0000 (UTC) --- linux-2.6.32.orig/kernel/printk.c +++ linux-2.6.32/kernel/printk.c @@ -805,11 +805,14 @@ asmlinkage int vprintk(const char *fmt, unsigned long nanosec_rem; t = cpu_clock(printk_cpu); - nanosec_rem = do_div(t, 1000000000); - tlen = sprintf(tbuf, "[%5lu.%06lu] ", + if (likely(t)) { + nanosec_rem = do_div(t, 1000000000); + tlen = sprintf(tbuf, "[%5lu.%06lu] ", (unsigned long) t, nanosec_rem / 1000); - + } else { + tlen = sprintf(tbuf, "[0] "); + } for (tp = tbuf; tp < tbuf + tlen; tp++) emit_log_char(*tp); printed_len += tlen;