mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Isaac Manjarres <isaacmanjarres@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	John Ogness <john.ogness@linutronix.de>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	surenb@google.com, kernel-team@android.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] printk: Improve memory usage logging during boot
Date: Tue, 1 Oct 2024 17:48:52 +0200	[thread overview]
Message-ID: <ZvwZ5Ci8o0xJ8TcL@pathway.suse.cz> (raw)
In-Reply-To: <ZvrvEF5uLAP6_4RX@google.com>

On Mon 2024-09-30 11:33:52, Isaac Manjarres wrote:
> On Mon, Sep 30, 2024 at 03:38:46PM +0200, Petr Mladek wrote:
> > > --- a/kernel/printk/printk.c
> > > +++ b/kernel/printk/printk.c
> > > @@ -1156,6 +1156,17 @@ static unsigned int __init add_to_rb(struct printk_ringbuffer *rb,
> > > +
> > >  void __init setup_log_buf(int early)
> > >  {
> > >  	struct printk_info *new_infos;
> > > @@ -1186,19 +1197,19 @@ void __init setup_log_buf(int early)
> > >  		log_buf_add_cpu();
> > >  
> > >  	if (!new_log_buf_len)
> > > -		return;
> > > +		goto out;
> > 
> > The same information is printed twice when the default buffer is used.
> > We should do something like:
> > 
> > 	if (!new_log_buf_len) {
> > 		if (early)
> > 			goto out;
> > 		return;
> > 	}
> > 
> Thank you for pointing this out. I'll do something very similar to this
> in the 2nd version of the patch, but I'll use "!early" instead. The
> rationale is that if I use just use "early", then the memory usage
> stats don't get emitted at all on my machine (arm64) when it uses the
> default buffer, because setup_log_buf() is called only once with
> early == 0.

I see. setup_log_buf(1) is used only on x86_64. Great catch!

> Using !early in the check there should fix that, and also emit the
> memory stats only once on machines that invoke setup_log_buf()
> multiple times and end up using the default buffer.

Yup.

Best Regards,
Petr

      reply	other threads:[~2024-10-01 15:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26  1:12 Isaac J. Manjarres
2024-09-30 13:38 ` Petr Mladek
2024-09-30 18:33   ` Isaac Manjarres
2024-10-01 15:48     ` Petr Mladek [this message]

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=ZvwZ5Ci8o0xJ8TcL@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=isaacmanjarres@google.com \
    --cc=john.ogness@linutronix.de \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=surenb@google.com \
    /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®