Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Optimize if_get_byindex by adding __predict_true
details: https://anonhg.NetBSD.org/src/rev/9221ca4b5e25
branches: trunk
changeset: 345520:9221ca4b5e25
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Tue May 31 04:05:01 2016 +0000
description:
Optimize if_get_byindex by adding __predict_true
diffstat:
sys/net/if.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (29 lines):
diff -r 04096f7c6280 -r 9221ca4b5e25 sys/net/if.c
--- a/sys/net/if.c Tue May 31 03:57:04 2016 +0000
+++ b/sys/net/if.c Tue May 31 04:05:01 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.336 2016/05/16 01:16:24 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.337 2016/05/31 04:05:01 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.336 2016/05/16 01:16:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.337 2016/05/31 04:05:01 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -2215,8 +2215,8 @@
int s;
s = pserialize_read_enter();
- ifp = (idx < if_indexlim) ? ifindex2ifnet[idx] : NULL;
- if (ifp != NULL)
+ ifp = (__predict_true(idx < if_indexlim)) ? ifindex2ifnet[idx] : NULL;
+ if (__predict_true(ifp != NULL))
psref_acquire(psref, &ifp->if_psref, ifnet_psref_class);
pserialize_read_exit(s);
Home |
Main Index |
Thread Index |
Old Index