aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/sock.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-11-15 09:11:49 -0800
committerDavid S. Miller <davem@davemloft.net>2021-11-16 13:20:45 +0000
commit4199bae10c49e24bc2c5d8c06a68820d56640000 (patch)
treeb2961c173f6371d1e6c6025c8dc8d7cee442dc7f /include/net/sock.h
parentnet: make sock_inuse_add() available (diff)
downloadlinux-dev-4199bae10c49e24bc2c5d8c06a68820d56640000.tar.xz
linux-dev-4199bae10c49e24bc2c5d8c06a68820d56640000.zip
net: merge net->core.prot_inuse and net->core.sock_inuse
net->core.sock_inuse is a per cpu variable (int), while net->core.prot_inuse is another per cpu variable of 64 integers. per cpu allocator tend to place them in very different places. Grouping them together makes sense, since it makes updates potentially faster, if hitting the same cache line. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r--include/net/sock.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h
index c4c981a51797..5589312531df 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -1431,6 +1431,7 @@ 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 all;
int val[PROTO_INUSE_NR];
};
/* Called with local bh disabled */
@@ -1442,7 +1443,7 @@ static inline void sock_prot_inuse_add(const struct net *net,
static inline void sock_inuse_add(const struct net *net, int val)
{
- this_cpu_add(*net->core.sock_inuse, val);
+ this_cpu_add(net->core.prot_inuse->all, val);
}
int sock_prot_inuse_get(struct net *net, struct proto *proto);