Re: [PATCH] net: Disambiguate kernel message

From
Arun Sharma <hidden>
Date
2012-01-31 20:46:51
Also in
lkml
Reply to
Joe Perches, 2012-01-31
On 1/31/12 12:09 PM, Joe Perches wrote:
quoted
+	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();
}

 -Arun
Thread (14 messages) 14 messages, 6 authors, last reply 2012-02-01
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help