From owner-freebsd-current@FreeBSD.ORG Wed Mar 22 20:29:41 2006 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC13516A401 for ; Wed, 22 Mar 2006 20:29:41 +0000 (UTC) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8747543D46 for ; Wed, 22 Mar 2006 20:29:41 +0000 (GMT) (envelope-from rizzo@icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.11/8.12.11) with ESMTP id k2MKTelV041821; Wed, 22 Mar 2006 12:29:40 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.11/8.12.3/Submit) id k2MKT6wd041804; Wed, 22 Mar 2006 12:29:06 -0800 (PST) (envelope-from rizzo) Date: Wed, 22 Mar 2006 12:29:06 -0800 From: Luigi Rizzo To: current@freebsd.org Message-ID: <20060322122906.A41691@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Cc: Subject: interesting(?) data on network interrupt servicing X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Mar 2006 20:29:41 -0000 Paolo Pisati (SoC work on in-kernel natd) has done some work on measuring where time is spent in servicing network interrupts, and what's the difference between 4.x and 7.x, and probably has some interesting result. He ran the experiments on his laptop (1.6-1.7GHz with APIC and bfe card), recording timestamps with the TSC in various places of the code path. What he saw is that the basic operation of the interruopt service routine, bfe_intr() is approx the same on 4.x and 7.x, taking between 7-10k TSC ticks on a lightly loaded system. On 7.x, however, there is an extra 9-10k TSC ticks (which may well be hidden in the assembly code on 4.x, but not sure about that) which apparently are spent half in this line in sys/i386/i386/intr_machdep.c if (thread) isrc->is_pic->pic_disable_source(isrc, PIC_EOI); and the other half in the block (removed in 1.274, but we ran the tests on an earlier version) in sys/kern/kern_synch.c - binuptime(&new_switchtime); - bintime_add(&p->p_rux.rux_runtime, &new_switchtime); - bintime_sub(&p->p_rux.rux_runtime, PCPU_PTR(switchtime)); I have good reasons to believe that on modern hardware the replacement, cpu_ticks() , is quite a bit faster. I have no idea, though, why the other pic_disable_source() is so expensive. The 4-5k TSC ticks are approx 3us Any clues ? Paolo should follow up in the next days with graphs and more data. cheers luigi