From owner-freebsd-net@FreeBSD.ORG Tue Oct 28 16:13:15 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA31B1065679; Tue, 28 Oct 2008 16:13:15 +0000 (UTC) (envelope-from gizmen@blurp.pl) Received: from albion.azs.pwr.wroc.pl (albion.azs.pwr.wroc.pl [156.17.17.145]) by mx1.freebsd.org (Postfix) with ESMTP id 66EE18FC17; Tue, 28 Oct 2008 16:13:15 +0000 (UTC) (envelope-from gizmen@blurp.pl) Received: from localhost.localnet (blurp.t2.ds.pwr.wroc.pl [156.17.224.5]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by albion.azs.pwr.wroc.pl (Postfix) with ESMTPSA id 66B97116FB; Tue, 28 Oct 2008 17:13:14 +0100 (CET) From: Bartosz Giza To: freebsd-net@freebsd.org Date: Tue, 28 Oct 2008 16:13:13 +0000 User-Agent: KMail/1.10.1 (Linux/2.6.25-gentoo-r8; KDE/4.1.2; i686; ; ) References: <1225203780.00029971.1225190402@10.7.7.3> <49072BC9.4010103@FreeBSD.org> In-Reply-To: <49072BC9.4010103@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200810281613.13719.gizmen@blurp.pl> Cc: Alexander Motin Subject: Re: two NIC on 2 core system (scheduling problem) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Oct 2008 16:13:16 -0000 On Tuesday 28 of October 2008 15:12:09 Alexander Motin wrote: > Bartosz Giza wrote: > > On other router based on the same hardware and software i have something > > like that: > > > > 10 root 1 171 ki31 0K 8K RUN 1 235.4H 78.66% idle: > > cpu1 11 root 1 171 ki31 0K 8K RUN 0 185.2H 72.12% idle: > > cpu0 20 root 1 -68 - 0K 8K - 0 48.7H 23.00% em0 > > taskq 23 root 1 -68 - 0K 8K WAIT 0 19.2H 9.67% > > irq16: fxp1 21 root 1 -68 - 0K 8K WAIT 1 28.2H 8.01% > > irq17: bge0 > > > > I don't know why on this router system balance over two cores. One > > difference is that on this router i have another fxp card (3 total) > > In verbose boot messages system shows that different IRQs assigned to > different APICs in round-robin fashion. So I may assume that this > IRQ->CPU mapping is static. em0's taskqueue at the same time able to > migrate CPUs as any usual process. I am not sure it is that true. When i watch top i see that sometimes irq: bge0 process switch to core 0 but most of the time is on core 1. So scheduler sometimes put this process on different core. > > Another question is why em0 taskq is eating so much cpu ? BGE interface > > is actually one that pushes 2 times more packets than em0 and it uses > > about half cpu comparing to em0. Is that not strange ? > > Could someone tell my why is this happening ? BGE is faster ? or maybe i > > can tune some > > The CPU time you see there includes much more then just a card handling > itself. It also includes CPU time of the most parts of network stack > used to process received packet. So if you have NAT, big firewall, > netgraph or any other CPU-hungry actions done with packets incoming via > em0 you will see such results. > Even more interesting is that if bge0 or fxp0 cards will require much > CPU time to send packet, this time will also be accounted to em0 process. > :) WOW that is weird. Yes i have quite big ipfw firewall and also couple of rules from pf. So you are saying that whole overhead from firewall is counted to this em taskq process. This is really strange for somebody who don't know about this. So what in case if i would have two em nic's. How would then overhead from firewalls be counted ? Splited to two taskq processes ? And another really weird thing is that if i have other card their processing are counted to tasq process of different NIC. Why is this done in such a way ?