summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-11-15 20:11:47 +0300
committerDavid S. Miller <davem@davemloft.net>2021-11-16 16:20:45 +0300
commit2a12ae5d433df3d3c3f1a930799ec09cb2b8058f (patch)
treec60295c458c53a1a382c3879c0afe407d77b5e3e
parentabc3342a09a74dcaaf11e6560c2ae859171f1167 (diff)
downloadlinux-2a12ae5d433df3d3c3f1a930799ec09cb2b8058f.tar.xz
net: inline sock_prot_inuse_add()
sock_prot_inuse_add() is very small, we can inline it. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/sock.h14
-rw-r--r--net/core/sock.c11
2 files changed, 11 insertions, 14 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index 95cc03bd3fac..5a1e1df3cefd 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1429,13 +1429,21 @@ proto_memory_pressure(struct proto *prot)
#ifdef CONFIG_PROC_FS
+#define PROTO_INUSE_NR 64 /* should be enough for the first time */
+struct prot_inuse {
+ int val[PROTO_INUSE_NR];
+};
/* Called with local bh disabled */
-void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc);
+static inline void sock_prot_inuse_add(const struct net *net,
+ const struct proto *prot, int val)
+{
+ __this_cpu_add(net->core.prot_inuse->val[prot->inuse_idx], val);
+}
int sock_prot_inuse_get(struct net *net, struct proto *proto);
int sock_inuse_get(struct net *net);
#else
-static inline void sock_prot_inuse_add(struct net *net, struct proto *prot,
- int inc)
+static inline void sock_prot_inuse_add(const struct net *net,
+ const struct proto *prot, int val)
{
}
#endif
diff --git a/net/core/sock.c b/net/core/sock.c
index c57d9883f62c..c0f9bdd5cf68 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -3536,19 +3536,8 @@ void sk_get_meminfo(const struct sock *sk, u32 *mem)
}
#ifdef CONFIG_PROC_FS
-#define PROTO_INUSE_NR 64 /* should be enough for the first time */
-struct prot_inuse {
- int val[PROTO_INUSE_NR];
-};
-
static DECLARE_BITMAP(proto_inuse_idx, PROTO_INUSE_NR);
-void sock_prot_inuse_add(struct net *net, struct proto *prot, int val)
-{
- __this_cpu_add(net->core.prot_inuse->val[prot->inuse_idx], val);
-}
-EXPORT_SYMBOL_GPL(sock_prot_inuse_add);
-
int sock_prot_inuse_get(struct net *net, struct proto *prot)
{
int cpu, idx = prot->inuse_idx;