From owner-freebsd-net@FreeBSD.ORG Fri May 30 15:41:06 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 465B31065679 for ; Fri, 30 May 2008 15:41:06 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.freebsd.org (Postfix) with ESMTP id 32CD28FC1B for ; Fri, 30 May 2008 15:41:05 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 591B2111778; Fri, 30 May 2008 11:41:05 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 30 May 2008 11:41:05 -0400 X-Sasl-enc: USwBYdOArlUJ0g5TkHhgPi8rtp4rg7pMCK4y2O59pzAK 1212162065 Received: from empiric.lon.incunabulum.net (82-35-112-254.cable.ubr07.dals.blueyonder.co.uk [82.35.112.254]) by mail.messagingengine.com (Postfix) with ESMTPSA id D26922B443; Fri, 30 May 2008 11:41:04 -0400 (EDT) Message-ID: <4840200F.6070602@FreeBSD.org> Date: Fri, 30 May 2008 16:41:03 +0100 From: "Bruce M. Simpson" User-Agent: Thunderbird 2.0.0.14 (X11/20080514) MIME-Version: 1.0 To: rihad References: <483FFE36.7050006@mail.ru> In-Reply-To: <483FFE36.7050006@mail.ru> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-net@freebsd.org Subject: Re: if_var.h micro-optimization X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 May 2008 15:41:06 -0000 rihad wrote: > Not sure if this is a worthwhile optimization? FreeBSD 7.0 > > --- /usr/src/sys/net/if_var.h 2007-12-07 09:46:08.000000000 +0400 > +++ if_var.h 2008-05-30 18:10:25.000000000 +0500 > @@ -282,7 +282,8 @@ > if (m) { \ > if (((ifq)->ifq_head = (m)->m_nextpkt) == NULL) \ > (ifq)->ifq_tail = NULL; \ > - (m)->m_nextpkt = NULL; \ > + else \ > + (m)->m_nextpkt = NULL; \ > (ifq)->ifq_len--; \ > } \ > } while (0) It could save dirtying an L2 data cache line at the expense of taking a conditional branch, but to evaluate your suggested change requires a lot more data. Do you plan to do this? Given how _IF_DEQUEUE() is normally used the impact is likely negligible.