diff mbox

[net-next] af_unix: optimize unix_writable by inlining

Message ID 1446483719-30310-1-git-send-email-aconole@bytheb.org
State Rejected, archived
Delegated to: David Miller
Headers show

Commit Message

Aaron Conole Nov. 2, 2015, 5:01 p.m. UTC
unix_writable() originally was inlined, but was changed as part of
commit 1586a5877db9 ("af_unix: do not report POLLOUT on
listeners"). Re-enable the inline flag.

Signed-off-by: Aaron Conole <aconole@bytheb.org>
Cc: Eric Dumazet <edumazet@google.com>
---
 net/unix/af_unix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller Nov. 2, 2015, 5:08 p.m. UTC | #1
From: Aaron Conole <aconole@bytheb.org>
Date: Mon,  2 Nov 2015 12:01:59 -0500

> unix_writable() originally was inlined, but was changed as part of
> commit 1586a5877db9 ("af_unix: do not report POLLOUT on
> listeners"). Re-enable the inline flag.
> 
> Signed-off-by: Aaron Conole <aconole@bytheb.org>

This is never appropriate.

The compiler should be fixed to inline functions properly when
appropriate for the optimization level requested.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet Nov. 2, 2015, 5:13 p.m. UTC | #2
On Mon, 2015-11-02 at 12:01 -0500, Aaron Conole wrote:
> unix_writable() originally was inlined, but was changed as part of
> commit 1586a5877db9 ("af_unix: do not report POLLOUT on
> listeners"). Re-enable the inline flag.
> 
> Signed-off-by: Aaron Conole <aconole@bytheb.org>
> Cc: Eric Dumazet <edumazet@google.com>
> ---


We leave this to the compiler nowadays.

If you take a look at disassembly, you'll see your patch has no effect
at all.



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Aaron Conole Nov. 2, 2015, 5:55 p.m. UTC | #3
David Miller <davem@davemloft.net> writes:

> From: Aaron Conole <aconole@bytheb.org>
> Date: Mon,  2 Nov 2015 12:01:59 -0500
>
>> unix_writable() originally was inlined, but was changed as part of
>> commit 1586a5877db9 ("af_unix: do not report POLLOUT on
>> listeners"). Re-enable the inline flag.
>> 
>> Signed-off-by: Aaron Conole <aconole@bytheb.org>
>
> This is never appropriate.
>
> The compiler should be fixed to inline functions properly when
> appropriate for the optimization level requested.

Okay, apologies for the noise.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index aaa0b58..f0c7f0c 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -326,7 +326,7 @@  found:
 	return s;
 }
 
-static int unix_writable(const struct sock *sk)
+static inline int unix_writable(const struct sock *sk)
 {
 	return sk->sk_state != TCP_LISTEN &&
 	       (atomic_read(&sk->sk_wmem_alloc) << 2) <= sk->sk_sndbuf;