summaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-03-29 00:38:43 +0100
committerDavid S. Miller <davem@davemloft.net>2008-03-29 00:38:43 +0100
commit1338d466d9c3f8a65cc6d83c629cd906f2a989f8 (patch)
tree2f30913c1c9c6d3c0616ac593e79b0431cc150d3 /include/net/sock.h
parent[SOCK]: Enumerate struct proto-s to facilitate percpu inuse accounting (v2). (diff)
downloadlinux-1338d466d9c3f8a65cc6d83c629cd906f2a989f8.tar.xz
linux-1338d466d9c3f8a65cc6d83c629cd906f2a989f8.zip
[SOCK]: Introduce a percpu inuse counters array (v2).
And redirect sock_prot_inuse_add and _get to use one. As far as the dereferences are concerned. Before the patch we made 1 dereference to proto->inuse.add call, the call itself and then called the __get_cpu_var() on a static variable. After the patch we make a direct call, then one dereference to proto->inuse_idx and then the same __get_cpu_var() on a still static variable. So this patch doesn't seem to produce performance penalty on SMP. This is not per-net yet, but I will deliberately make NET_NS=y case separated from NET_NS=n one, since it'll cost us one-or-two more dereferences to get the struct net and the inuse counter. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index abc6341f536f..ebf9552664b2 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -639,18 +639,15 @@ static inline void sk_refcnt_debug_release(const struct sock *sk)
# define DEFINE_PROTO_INUSE(NAME) DEFINE_PCOUNTER(NAME)
# define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse)
/* Called with local bh disabled */
-static inline void sock_prot_inuse_add(struct proto *prot, int inc)
-{
- pcounter_add(&prot->inuse, inc);
-}
+extern void sock_prot_inuse_add(struct proto *prot, int inc);
+
static inline int sock_prot_inuse_init(struct proto *proto)
{
return pcounter_alloc(&proto->inuse);
}
-static inline int sock_prot_inuse_get(struct proto *proto)
-{
- return pcounter_getval(&proto->inuse);
-}
+
+extern int sock_prot_inuse_get(struct proto *proto);
+
static inline void sock_prot_inuse_free(struct proto *proto)
{
pcounter_free(&proto->inuse);