From: mpi Date: Tue, 9 Jan 2018 17:50:57 +0000 (+0000) Subject: Stop grabing the KERNEL_LOCK() for running protocol input routines. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e839bdc73a1f7fa16bfcc2f44438301df154a3e2;p=openbsd Stop grabing the KERNEL_LOCK() for running protocol input routines. The NET_LOCK() is already held in this thread and is now enough. People interested in ARP/bridge(4)/switch(4)/pipex(4)/pppoe(4) performances can now push the KERNEL_LOCK() without depending on other subsystems/drivers. Tested by Hrvoje Popovski. ok bluhm@, visa@ --- diff --git a/sys/net/if.c b/sys/net/if.c index 5dc00bd0340..0c2517a6171 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.535 2018/01/09 06:24:14 dlg Exp $ */ +/* $OpenBSD: if.c,v 1.536 2018/01/09 17:50:57 mpi Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -920,7 +920,6 @@ if_netisr(void *unused) { int n, t = 0; - KERNEL_LOCK(); NET_LOCK(); while ((n = netisr) != 0) { @@ -934,8 +933,11 @@ if_netisr(void *unused) atomic_clearbits_int(&netisr, n); #if NETHER > 0 - if (n & (1 << NETISR_ARP)) + if (n & (1 << NETISR_ARP)) { + KERNEL_LOCK(); arpintr(); + KERNEL_UNLOCK(); + } #endif if (n & (1 << NETISR_IP)) ipintr(); @@ -944,35 +946,52 @@ if_netisr(void *unused) ip6intr(); #endif #if NPPP > 0 - if (n & (1 << NETISR_PPP)) + if (n & (1 << NETISR_PPP)) { + KERNEL_LOCK(); pppintr(); + KERNEL_UNLOCK(); + } #endif #if NBRIDGE > 0 - if (n & (1 << NETISR_BRIDGE)) + if (n & (1 << NETISR_BRIDGE)) { + KERNEL_LOCK(); bridgeintr(); + KERNEL_UNLOCK(); + } #endif #if NSWITCH > 0 - if (n & (1 << NETISR_SWITCH)) + if (n & (1 << NETISR_SWITCH)) { + KERNEL_LOCK(); switchintr(); + KERNEL_UNLOCK(); + } #endif #if NPPPOE > 0 - if (n & (1 << NETISR_PPPOE)) + if (n & (1 << NETISR_PPPOE)) { + KERNEL_LOCK(); pppoeintr(); + KERNEL_UNLOCK(); + } #endif #ifdef PIPEX - if (n & (1 << NETISR_PIPEX)) + if (n & (1 << NETISR_PIPEX)) { + KERNEL_LOCK(); pipexintr(); + KERNEL_UNLOCK(); + } #endif t |= n; } #if NPFSYNC > 0 - if (t & (1 << NETISR_PFSYNC)) + if (t & (1 << NETISR_PFSYNC)) { + KERNEL_LOCK(); pfsyncintr(); + KERNEL_UNLOCK(); + } #endif NET_UNLOCK(); - KERNEL_UNLOCK(); } void