Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net micro optimaize for pfil_run_hooks(), ok'ed by ozaki...



details:   https://anonhg.NetBSD.org/src/rev/ab6bd0690885
branches:  trunk
changeset: 369408:ab6bd0690885
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Tue Aug 16 04:35:57 2022 +0000

description:
micro optimaize for pfil_run_hooks(), ok'ed by ozaki-r@n.o and ryo@n.o.

That can improve IPv4 forwarding throughput 5% - 10%.

diffstat:

 sys/net/pfil.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r e95e424aa4fc -r ab6bd0690885 sys/net/pfil.c
--- a/sys/net/pfil.c    Tue Aug 16 00:44:20 2022 +0000
+++ b/sys/net/pfil.c    Tue Aug 16 04:35:57 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.c,v 1.41 2022/05/17 10:28:08 riastradh Exp $      */
+/*     $NetBSD: pfil.c,v 1.42 2022/08/16 04:35:57 knakahara Exp $      */
 
 /*
  * Copyright (c) 2013 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.41 2022/05/17 10:28:08 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.42 2022/08/16 04:35:57 knakahara Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_net_mpsafe.h"
@@ -425,6 +425,11 @@
        bound = curlwp_bind();
        s = pserialize_read_enter();
        phlist = atomic_load_consume(&phlistset->active);
+       if (phlist->nhooks == 0) {
+               pserialize_read_exit(s);
+               curlwp_bindx(bound);
+               return ret;
+       }
        psref_acquire(&psref, &phlist->psref, pfil_psref_class);
        pserialize_read_exit(s);
        for (u_int i = 0; i < phlist->nhooks; i++) {



Home | Main Index | Thread Index | Old Index