From owner-dev-commits-src-main@freebsd.org Thu Jul 29 06:07:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 539C666B856 for ; Thu, 29 Jul 2021 06:07:57 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb2c.google.com (mail-yb1-xb2c.google.com [IPv6:2607:f8b0:4864:20::b2c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gb0SY1j8tz3F1t for ; Thu, 29 Jul 2021 06:07:57 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb2c.google.com with SMTP id k65so8245417yba.13 for ; Wed, 28 Jul 2021 23:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ziguv4FopbVVvrHEJYzKHkwkBrvlagQSmvpD7cNccGA=; b=mVfrqcvi7Gyd/Q7c8EqXretJkuFf6KmZJdq0hAByxzvZ5uj7hIusTy6jwztyomd55t t0zLxOgxF7IN7sICNBehBw07FJj8XT01mt6s6xxdXTGWN3PRVqdf9aYLHVjcOyX0TZv1 PqgmoUn4LIA+5smKctM8kOuWlhgIyG2ugNDB0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ziguv4FopbVVvrHEJYzKHkwkBrvlagQSmvpD7cNccGA=; b=oF/5Q2DwBODgIEQQ3VuyKKhtJFi6+oGHXQExFNjw1JHsEXaYtk1ykaW31oH5M0RZWp 0vbjqb63swkdouorw28CdS7FOtVckapJ+Lu10ka8HtQt0cuJJreUPFemIYan70+JJKaW fuOmIv+XXJqb9xj3SRyUa/YSIuMcnwnDuYZB4yydBGBfYZi2psNHRC5+8SRm4Zs7O01J +AVuCV8I7k5CaBOqIpHKhlKZltfvbk0yKl00fb87vyCnXVoIh+PxZ03qsZgPymTiY8UV FpDpXbgFTV0lCMxTS21+GDSaSlq5mFyNTsG4qHDh3E5muMCygZPQaoTqiGurrW29xXWs PkzQ== X-Gm-Message-State: AOAM533GJ0wyj2YCsqrGE4a2kjdmuLoQc8QIkURwkT1UcnroAx0P/B9Q X2O9H72I1SGQGYsxawtR61pxt+hWC4/t4oEsiLEe1Q== X-Google-Smtp-Source: ABdhPJzMLiF480R8Pf/eVhWPtYqEgs+0iEhWAs9yuLTSvd314QFsIeGgwlGkliDvWw8+PF9JruG32dW9SrJ9p5DV0a0= X-Received: by 2002:a25:4187:: with SMTP id o129mr4506358yba.455.1627538876731; Wed, 28 Jul 2021 23:07:56 -0700 (PDT) MIME-Version: 1.0 References: <202107290200.16T20XOM038857@gitrepo.freebsd.org> In-Reply-To: <202107290200.16T20XOM038857@gitrepo.freebsd.org> From: Kevin Bowling Date: Wed, 28 Jul 2021 23:07:45 -0700 Message-ID: Subject: Re: git: aefe0a8c32d3 - main - Refactor/optimize cpu_search_*(). To: Alexander Motin Cc: dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org, src-committers@freebsd.org X-Rspamd-Queue-Id: 4Gb0SY1j8tz3F1t X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Jul 2021 06:07:57 -0000 On Wed, Jul 28, 2021 at 7:00 PM Alexander Motin wrote: > The branch main has been updated by mav: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=aefe0a8c32d370f2fdd0d0771eb59f8845beda17 > > commit aefe0a8c32d370f2fdd0d0771eb59f8845beda17 > Author: Alexander Motin > AuthorDate: 2021-07-29 01:18:50 +0000 > Commit: Alexander Motin > CommitDate: 2021-07-29 02:00:29 +0000 > > Refactor/optimize cpu_search_*(). > > Remove cpu_search_both(), unused for many years. Without it there is > less sense for the trick of compiling common cpu_search() into separate > cpu_search_lowest() and cpu_search_highest(), so split them completely, > making code more readable. While there, split iteration over children > groups and CPUs, complicating code for very small deduplication. > > Stop passing cpuset_t arguments by value and avoid some manipulations. > Since MAXCPU bump from 64 to 256, what was a single register turned > into 32-byte memory array, requiring memory allocation and accesses. > Splitting struct cpu_search into parameter and result parts allows to > even more reduce stack usage, since the first can be passed through > on recursion. > > Remove CPU_FFS() from the hot paths, precalculating first and last CPU > for each CPU group in advance during initialization. Again, it was > not a problem for 64 CPUs before, but for 256 FFS needs much more code. > > With these changes on 80-thread system doing ~260K uncached ZFS reads > per second I observe ~30% reduction of time spent in cpu_search_*(). Nice! I recall seeing contention here on other workloads on high core count systems. Regards, Kevin