From owner-freebsd-bugs@FreeBSD.ORG Tue May 5 13:20:03 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 911CC1065677 for ; Tue, 5 May 2009 13:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 51A368FC1C for ; Tue, 5 May 2009 13:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n45DK3i9059451 for ; Tue, 5 May 2009 13:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n45DK3Og059450; Tue, 5 May 2009 13:20:03 GMT (envelope-from gnats) Resent-Date: Tue, 5 May 2009 13:20:03 GMT Resent-Message-Id: <200905051320.n45DK3Og059450@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, Michel Henaut Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C92BB10656AC for ; Tue, 5 May 2009 13:10:51 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id B68BC8FC35 for ; Tue, 5 May 2009 13:10:51 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n45DApxR065349 for ; Tue, 5 May 2009 13:10:51 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n45DAorr065348; Tue, 5 May 2009 13:10:50 GMT (envelope-from nobody) Message-Id: <200905051310.n45DAorr065348@www.freebsd.org> Date: Tue, 5 May 2009 13:10:50 GMT From: Michel Henaut To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/134231: performance issue 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: Tue, 05 May 2009 13:20:03 -0000 >Number: 134231 >Category: kern >Synopsis: performance issue >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue May 05 13:20:02 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Michel Henaut >Release: 5.5,6.2,6.3,6.4,7.0,7.1,7.2 >Organization: everyware ltd >Environment: FreeBSD freebsd72-64.local 7.2-RELEASE FreeBSD 7.2-RELEASE >Description: We have an application (server statistics), which uses sysctl and kvm_read. We discovered that the Cpu use of our collector increased by 80% between 6.2 and 7.2. A small test program calling 10'000 sysctl gives the following result: 6.2: real 0m2.098s user 0m0.000s sys 0m2.073s 7.0: real 0m4.352s user 0m0.036s sys 0m4.119s Do you plan another way to get a sysctl resource other than the full scan done in the different sysctl_find_oid. (use of tree instead of linked list). regards >How-To-Repeat: #include #include #include int main() { int mib[4], st, nprocs; size_t size; int temp_op; int op = KERN_PROC_ALL; int arg = 0; int i; mib[0] = CTL_KERN; mib[1] = KERN_PROC; mib[2] = op; mib[3] = arg; temp_op = op & ~KERN_PROC_INC_THREAD; for (i = 0; i < 10000; i++) { st = sysctl(mib, 3, NULL, &size, NULL, 0); if (st == -1) { fprintf(stderr, "sysctl error\n"); exit(1); } } exit(0); } >Fix: >Release-Note: >Audit-Trail: >Unformatted: