Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754792AbcJTS1j (ORCPT ); Thu, 20 Oct 2016 14:27:39 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:44266 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753804AbcJTS1i (ORCPT ); Thu, 20 Oct 2016 14:27:38 -0400 Date: Thu, 20 Oct 2016 14:27:36 -0400 (EDT) Message-Id: <20161020.142736.708413496078305369.davem@davemloft.net> To: binoy.jayan@linaro.org Cc: ariel.elior@qlogic.com, arnd@arndb.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bnx2x: Replace semaphore stats_lock with mutex From: David Miller In-Reply-To: <1476953532-2019-1-git-send-email-binoy.jayan@linaro.org> References: <1476953532-2019-1-git-send-email-binoy.jayan@linaro.org> X-Mailer: Mew version 6.7 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 20 Oct 2016 11:27:37 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 591 Lines: 19 From: Binoy Jayan Date: Thu, 20 Oct 2016 14:22:12 +0530 > stats_lock is used as a simple mutex No, it is not. > @@ -1976,8 +1973,8 @@ int bnx2x_stats_safe_exec(struct bnx2x *bp, > /* Wait for statistics to end [while blocking further requests], > * then run supplied function 'safely'. > */ > - rc = down_timeout(&bp->stats_lock, HZ / 10); > - if (unlikely(rc)) { > + rc = mutex_trylock(&bp->stats_lock); > + if (unlikely(!rc)) { It uses timeouts therefore this conversion is not 1 to 1. You're losing functionality and potentially adding a regression.