Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jul 2006 07:49:59 GMT
From:      Arthur Hartwig <arthur.hartwig@nokia.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/100519: Suboptimal network polling
Message-ID:  <200607190749.k6J7nxK5023181@www.freebsd.org>
Resent-Message-ID: <200607190800.k6J80Zfp023492@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607190749.k6J7nxK5023181>