Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 May 2008 21:00:37 +0500
From:      rihad <rihad@mail.ru>
To:        "Bruce M. Simpson" <bms@FreeBSD.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: if_var.h micro-optimization
Message-ID:  <484024A5.6080109@mail.ru>
In-Reply-To: <4840200F.6070602@FreeBSD.org>
References:  <483FFE36.7050006@mail.ru> <4840200F.6070602@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?484024A5.6080109>