* [PATCH] net: some optimizations in af_inet
@ 2008-11-22 7:06 Eric Dumazet
2008-11-23 23:42 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2008-11-22 7:06 UTC (permalink / raw)
To: David S. Miller, Linux Netdev List
[-- Attachment #1: Type: text/plain, Size: 281 bytes --]
1) Use eq_net() in inet_netns_ok() to speedup socket creation if !CONFIG_NET_NS
2) Reorder the tests about inet_ehash_secret generation (once only)
Use the unlikely() macro when testing if inet_ehash_secret already generated.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
[-- Attachment #2: af_inet.patch --]
[-- Type: text/plain, Size: 786 bytes --]
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index b1462e8..fe03048 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -245,7 +245,7 @@ static inline int inet_netns_ok(struct net *net, int protocol)
int hash;
struct net_protocol *ipprot;
- if (net == &init_net)
+ if (net_eq(net, &init_net))
return 1;
hash = protocol & (MAX_INET_PROTOS - 1);
@@ -272,10 +272,9 @@ static int inet_create(struct net *net, struct socket *sock, int protocol)
int try_loading_module = 0;
int err;
- if (sock->type != SOCK_RAW &&
- sock->type != SOCK_DGRAM &&
- !inet_ehash_secret)
- build_ehash_secret();
+ if (unlikely(!inet_ehash_secret))
+ if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
+ build_ehash_secret();
sock->state = SS_UNCONNECTED;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: some optimizations in af_inet
2008-11-22 7:06 [PATCH] net: some optimizations in af_inet Eric Dumazet
@ 2008-11-23 23:42 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-11-23 23:42 UTC (permalink / raw)
To: dada1; +Cc: netdev
From: Eric Dumazet <dada1@cosmosbay.com>
Date: Sat, 22 Nov 2008 08:06:09 +0100
> 1) Use eq_net() in inet_netns_ok() to speedup socket creation if !CONFIG_NET_NS
>
> 2) Reorder the tests about inet_ehash_secret generation (once only)
> Use the unlikely() macro when testing if inet_ehash_secret already generated.
>
> Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-11-23 23:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-22 7:06 [PATCH] net: some optimizations in af_inet Eric Dumazet
2008-11-23 23:42 ` David Miller
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).