From owner-svn-src-head@FreeBSD.ORG Sun Mar 29 15:16:47 2015 Return-Path: Delivered-To: svn-src-head@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 EDEE1990; Sun, 29 Mar 2015 15:16:46 +0000 (UTC) Received: from mail-ie0-x22e.google.com (mail-ie0-x22e.google.com [IPv6:2607:f8b0:4001:c03::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B1548EDE; Sun, 29 Mar 2015 15:16:46 +0000 (UTC) Received: by iecvj10 with SMTP id vj10so100550073iec.0; Sun, 29 Mar 2015 08:16:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=v8zucYXHENYq9WUsDZxKmnQzZVkFtWjZhjNAMHJTd24=; b=hPIfhKUPY+vOnbaNi78sm5fnyldyChzaY3ayGvqjarj0g/gkK/In28ASSP6mMaQsV8 xwMLb7XBd89v+2hmWHedKPr74XURaCtNVzHaXgLhAdM8IDRbEa35/SA1vvQDjdxAeCFQ by6RyvgGgh4WATjM2SoNkOo9T7JG/jQtj2z9eZnvDculI7kjx4otMyXJFJYcQAvEAMBT yaCxtc8e6ebu5rALXdIxkKyQEOpTdB8/6I4itx11Ea7t0lR6DrrCMwzDcbj0b0ll1EVq cnTim77aa2afHie5eiAskI1Al+9UED6EH0kTtElGUA21ACizmHJ2QMZS0FNm6of33hHI 2LRQ== MIME-Version: 1.0 X-Received: by 10.50.132.66 with SMTP id os2mr11951301igb.6.1427642206088; Sun, 29 Mar 2015 08:16:46 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.17.194 with HTTP; Sun, 29 Mar 2015 08:16:46 -0700 (PDT) In-Reply-To: <5517B433.5010508@selasky.org> References: <201503271326.t2RDQxd3056112@svn.freebsd.org> <20150328083443.GV64665@FreeBSD.org> <20150328191629.GY64665@FreeBSD.org> <5517B433.5010508@selasky.org> Date: Sun, 29 Mar 2015 08:16:46 -0700 X-Google-Sender-Auth: VtMCYWNw3_-2-ibEX7835d7UVqQ Message-ID: Subject: Re: svn commit: r280759 - head/sys/netinet From: Adrian Chadd To: Hans Petter Selasky Content-Type: text/plain; charset=UTF-8 Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Gleb Smirnoff , "src-committers@freebsd.org" , Fabien Thomas X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Mar 2015 15:16:47 -0000 On 29 March 2015 at 01:13, Hans Petter Selasky wrote: > On 03/28/15 20:16, Gleb Smirnoff wrote: >> >> +uint16_t >> +ip_newid(void) >> +{ >> + >> + counter_u64_add(V_ip_id, 1); >> + return (htons((*(uint64_t *)zpcpu_get(V_ip_id)) & 0xffff)); >> +} > > > Technically you would need to enter a critical section here, so that the > current process doesn't get swapped to a different CPU between the counter > add and the zpcpu_get. +10000 here. You can get preempted and shifted to another CPU at almost any point in time you're not explicitly asking not to be. It's.. frustrating. -adrian