From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roopa Prabhu Subject: Re: [PATCH net-next v3 1/3] ipv4: support sport, dport and ip_proto in RTM_GETROUTE Date: Thu, 17 May 2018 06:58:34 -0700 Message-ID: References: <1526442908-13183-2-git-send-email-roopa@cumulusnetworks.com> <20180516.143714.1321600980314123555.davem@davemloft.net> <20180516.223649.1225994765125719685.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: netdev , David Ahern , Nikolay Aleksandrov , Ido Schimmel To: David Miller Return-path: Received: from mail-ua0-f196.google.com ([209.85.217.196]:42370 "EHLO mail-ua0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751921AbeEQN6g (ORCPT ); Thu, 17 May 2018 09:58:36 -0400 Received: by mail-ua0-f196.google.com with SMTP id f3-v6so2997146uan.9 for ; Thu, 17 May 2018 06:58:36 -0700 (PDT) In-Reply-To: <20180516.223649.1225994765125719685.davem@davemloft.net> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, May 16, 2018 at 7:36 PM, David Miller wrote: > From: Roopa Prabhu > Date: Wed, 16 May 2018 13:30:28 -0700 > >> yes, but we hold rcu read lock before calling the reply function for >> fib result. I did consider allocating the skb before the read >> lock..but then the refactoring (into a separate netlink reply func) >> would seem unnecessary. >> >> I am fine with pre-allocating and undoing the refactoring if that works better. > > Hmmm... I also notice that with this change we end up doing the > rtnl_unicast() under the RCU lock which is unnecessary too. that was unintentional, it seemed like the previous code did that too.. and you are right it did not. > > So yes, please pull the "out_skb" allocation before the > rcu_read_lock(), and push the rtnl_unicast() after the > rcu_read_unlock(). agreed, will do. > > It really is a shame that sharing the ETH_P_IP skb between the route > route lookup and the netlink response doesn't work properly. I did try a few things before giving up on the same skb...since it also seemed like keeping the netlink code separate would be a good thing for the future. > > I was using RTM_GETROUTE at one point for route/fib lookup performance > measurements. It never was great at that, but now that there is going > to be two SKB allocations instead of one it is going to be even less > useful for that kind of usage. oh...did not realize this use of it. It certainly seems like we should try to retain the single skb in that case. let me see what i can do. thanks.