if_var.h micro-optimization
Bruce M. Simpson
bms at FreeBSD.org
Fri May 30 15:41:06 UTC 2008
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.
More information about the freebsd-net
mailing list