From: Joe Perches <joe@perches.com>
To: Arun Sharma <asharma@fb.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
David Miller <davem@davemloft.net>,
Glauber Costa <glommer@parallels.com>,
Ingo Molnar <mingo@elte.hu>,
christoph.paasch@uclouvain.be
Subject: Re: [PATCH] net: Disambiguate kernel message
Date: Tue, 31 Jan 2012 10:50:57 -0800 [thread overview]
Message-ID: <1328035857.6911.8.camel@joe2Laptop> (raw)
In-Reply-To: <20120131181554.GA24397@dev3310.snc6.facebook.com>
On Tue, 2012-01-31 at 10:15 -0800, Arun Sharma wrote:
> On Mon, Jan 30, 2012 at 08:22:03PM -0800, Bjorn Helgaas wrote:
> > > We print a different message depending on whether we're out
> > > of TCP memory or there are too many orphan sockets.
> >
> > This patch mentions pairs of messages that are almost the same, but
> > not quite. If they're supposed to be different, I'd suggest making
> > them clearly different. As it is, the differences look like careless
> > mistakes:
>
> Good point. Updated patch changes the existing printks to be
> the same as well.
[]
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
[]
> @@ -2014,11 +2014,24 @@ adjudge_to_death:
[]
> + if (too_many_orphans) {
> if (net_ratelimit())
> - printk(KERN_INFO "TCP: too many of orphaned "
> + printk(KERN_INFO "TCP: too many orphaned "
> "sockets\n");
> + }
> +
> + if (out_of_socket_memory) {
> + if (net_ratelimit())
> + printk(KERN_INFO "TCP: out of memory. "
> + "Consider tuning tcp_mem\n");
> + }
> +
[]
> diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
[]
> @@ -77,9 +78,14 @@ static int tcp_out_of_resources(struct sock *sk, int do_reset)
[]
> + too_many_orphans = tcp_too_many_orphans(sk, shift);
> + out_of_socket_memory = tcp_out_of_memory(sk);
> + if (too_many_orphans || out_of_socket_memory) {
> + if (out_of_socket_memory && net_ratelimit())
> + printk(KERN_INFO "TCP: out of memory. "
> + "Consider tuning tcp_mem\n");
> + if (too_many_orphans && net_ratelimit())
> + printk(KERN_INFO "TCP: too many orphaned sockets\n");
These 2 blocks emit the messages in different order.
It might be useful to use a generic routine.
void tcp_log_oom(bool orphans, bool socket_memory)
{
if (!net_ratelimit())
return;
if (orphans)
pr_info("too many orphaned sockets\n");
if (socket_memory)
pr_info("out of socket memory - consider tuning tcp_mem\n");
}
next prev parent reply other threads:[~2012-01-31 18:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 22:41 [PATCH] net: Disambiguate kernel message Arun Sharma
2012-01-31 4:22 ` Bjorn Helgaas
2012-01-31 18:15 ` Arun Sharma
2012-01-31 18:50 ` Joe Perches [this message]
2012-01-31 19:47 ` Arun Sharma
2012-01-31 20:09 ` Joe Perches
2012-01-31 20:46 ` Arun Sharma
2012-01-31 20:55 ` Joe Perches
2012-01-31 21:15 ` David Miller
2012-01-31 22:05 ` Arun Sharma
2012-01-31 22:12 ` Joe Perches
2012-02-01 19:42 ` David Miller
2012-01-31 19:44 ` Ingo Molnar
2012-01-31 8:51 ` Christoph Paasch
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=1328035857.6911.8.camel@joe2Laptop \
--to=joe@perches.com \
--cc=asharma@fb.com \
--cc=bhelgaas@google.com \
--cc=christoph.paasch@uclouvain.be \
--cc=davem@davemloft.net \
--cc=glommer@parallels.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.