From owner-freebsd-net@FreeBSD.ORG Fri May 30 16:00:42 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 F2F2A106564A for ; Fri, 30 May 2008 16:00:42 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from mx30.mail.ru (mx30.mail.ru [194.67.23.238]) by mx1.freebsd.org (Postfix) with ESMTP id C47368FC18 for ; Fri, 30 May 2008 16:00:42 +0000 (UTC) (envelope-from rihad@mail.ru) Received: from [217.25.27.27] (port=9175 helo=[217.25.27.27]) by mx30.mail.ru with asmtp id 1K2720-0004vC-00; Fri, 30 May 2008 20:00:41 +0400 Message-ID: <484024A5.6080109@mail.ru> Date: Fri, 30 May 2008 21:00:37 +0500 From: rihad User-Agent: Icedove 1.5.0.14eol (X11/20080509) MIME-Version: 1.0 To: "Bruce M. Simpson" References: <483FFE36.7050006@mail.ru> <4840200F.6070602@FreeBSD.org> In-Reply-To: <4840200F.6070602@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: Not detected X-Mras: OK 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 16:00:43 -0000 Bruce M. Simpson wrote: > 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, Whoa, why don't you take it easy on me :) I'm not that much into kernel (or hardware) programming. It's just that reading Ch. 3 of TCP/IP Illustrated Vol.2 by Rich Stevens got me digging around FreeBSD source code dealing with struct ifnet, where this piece of code caught my attention. > but to evaluate your suggested change requires a lot > more data. Do you plan to do this? Perhaps there is already a framework for trying out changes in -CURRENT and seeing their relative impact, so perhaps someone more experienced than I am can see to this? > Given how _IF_DEQUEUE() is normally > used the impact is likely negligible. Oh, I see. A nice first attempt of mine anyway ;) Thanks.