Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2234375ybh; Fri, 24 Jul 2020 07:46:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOZUZabXopMWIIrJzSUEbi220JeLP8p7YBVgO3gPTIT9i3RkrI2XtmSxw3XK2EwUr2yaH3 X-Received: by 2002:a05:6402:318d:: with SMTP id di13mr9672031edb.172.1595601962380; Fri, 24 Jul 2020 07:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595601962; cv=none; d=google.com; s=arc-20160816; b=d/ODwyj0yFKN6a+GPx+45Li3ij/2UK6auO7C2+Pf23K95KiVi/8tAvQlW/Hf9vhriE yFFqeKX679ZKFh7CFL6IZDXTtWqohOcSzZOdD4HVdBGi5A+KsmzvBNTuQ09K3HhWr0a/ Ypvc6YOV4AymTdsQgdArnElxXly7idJ+FksAzndjuvkHLyTVoEbEmBA/WRgrPlgEXJqJ 93i4zh1wFR5K8jhzzx9j2eQAqGPjfd0ASStBSeq3LACHxwgEj70F3mFwqZmu71x0QEfv C76pY2TExim8gWPsTugSsUnE6mOIL/5LVdAinGdNWY6tkk014VkVJFjIA0RdIe4RPTsg LOrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=86cesKNAIcr9ey2gBYqu5Gl5/JpWBsI3Iy9UT7r48uw=; b=DykFHIxiTRDf+BQ74D4by46t/uXfF13fHYNxSHZ6asJRPDXHNEL6Gf54UZ5+Zzy2Ze Mf9vljkTP9a0FSnVK/rpmZjPc7UJ7nz2a19UfOO7t8+YUnwODSzrpjlk6k9bLa6LSIfX ngDAacZ69PRY4WiyWFkE1ZKl2EWtuA7Vzbkq01nC07oPxsDCuCO46F5knhfdZcIalW4m DPZjeEi9vVEwLcmpa0RSOyKEdw4SNyuh1piKX80XzQWT1rj3lMdE2c7gVtidU8xcF+zn BOnca8g5A4Ze6u8ZxKu3OMMPD4PtJvxkeYh6G6LKNfgUEWpmK2e9fjsE//TsBxkKDMAs 8NyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g7si603514edj.525.2020.07.24.07.45.39; Fri, 24 Jul 2020 07:46:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726381AbgGXOpE (ORCPT + 99 others); Fri, 24 Jul 2020 10:45:04 -0400 Received: from mga06.intel.com ([134.134.136.31]:37044 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726170AbgGXOpD (ORCPT ); Fri, 24 Jul 2020 10:45:03 -0400 IronPort-SDR: 2eV/3JIdk4JRqiUVtPIylTC+qN6yb9u9NVc/MWImnbFSX9XyhCgdDQFY0Bp/ce/ByS7VElN27c KH/SuxGQ6YfQ== X-IronPort-AV: E=McAfee;i="6000,8403,9691"; a="212259178" X-IronPort-AV: E=Sophos;i="5.75,391,1589266800"; d="scan'208";a="212259178" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2020 07:45:03 -0700 IronPort-SDR: 6Ck2M2xBKPYBeWY4Di7+IhB7A6KYcAiZ8Lol/Kpwit0nDqg7wfTGRZ5/kpPaL8Ddn/6XnYHM2n grfjSpDl/8sQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,391,1589266800"; d="scan'208";a="289010294" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.21]) by orsmga006.jf.intel.com with ESMTP; 24 Jul 2020 07:45:03 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 3229A301BF9; Fri, 24 Jul 2020 07:45:03 -0700 (PDT) Date: Fri, 24 Jul 2020 07:45:03 -0700 From: Andi Kleen To: Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , linux-kernel@vger.kernel.org, Stephane Eranian Subject: Re: [PATCH] perf bench: Add benchmark of find_next_bit Message-ID: <20200724144503.GD1180481@tassilo.jf.intel.com> References: <20200724071959.3110510-1-irogers@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200724071959.3110510-1-irogers@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 24, 2020 at 12:19:59AM -0700, Ian Rogers wrote: > for_each_set_bit, or similar functions like for_each_cpu, may be hot > within the kernel. If many bits were set then one could imagine on > Intel a "bt" instruction with every bit may be faster than the function > call and word length find_next_bit logic. Add a benchmark to measure > this. > This benchmark on AMD rome and Intel skylakex shows "bt" is not a good > option except for very small bitmaps. Small bitmaps is a common case in the kernel (e.g. cpu bitmaps) But the current code isn't that great for small bitmaps. It always looks horrific when I look at PT traces or brstackinsn, especially since it was optimized purely for code size at some point. Probably would be better to have different implementations for different sizes. -Andi