From: Borislav Petkov <bp@alien8.de>
To: David Rientjes <rientjes@google.com>
Cc: Andi Kleen <andi@firstfloor.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [patch] oom: change warning for deprecated oom_adj to avoid WARN_ONCE()
Date: Thu, 4 Aug 2011 09:48:21 +0200 [thread overview]
Message-ID: <20110804074820.GA22842@liondog.tnic> (raw)
In-Reply-To: <alpine.DEB.2.00.1108032258200.23444@chino.kir.corp.google.com>
On Wed, Aug 03, 2011 at 11:04:55PM -0700, David Rientjes wrote:
> > > - WARN_ONCE(1, "%s (%d): /proc/%d/oom_adj is deprecated, please use /proc/%d/oom_score_adj instead.\n",
> > > - current->comm, task_pid_nr(current), task_pid_nr(task),
> > > - task_pid_nr(task));
> > > + if (!warning_printed) {
> > > + warning_printed = true;
> > > + printk("\n===============================================================================\n");
> > > + printk("%s (%d): /proc/%d/oom_adj is deprecated, please use /proc/%d/oom_score_adj instead.\n",
> > > + current->comm, task_pid_nr(current), task_pid_nr(task),
> > > + task_pid_nr(task));
> > > + printk("===============================================================================\n\n");
> >
> > You're missing the KERN_WARNING level.
>
> It's intentional because (i) I'm using a multi-line notification with
> newlines and (ii) I don't want to be considered as a kernel warning. It's
> just for consumption by userspace and doesn't indicate a kernel issue.
I see.
> > Why don't you use pr_warn_once +
> > pr_cont_once? No need for the warning_printed too, it gets defined in
> > another scope by the pr_warn_once macro automatically.
> >
>
> Because using pr_warn_once + pr_cont_once for a multi-line notification is
> racy and I don't want three separated static variables? pr_cont_once()
> shouldn't be used unless synchronized.
Or maybe do:
pr_info_once("\n===============================================================================\n"
"%s (%d): /proc/%d/oom_adj is deprecated, please use /proc/%d/oom_score_adj instead.\n"
"===============================================================================\n\n",
current->comm, task_pid_nr(current), task_pid_nr(task), task_pid_nr(task));
so as to not be a warning and still hide the warning_printed thing. You
could even save yourself the last repeated argument by enumerating the
format specifiers:
pr_info_once("\n===============================================================================\n"
"%1$s (%2$d): /proc/%3$d/oom_adj is deprecated, please use /proc/%3$d/oom_score_adj instead.\n"
"===============================================================================\n\n",
current->comm, task_pid_nr(current), task_pid_nr(task));
It seems to build fine here.
Oh well. :-)
--
Regards/Gruss,
Boris.
prev parent reply other threads:[~2011-08-04 7:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-02 0:52 Revert needed: udev spewing warnons on common systems in 3.0 Andi Kleen
2011-08-02 1:32 ` Andrew Morton
2011-08-02 1:41 ` Linus Torvalds
2011-08-02 2:22 ` David Rientjes
2011-08-02 9:16 ` Alan Cox
2011-08-02 9:53 ` David Rientjes
2011-08-02 10:11 ` Alan Cox
2011-08-02 11:22 ` David Miller
2011-08-02 14:45 ` Andi Kleen
2011-08-02 21:50 ` David Rientjes
2011-08-02 21:45 ` David Rientjes
2011-08-02 22:06 ` Andi Kleen
2011-08-02 11:20 ` David Miller
2011-08-02 2:34 ` David Rientjes
2011-08-02 6:07 ` Andi Kleen
2011-08-02 9:54 ` [patch] oom: change warning for deprecated oom_adj to avoid WARN_ONCE() David Rientjes
2011-08-03 6:10 ` Borislav Petkov
2011-08-04 6:04 ` David Rientjes
2011-08-04 7:48 ` Borislav Petkov [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=20110804074820.GA22842@liondog.tnic \
--to=bp@alien8.de \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rientjes@google.com \
--cc=torvalds@linux-foundation.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®