From patchwork Wed Jan 19 23:01:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Travis X-Patchwork-Id: 490681 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 p0JN26jK030823 for ; Wed, 19 Jan 2011 23:02:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755083Ab1ASXCA (ORCPT ); Wed, 19 Jan 2011 18:02:00 -0500 Received: from relay2.sgi.com ([192.48.179.30]:51986 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755141Ab1ASXBT (ORCPT ); Wed, 19 Jan 2011 18:01:19 -0500 Received: from gulag1.americas.sgi.com (gulag1.americas.sgi.com [128.162.236.41]) by relay2.corp.sgi.com (Postfix) with ESMTP id 810A630407A; Wed, 19 Jan 2011 15:01:09 -0800 (PST) Received: by gulag1.americas.sgi.com (Postfix, from userid 5508) id 68C73103768B2; Wed, 19 Jan 2011 17:01:07 -0600 (CST) Message-Id: <20110119230107.276901215@gulag1.americas.sgi.com> References: <20110119230106.341785959@gulag1.americas.sgi.com> User-Agent: quilt/0.46-1 Date: Wed, 19 Jan 2011 17:01:12 -0600 From: Mike Travis To: Ingo Molnar , Len Brown , "H. Peter Anvin" Cc: Thomas Gleixner , Jack Steiner , Robin Holt , Lori Gilbertson , x86@kernel.org, linux-kernel@vger.kernel.org, linux-acpi@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]); Wed, 19 Jan 2011 23:02:08 +0000 (UTC) --- linux-2.6.32.orig/kernel/printk.c +++ linux-2.6.32/kernel/printk.c @@ -806,11 +806,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;