mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Travis <travis@sgi.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>, Len Brown <len.brown@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Jack Steiner <steiner@sgi.com>, Robin Holt <holt@sgi.com>,
	Lori Gilbertson <loriann@sgi.com>,
	x86@kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] printk: Minimize time zero output
Date: Fri, 21 Jan 2011 14:25:08 -0600	[thread overview]
Message-ID: <20110121202504.796868924@gulag1.americas.sgi.com> (raw)
In-Reply-To: <20110121202502.090169599@gulag1.americas.sgi.com>

[-- Attachment #1: minimize-time-zero-msgs --]
[-- Type: text/plain, Size: 890 bytes --]

Reduce the length for time zero messages by only printing "[0] ".

Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Jack Steiner <steiner@sgi.com>
Reviewed-by: Robin Holt <holt@sgi.com>
---
 kernel/printk.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- 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;

-- 

  parent reply	other threads:[~2011-01-21 20:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21 20:25 [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer Mike Travis
2011-01-21 20:25 ` [PATCH 1/6] printk: Allocate kernel log buffer earlier v1 Mike Travis
2011-01-21 20:25 ` [PATCH 2/6] ACPI: Minimize X2APIC initial messages Mike Travis
2011-01-21 20:25 ` [PATCH 3/6] x86: Minimize initial Bootmem messages Mike Travis
2011-01-21 20:25 ` [PATCH 4/6] x86: Minimize initial e820 messages Mike Travis
2011-01-21 20:25 ` [PATCH 5/6] x86: Minimize SRAT messages Mike Travis
2011-01-21 20:25 ` Mike Travis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-01-19 23:01 [PATCH 0/6] init: Shrink early messages to prevent overflowing the kernel log buffer Mike Travis
2011-01-19 23:01 ` [PATCH 6/6] printk: Minimize time zero output Mike Travis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110121202504.796868924@gulag1.americas.sgi.com \
    --to=travis@sgi.com \
    --cc=akpm@linux-foundation.org \
    --cc=holt@sgi.com \
    --cc=hpa@zytor.com \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loriann@sgi.com \
    --cc=mingo@elte.hu \
    --cc=steiner@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®