On Thu, 9 Mar 2017 14:09:18 -0700 Subash Abhinov Kasiviswanathan <subas...@codeaurora.org> 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. > > Signed-off-by: Subash Abhinov Kasiviswanathan <subas...@codeaurora.org> > Suggested-by: Eric Dumazet <eduma...@google.com> > --- This makes sense. > diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c > index d6feabb..187feae 100644 > --- a/net/ipv4/ip_input.c > +++ b/net/ipv4/ip_input.c > @@ -329,7 +329,7 @@ static int ip_rcv_finish(struct net *net, struct sock > *sk, struct sk_buff *skb) > int protocol = iph->protocol; > > ipprot = rcu_dereference(inet_protos[protocol]); > - if (ipprot && ipprot->early_demux) { > + if (ipprot && ipprot->early_demux && > *ipprot->early_demux_enabled) { > ipprot->early_demux(skb); > /* must reload iph, skb->head might have changed */ > iph = ip_hdr(skb); Another possible option would be change the function pointer for early_demux instead of having an additional conditional test (and cache line read). The downside of doing it that way is the code to turn the sysctl on/off gets more complicated than simple standard proc_int_vec.