From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [RFC net-next 1/2] net: net-porcfs: Reduce rcu lock critical section Date: Tue, 10 Apr 2018 13:35:22 -0700 Message-ID: <75137dbf-4608-127e-1601-10a3c13e3a32@gmail.com> References: <20180410170812.18905-1-saeedm@mellanox.com> <20180410.131649.583776764903333305.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: David Miller , saeedm@mellanox.com Return-path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:40979 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752611AbeDJUfY (ORCPT ); Tue, 10 Apr 2018 16:35:24 -0400 Received: by mail-pf0-f195.google.com with SMTP id a2so9218891pff.8 for ; Tue, 10 Apr 2018 13:35:24 -0700 (PDT) In-Reply-To: <20180410.131649.583776764903333305.davem@davemloft.net> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 04/10/2018 10:16 AM, David Miller wrote: > > The tradeoff here is that now you are doing two unnecessary atomic > operations per stats dump. > > That is what the RCU lock allows us to avoid. > dev_hold() and dev_put() are actually per cpu increment and decrements, pretty cheap these days. Problem here is that any preemption of the process holding device reference might trigger warnings in device unregister.