On Thu, 2017-03-09 at 20:31 -0700, Subash Abhinov Kasiviswanathan wrote: > Certain system process significant unconnected UDP workload. > It would be preferrable to disable UDP early demux for those systems > and enable it for TCP only.
> +void tcp_v4_early_demux_configure(int enable) > +{ > + if (enable) > + tcp_protocol.early_demux = tcp_v4_early_demux; > + else > + tcp_protocol.early_demux = NULL; > +} > + > +void udp_v4_early_demux_configure(int enable) > +{ > + if (enable) > + udp_protocol.early_demux = udp_v4_early_demux; > + else > + udp_protocol.early_demux = NULL; > +} > + Well, then you need to make sure ipprot->early_demux is read once in the callers, like ip_rcv_finish(), otherwise compiler could read it twice and we could deref a NULL pointer. ipprot = rcu_dereference(inet_protos[protocol]); if (ipprot && ipprot->early_demux) { ipprot->early_demux(skb); // crash