Message ID | 1454365952-10324-2-git-send-email-noureddine@arista.com |
---|---|
State | Superseded, archived |
Delegated to: | David Miller |
Headers | show |
Hello, On Mon, 1 Feb 2016, Salam Noureddine wrote: > +#ifdef CONFIG_NET_NS > +static inline void net_add_event_list(struct list_head *head, struct net *net) > +{ > + if (!list_empty(&net->event_list)) Above check looks inverted, it works may be because INIT_LIST_HEAD(&net->event_list) is missing. > + list_add_tail(&net->event_list, head); > +} > + Regards -- Julian Anastasov <ja@ssi.bg>
On Tue, Feb 2, 2016 at 12:01 PM, Julian Anastasov <ja@ssi.bg> wrote: >> +#ifdef CONFIG_NET_NS >> +static inline void net_add_event_list(struct list_head *head, struct net *net) >> +{ >> + if (!list_empty(&net->event_list)) > > Above check looks inverted, it works may be > because INIT_LIST_HEAD(&net->event_list) is missing. > >> + list_add_tail(&net->event_list, head); >> +} >> + Thanks for catching this! I ran my benchmark again with the corrected check and I still get the same benefits with respect to rtnl_lock hold time. Salam
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 4089abc..4cf47de 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -58,6 +58,7 @@ struct net { struct list_head list; /* list of network namespaces */ struct list_head cleanup_list; /* namespaces on death row */ struct list_head exit_list; /* Use only net_mutex */ + struct list_head event_list; /* net_device notifier list */ struct user_namespace *user_ns; /* Owning user namespace */ spinlock_t nsid_lock; @@ -380,4 +381,25 @@ static inline void fnhe_genid_bump(struct net *net) atomic_inc(&net->fnhe_genid); } +#ifdef CONFIG_NET_NS +static inline void net_add_event_list(struct list_head *head, struct net *net) +{ + if (!list_empty(&net->event_list)) + list_add_tail(&net->event_list, head); +} + +static inline void net_del_event_list(struct net *net) +{ + list_del_init(&net->event_list); +} +#else +static inline void net_add_event_list(struct list_head *head, struct net *net) +{ +} + +static inline void net_del_event_list(struct net *net) +{ +} +#endif + #endif /* __NET_NET_NAMESPACE_H */
Signed-off-by: Salam Noureddine <noureddine@arista.com> --- include/net/net_namespace.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)