Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932105AbWA3FgX (ORCPT ); Mon, 30 Jan 2006 00:36:23 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751247AbWA3FgX (ORCPT ); Mon, 30 Jan 2006 00:36:23 -0500 Received: from smtpout.mac.com ([17.250.248.83]:31191 "EHLO smtpout.mac.com") by vger.kernel.org with ESMTP id S1751245AbWA3FgW (ORCPT ); Mon, 30 Jan 2006 00:36:22 -0500 In-Reply-To: <43DDA1E7.5010109@cosmosbay.com> References: <20060129190539.GA26794@kroah.com> <20060130045153.GC13244@kroah.com> <43DDA1E7.5010109@cosmosbay.com> Mime-Version: 1.0 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Greg KH , "Eric W. Biederman" , linux-kernel@vger.kernel.org, vserver@list.linux-vserver.org, Herbert Poetzl , "Serge E. Hallyn" , Alan Cox , Dave Hansen , Arjan van de Ven , Suleiman Souhlal , Hubertus Franke , Cedric Le Goater Content-Transfer-Encoding: 7bit From: Kyle Moffett Subject: Re: [PATCH 1/5] pid: Implement task references. Date: Mon, 30 Jan 2006 00:35:14 -0500 To: Eric Dumazet X-Mailer: Apple Mail (2.746.2) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1124 Lines: 34 On Jan 30, 2006, at 00:19, Eric Dumazet wrote: > - if (atomic_dec_and_test(&kref->refcount)) { > + /* > + * if current count is one, we are the last user and can release > object > + * right now, avoiding an atomic operation on 'refcount' > + */ > + if ((atomic_read(&kref->refcount) == 1) || Uhh, I think you got this test reversed. Didn't you mean != 1? Otherwise you only do the dec_and_test when the refcount is one, which means that you leak everything kref-ed. > + (atomic_dec_and_test(&kref->refcount))) { > release(kref); > return 1; > } Cheers, Kyle Moffett -- There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult. -- C.A.R. Hoare - 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/