From owner-cvs-all@FreeBSD.ORG Wed Jun 9 17:50:49 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DD6A916A4CE; Wed, 9 Jun 2004 17:50:49 +0000 (GMT) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B1D943D1D; Wed, 9 Jun 2004 17:50:49 +0000 (GMT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([24.7.73.28]) by comcast.net (sccrmhc11) with ESMTP id <2004060917502001100ffltte>; Wed, 9 Jun 2004 17:50:21 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id KAA58159; Wed, 9 Jun 2004 10:50:21 -0700 (PDT) Date: Wed, 9 Jun 2004 10:50:20 -0700 (PDT) From: Julian Elischer To: Ruslan Ermilov In-Reply-To: <20040609164415.GA59326@ip.net.ua> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org cc: Lukas Ertl cc: Garrett Wollman Subject: Re: cvs commit: src/sys/kern kern_proc.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2004 17:50:50 -0000 On Wed, 9 Jun 2004, Ruslan Ermilov wrote: > On Wed, Jun 09, 2004 at 12:32:28PM -0400, Garrett Wollman wrote: > > < said: > > > > > Is there a possibility that foo->refcount is incremented after both of > > > them left the critical section, so that i is 0, but foo->refcount isn't? > > > > The only way there can be such a possibility is if you haven't counted > > all the references. > > > Are you trying to say that the 0->1 transition isn't possible? yes, in general.. Only the creator of the object can make the 0->1 transition.. then if you put it on a linked list it has 2 references. (possibly 3 if it's a bidirectionally linked list, (depending on how anal you want to get). When the creator releases its reference then teh linked list still ahs a reference. Then when you look it up, you should increment the count, and when you remove it from teh linked list you should decrement the count. Now it has only one reference... yours.. and no-one else can find it to manipulate it because it is not in the linked list any more.. so when you drop its last refernce and it goes to 0, then you KNOW that no-one else can get it to move it back to 1. > > > Cheers, > -- > Ruslan Ermilov > ru@FreeBSD.org > FreeBSD committer >