: Add the percpu prot_inuse counter in the struct net.
Subsystems (3)
PATCH 3/6 : Add the percpu prot_inuse counter in the struct net.
Such an accounting would cost us two more dereferences to get the percpu variable from the struct net, so I make sock_prot_inuse_get and _add calls work differently depending on CONFIG_NET_NS - without it old optimized routines are used.
The per-cpu counter for init_net is prepared in core_initcall, so that even af_inet, that starts as fs_initcall, will already have the init_net prepared.
--- include/net/netns/core.h | 3 ++ net/core/sock.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 0 deletions(-)
include/net/netns/core.h +3 -0
@@ -2,12 +2,15 @@#define __NETNS_CORE_H__struct ctl_table_header ; +struct prot_inuse ;struct netns_core {/* core sysctls */ struct ctl_table_header *sysctl_hdr;int sysctl_somaxconn; + +struct prot_inuse *inuse; };#endif
net/core/sock.c +48 -0
60 lines not on this page · raw message
Signature · 1 line
1.5.3.4
From: Pavel Emelyanov <[email protected]>
Date: Mon, 31 Mar 2008 16:15:47 +0400
Quoted 10 lines
Such an accounting would cost us two more dereferences to get the percpu variable from the struct net, so I make
sock_prot_inuse_getand_addcalls work differently depending onCONFIG_NET_NS- without it old optimized routines are used.The per-cpu counter for
init_netis prepared incore_initcall, so that evenaf_inet, that starts asfs_initcall, will already have theinit_netprepared.Signed-off-by Pavel Emelyanov <[email protected]>
Applied.