From owner-freebsd-bugs@FreeBSD.ORG Wed Jul 19 08:00:37 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B4D7616A4EC for ; Wed, 19 Jul 2006 08:00:37 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A5DCE43D45 for ; Wed, 19 Jul 2006 08:00:35 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k6J80ZUB023493 for ; Wed, 19 Jul 2006 08:00:35 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k6J80Zfp023492; Wed, 19 Jul 2006 08:00:35 GMT (envelope-from gnats) Resent-Date: Wed, 19 Jul 2006 08:00:35 GMT Resent-Message-Id: <200607190800.k6J80Zfp023492@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Arthur Hartwig Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D693B16A4DE for ; Wed, 19 Jul 2006 07:49:59 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id A3E0C43D53 for ; Wed, 19 Jul 2006 07:49:59 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k6J7nxwU023183 for ; Wed, 19 Jul 2006 07:49:59 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k6J7nxK5023181; Wed, 19 Jul 2006 07:49:59 GMT (envelope-from nobody) Message-Id: <200607190749.k6J7nxK5023181@www.freebsd.org> Date: Wed, 19 Jul 2006 07:49:59 GMT From: Arthur Hartwig To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: kern/100519: Suboptimal network polling X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jul 2006 08:00:37 -0000 >Number: 100519 >Category: kern >Synopsis: Suboptimal network polling >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jul 19 08:00:34 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Arthur Hartwig >Release: 6.0 >Organization: Nokia >Environment: FreeBSD xxx.nokia.com 6.0-RELEASE FreeBSD 6.0-RELEASE #3: Wed Mar 1 10:46:02 EST 2006 hartwig@xxx.nokia.com:/usr/src/sys/i386/compile/oz-net-10 i386 >Description: Network polling has unnecessary calls to the scheduler. These require acquiring the sched lock which imposes a variable delay depending on contention for this lock. in netisr_pollmore() in kern/kern_poll.c there are two calls to schednetisrbits(). schednetisrbits is defined in net/netisr.h to set some bits in netisr and call legacy_setsoftnet(). legacy_setsoftnet() in net/netisr.c calls swi_sched(). swi_sched() in kern/kern_intr.c which calls ithread_schedule() in the same file. ithread_schedule() acquires and releases the sched_lock. >How-To-Repeat: >Fix: Since the netisr is running when netisr_pollmore() is executing and swi_net() the main netisr despatcher loops until netisr is zero, it is sufficient in netisr_pollmore() to just set the bits in netisr and not also call legacy_setsoftnet(): replace the two instances of: schednetisrbits(1 << NETISR_POLL | 1 << NETISR_POLLMORE); in netisr_pollmore() by: atomic_set_rel_int(&netisr, (1 << NETISR_POLL | 1 << NETISR_POLLMORE)); >Release-Note: >Audit-Trail: >Unformatted: