From owner-svn-src-all@FreeBSD.ORG Mon Mar 30 08:51:13 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A49722B2; Mon, 30 Mar 2015 08:51:13 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5CDC1B7B; Mon, 30 Mar 2015 08:51:12 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 00C321FE023; Mon, 30 Mar 2015 10:51:03 +0200 (CEST) Message-ID: <55190EA7.9010905@selasky.org> Date: Mon, 30 Mar 2015 10:51:51 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Ian Lepore , Gleb Smirnoff Subject: Re: svn commit: r280759 - head/sys/netinet References: <201503271326.t2RDQxd3056112@svn.freebsd.org> <20150328083443.GV64665@FreeBSD.org> <20150328191629.GY64665@FreeBSD.org> <5517B433.5010508@selasky.org> <20150329210757.GA64665@FreeBSD.org> <1427666182.82583.4.camel@freebsd.org> In-Reply-To: <1427666182.82583.4.camel@freebsd.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: "svn-src-head@freebsd.org" , Adrian Chadd , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , Fabien Thomas 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: Mon, 30 Mar 2015 08:51:13 -0000 Hi, Like was mentioned here, maybe we need a global counter that is not accessed that frequently, and use per-cpu counters for the most frequent accesses. To keep the order somewhat sane, we need a global counter: Pseudo code: static int V_ip_id; PER_CPU(V_ip_id_start); PER_CPU(V_ip_id_end); static uint16_t get_next_id() { if (PER_CPU(V_ip_id_start) == PER_CPU(V_ip_id_end)) { next = atomic_add32(&V_ip_id, 256); V_ip_id_start = next; V_ip_id_end = next + 256; } id = V_ip_id_start++; return (id); } --HPS