From owner-svn-src-projects@FreeBSD.ORG Tue Feb 26 15:49:24 2013 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 78676E47; Tue, 26 Feb 2013 15:49:24 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-ia0-x232.google.com (mail-ia0-x232.google.com [IPv6:2607:f8b0:4001:c02::232]) by mx1.freebsd.org (Postfix) with ESMTP id 3484CB41; Tue, 26 Feb 2013 15:49:24 +0000 (UTC) Received: by mail-ia0-f178.google.com with SMTP id y26so3498068iab.23 for ; Tue, 26 Feb 2013 07:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=gUJPKwl68TfKhEDl/QilczOTJzraZQO6lsUVrZPRnyE=; b=fzBa14uG9eqUUADgvhE7+CuTarnMiqsu09gl2PjaCezIRO+hjJGsVuRhRaDz4PMbne f8sSKx/ZVeUPtiTt+pomh6z4PtE7cqIro+Xsb/LUadMAojvyTnoZMye6RW9roEsir8Fd v3so7OBcJ7H+ILmxAE6Tdy6VSu3QAO177W+hU4MsjxvdsxDTEKmtoEOEiWqF057x50em o37FA+PouX0RsdBnpvRNYnYK0f0D+u6yOPzf6dpjWN7ey5vouBd9B0Jed8JcPye20G6V MPys7UlZ7PpT/oZK74UQe31eX8NwDAngjfzh+MeZGCcrbiNuytZKkQ3Lv2K9Lt3EdaTY eNgw== MIME-Version: 1.0 X-Received: by 10.50.190.164 with SMTP id gr4mr5563848igc.19.1361893763867; Tue, 26 Feb 2013 07:49:23 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.42.117.134 with HTTP; Tue, 26 Feb 2013 07:49:23 -0800 (PST) In-Reply-To: <512CD8D7.60306@FreeBSD.org> References: <201302261525.r1QFPhLt058080@svn.freebsd.org> <512CD8D7.60306@FreeBSD.org> Date: Tue, 26 Feb 2013 16:49:23 +0100 X-Google-Sender-Auth: -TDGPBNtiA6mpnRxTJxB2PaBmQE Message-ID: Subject: Re: svn commit: r247319 - in projects/calloutng/sys: kern sys From: Attilio Rao To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Feb 2013 15:49:24 -0000 On Tue, Feb 26, 2013 at 4:46 PM, Alexander Motin wrote: > On 26.02.2013 17:28, Attilio Rao wrote: >> On Tue, Feb 26, 2013 at 4:25 PM, Alexander Motin wrote: >>> Author: mav >>> Date: Tue Feb 26 15:25:43 2013 >>> New Revision: 247319 >>> URL: http://svnweb.freebsd.org/changeset/base/247319 >>> >>> Log: >>> Optimize callout_process() to use less variables and less conditions to >>> implement the same logic. Now it fits better into CPU registers, and >>> according to PMC significntly reduces number of resource stalls, reducing >>> consumed by it CPU time during usleep(1) benchmark by 30%. >> >> Is that all improved i-cache capacity and improved dynamic branch >> prediction (hwpmc has counters for both FWIW)? > > I-cache capacity I think is not significant there as the loop is quite > small. I believe it was branch misprediction, complicated by additional > latency of memory accesses. I haven't analyzed cause deeper, as PMC man > pages are not the most informative and easiest reading. Well, I-cache is really very small, so I think you may get some improvement also for the function you were trying to optimize. You can get all the counter description by doing: pmccontrol -L >From there you may find some hwpmc counter showing i-cache and dynamic branch prediction misses statistics. Attilio -- Peace can only be achieved by understanding - A. Einstein