From owner-svn-src-all@FreeBSD.ORG Wed Mar 25 11:14:36 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E4291A6; Wed, 25 Mar 2015 11:14:36 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 0AD34EBD; Wed, 25 Mar 2015 11:14:35 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id t2PBEX0s009703 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 25 Mar 2015 14:14:33 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id t2PBEXl0009702; Wed, 25 Mar 2015 14:14:33 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 25 Mar 2015 14:14:33 +0300 From: Gleb Smirnoff To: Hans Petter Selasky Subject: Re: svn commit: r280495 - head/sys/kern Message-ID: <20150325111433.GT64665@FreeBSD.org> References: <201503250855.t2P8tZFp038467@svn.freebsd.org> <20150325105409.GS64665@FreeBSD.org> <551296C6.9070402@selasky.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <551296C6.9070402@selasky.org> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Mar 2015 11:14:36 -0000 On Wed, Mar 25, 2015 at 12:06:46PM +0100, Hans Petter Selasky wrote: H> On 03/25/15 11:54, Gleb Smirnoff wrote: H> > On Wed, Mar 25, 2015 at 08:55:35AM +0000, Hans Petter Selasky wrote: H> > H> Author: hselasky H> > H> Date: Wed Mar 25 08:55:34 2015 H> > H> New Revision: 280495 H> > H> URL: https://svnweb.freebsd.org/changeset/base/280495 H> > H> H> > H> Log: H> > H> Implement a simple OID number garbage collector. Given the increasing H> > H> number of dynamically created and destroyed SYSCTLs during runtime it H> > H> is very likely that the current new OID number limit of 0x7fffffff can H> > H> be reached. Especially if dynamic OID creation and destruction results H> > H> from automatic tests. Additional changes: H> > H> H> > H> - Optimize the typical use case by decrementing the next automatic OID H> > H> sequence number instead of incrementing it. This saves searching time H> > H> when inserting new OIDs into a fresh parent OID node. H> > H> H> > H> - Add simple check for duplicate non-automatic OID numbers. H> > H> > Why didn't you use alloc_unr(9) for that? H> > H> H> Hi Gleb, H> H> I thought about using alloc_unr(). The problem is that sysctls have no H> clear concept of freeing. For example in some existing code sysctl are H> unregistered and registered again assuming that the oid_number will be H> preserved. I didn't want touch those parts. Also, hence we are already H> traversing a list to insert an SYSCTL object in an ordered fashion, the H> benefit of alloc_unr() is not that big. What do you think? Is it possible to split the space into two halves: one for static OIDs and other for dynamic ones? The latter allocated via alloc_unr? -- Totus tuus, Glebius.