mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-15 22:31:47 -04:00
net: dynamically allocate fqdir structures
Following patch will add rcu grace period before fqdir rhashtable destruction, so we need to dynamically allocate fqdir structures to not force expensive synchronize_rcu() calls in netns dismantle path. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
a39aca678a
commit
4907abc605
@@ -105,14 +105,25 @@ struct inet_frags {
|
||||
int inet_frags_init(struct inet_frags *);
|
||||
void inet_frags_fini(struct inet_frags *);
|
||||
|
||||
static inline int fqdir_init(struct fqdir *fqdir, struct inet_frags *f,
|
||||
static inline int fqdir_init(struct fqdir **fqdirp, struct inet_frags *f,
|
||||
struct net *net)
|
||||
{
|
||||
struct fqdir *fqdir = kzalloc(sizeof(*fqdir), GFP_KERNEL);
|
||||
int res;
|
||||
|
||||
if (!fqdir)
|
||||
return -ENOMEM;
|
||||
fqdir->f = f;
|
||||
fqdir->net = net;
|
||||
atomic_long_set(&fqdir->mem, 0);
|
||||
return rhashtable_init(&fqdir->rhashtable, &fqdir->f->rhash_params);
|
||||
res = rhashtable_init(&fqdir->rhashtable, &fqdir->f->rhash_params);
|
||||
if (res < 0) {
|
||||
kfree(fqdir);
|
||||
return res;
|
||||
}
|
||||
*fqdirp = fqdir;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fqdir_exit(struct fqdir *fqdir);
|
||||
|
||||
void inet_frag_kill(struct inet_frag_queue *q);
|
||||
|
||||
@@ -16,7 +16,7 @@ struct netns_sysctl_lowpan {
|
||||
|
||||
struct netns_ieee802154_lowpan {
|
||||
struct netns_sysctl_lowpan sysctl;
|
||||
struct fqdir fqdir;
|
||||
struct fqdir *fqdir;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -72,7 +72,7 @@ struct netns_ipv4 {
|
||||
|
||||
struct inet_peer_base *peers;
|
||||
struct sock * __percpu *tcp_sk;
|
||||
struct fqdir fqdir;
|
||||
struct fqdir *fqdir;
|
||||
#ifdef CONFIG_NETFILTER
|
||||
struct xt_table *iptable_filter;
|
||||
struct xt_table *iptable_mangle;
|
||||
|
||||
@@ -58,7 +58,7 @@ struct netns_ipv6 {
|
||||
struct ipv6_devconf *devconf_all;
|
||||
struct ipv6_devconf *devconf_dflt;
|
||||
struct inet_peer_base *peers;
|
||||
struct fqdir fqdir;
|
||||
struct fqdir *fqdir;
|
||||
#ifdef CONFIG_NETFILTER
|
||||
struct xt_table *ip6table_filter;
|
||||
struct xt_table *ip6table_mangle;
|
||||
@@ -116,7 +116,7 @@ struct netns_ipv6 {
|
||||
|
||||
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
|
||||
struct netns_nf_frag {
|
||||
struct fqdir fqdir;
|
||||
struct fqdir *fqdir;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user