Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751453AbWCMPnc (ORCPT ); Mon, 13 Mar 2006 10:43:32 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751448AbWCMPnc (ORCPT ); Mon, 13 Mar 2006 10:43:32 -0500 Received: from sj-iport-1-in.cisco.com ([171.71.176.70]:56418 "EHLO sj-iport-1.cisco.com") by vger.kernel.org with ESMTP id S1751444AbWCMPnb (ORCPT ); Mon, 13 Mar 2006 10:43:31 -0500 To: "Sean Hefty" Cc: , , Subject: Re: [PATCH 5/6 v2] IB: IP address based RDMA connection manager X-Message-Flag: Warning: May contain useful information References: From: Roland Dreier Date: Mon, 13 Mar 2006 07:43:28 -0800 Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.18 (linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-OriginalArrivalTime: 13 Mar 2006 15:43:28.0825 (UTC) FILETIME=[DFBAB290:01C646B4] Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1256 Lines: 39 It seems that cma_detach_from_dev(): > +static void cma_detach_from_dev(struct rdma_id_private *id_priv) > +{ > + list_del(&id_priv->list); > + if (atomic_dec_and_test(&id_priv->cma_dev->refcount)) > + wake_up(&id_priv->cma_dev->wait); > + id_priv->cma_dev = NULL; > +} doesn't need to do atomic_dec_and_test(), because it is never dropping the last reference to id_priv (and in fact if it was, the last line would be a use-after-free bug). Does it make sense to replace it with: static void cma_detach_from_dev(struct rdma_id_private *id_priv) { list_del(&id_priv->list); /* * cma_detach_from_dev() will never be dropping the last * reference to id_priv, so no need to test here. */ atomic_dec(&id_priv->cma_dev->refcount); id_priv->cma_dev = NULL; } on my x86_64 build that's worth add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-40 (-40) function old new delta cma_detach_from_dev 106 66 -40 - R. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/