From: David Miller <davem@davemloft.net>
To: joe@perches.com
Cc: asharma@fb.com, bhelgaas@google.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
glommer@parallels.com, mingo@elte.hu,
christoph.paasch@uclouvain.be
Subject: Re: [PATCH] net: Disambiguate kernel message
Date: Tue, 31 Jan 2012 16:15:35 -0500 (EST) [thread overview]
Message-ID: <20120131.161535.422381201029777577.davem@davemloft.net> (raw)
In-Reply-To: <1328043341.8702.3.camel@joe2Laptop>
From: Joe Perches <joe@perches.com>
Date: Tue, 31 Jan 2012 12:55:41 -0800
> On Tue, 2012-01-31 at 12:46 -0800, Arun Sharma wrote:
>> On 1/31/12 12:09 PM, Joe Perches wrote:
>> >> + too_many_orphans = tcp_too_many_orphans(sk, shift);
>> >> + out_of_socket_memory = tcp_out_of_memory(sk);
>> >> + tcp_log_oom(too_many_orphans, out_of_socket_memory);
>> >> + if (too_many_orphans || out_of_socket_memory) {
>> > Perhaps these repeated three lines should be a routine like:
>> > bool tcp_check_oom(struct sock *sk, int shift)
>> > {
>> > bool tcp_orphans = tcp_too_many_orphans(sk, shift);
>> > bool tcp_oom = tcp_out_of_memory(sk);
>> >
>> > printks...
>> >
>> > return tcp_orphans || tcp_oom;
>> > }
>> I like your previous suggestion better. It preserves the ability to write:
>> if (too_many_orphans) {
>> do_something();
>> }
>> if (out_of_socket_memory) {
>> do_something_else();
>> }
>
> shrug. That isn't currently used and
> tcp_too_many_orphans and tcp_out_of_memory
> could still be checked.
>
> I think the routine could be moved out-of-line.
Indeed, and make the out-of-line combined routine (that does the test
as well as the conditional logging) return a boolean that determines
if the "if (too_many_orphans || out_of_socket_memory)" test should
pass.
next prev parent reply other threads:[~2012-01-31 21:15 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
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 [this message]
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=20120131.161535.422381201029777577.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=asharma@fb.com \
--cc=bhelgaas@google.com \
--cc=christoph.paasch@uclouvain.be \
--cc=glommer@parallels.com \
--cc=joe@perches.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).