Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Mar 2007 07:36:28 -0700
From:      Luigi Rizzo <rizzo@icir.org>
To:        Vlad GALU <dudu@dudu.ro>
Cc:        Emile Coetzee <EmileC@clarotech.co.za>, freebsd-stable@freebsd.org
Subject:   Re: Openvpn tap uses 99% cpu time
Message-ID:  <20070314073628.A78775@xorpc.icir.org>
In-Reply-To: <ad79ad6b0703140648w586e60f1p12015c801b23c855@mail.gmail.com>; from dudu@dudu.ro on Wed, Mar 14, 2007 at 03:48:38PM %2B0200
References:  <316F15B309F69F4CA5AB2C72BE26C21501ADFEFF@prowler.clarotech.co.za> <ad79ad6b0703140648w586e60f1p12015c801b23c855@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Mar 14, 2007 at 03:48:38PM +0200, Vlad GALU wrote:
> On 3/14/07, Emile Coetzee <EmileC@clarotech.co.za> wrote:
> > Since the latest updates to sys/net/if_tap.c (I suspect) in 6.2-STABLE
> > my openvpn tap server is using up all available CPU time (99%)
> > effectively killing the box.
...
>    It usually happens when OpenVPN is told to retry connecting to the
> remote endpoint and the remote endpoint isn't accessible due to
> network conditions. It happens the same even on Windows.

something that often does the job is putting a usleep(1)
right after the offending syscall (e.g. a select() returning
with an error, or the like).
This deschedules the current process for at least one tick,
which is normally enough to change the busy-wait loop into one
that still is busy-wait but only takes a tiny fraction of the cpu.
Of course you want to usleep() only if there is a real error condition.

cheers
luigi



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