Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750729AbWBFA7I (ORCPT ); Sun, 5 Feb 2006 19:59:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750736AbWBFA7I (ORCPT ); Sun, 5 Feb 2006 19:59:08 -0500 Received: from gate.crashing.org ([63.228.1.57]:4227 "EHLO gate.crashing.org") by vger.kernel.org with ESMTP id S1750729AbWBFA7G (ORCPT ); Sun, 5 Feb 2006 19:59:06 -0500 Subject: Re: [RFC][PATCH 1/5] Virtualization/containers: startup From: Benjamin Herrenschmidt To: Kirill Korotaev Cc: Linus Torvalds , Andrew Morton , Linux Kernel Mailing List , frankeh@watson.ibm.com, clg@fr.ibm.com, haveblue@us.ibm.com, greg@kroah.com, alan@lxorguk.ukuu.org.uk, serue@us.ibm.com, arjan@infradead.org, Rik van Riel , Alexey Kuznetsov , Andrey Savochkin , devel@openvz.org In-Reply-To: <43E38BD1.4070707@openvz.org> References: <43E38BD1.4070707@openvz.org> Content-Type: text/plain Date: Mon, 06 Feb 2006 11:56:31 +1100 Message-Id: <1139187391.5634.32.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 955 Lines: 30 On Fri, 2006-02-03 at 19:58 +0300, Kirill Korotaev wrote: > +static inline vps_t get_vps(vps_t vps) > +{ > + atomic_inc(&vps->refcnt); > + return vps; > +} > + > +static inline void put_vps(vps_t vps) > +{ > + atomic_dec(&vps->refcnt); > +} I'm not too sure about the refcounting here .. you never destroy the object ? Also, why introduce your own refcounting mecanism instead of using existing ones ? You could probably use at least a kref to get a nice refcount + destructor instead of home made atomics based. Maybe some higher level structure if you think it makes sense (not too sure what this virtualization stuff is about so I can't comment on what data structure is appropriate here). Cheers, Ben. - 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/