提交 32d18ab1 编写于 作者: P Paolo Abeni 提交者: David S. Miller

net: updating dst lastusage is an unlikely event.

Since commit 0da4af00 ("ipv6: only update __use and lastusetime
once per jiffy at most"), updating the dst lastuse field is an
unlikely action: it happens at most once per jiffy, out of
potentially millions of calls per second.

Mark explicitly the code as such, and let the compiler generate
better code.

Note: gcc 7.2 and several older versions do actually generate
different - better - code when the unlikely() hint is in place,
avoid jump in the fast path and keeping better code locality.
Signed-off-by: NPaolo Abeni <pabeni@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 a4484705
...@@ -257,7 +257,7 @@ static inline void dst_hold(struct dst_entry *dst) ...@@ -257,7 +257,7 @@ static inline void dst_hold(struct dst_entry *dst)
static inline void dst_use_noref(struct dst_entry *dst, unsigned long time) static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)
{ {
if (time != dst->lastuse) { if (unlikely(time != dst->lastuse)) {
dst->__use++; dst->__use++;
dst->lastuse = time; dst->lastuse = time;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册