Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp463048imm; Wed, 18 Jul 2018 05:23:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeTUbs6tZBaz94t5YQOkKDQup7edJn41r01CaWgyp4+EpDzJL/s4gIPTpSLdTFvCwo8iThe X-Received: by 2002:a62:b612:: with SMTP id j18-v6mr5002689pff.199.1531916591672; Wed, 18 Jul 2018 05:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531916591; cv=none; d=google.com; s=arc-20160816; b=T1PK/MB/8W0iopn6Ty4chWinp3DVgh411VIdN2EFYeDVshFdz+OLVymFarwZtcgr6T dimjbZcCgX76l8F+nWu8+soDZPO/usNHO8FLDYkOsDjARemBB2mOtwlx9YFbyd87GyRb mysVUwE20kkfVb/9Z5LdU1W7yuULy9SWbdUIccGDmfL+5wtScBlPLfB54ubLFyodyXiL WKwjP5iRh343iKlVReP4bHm2V+SNuR5u3pFZfCi8w+RD2bv49TDmjZ+QQAm6keZD2UHP O3+AuyV56DSsNdBxYXh+AiiZYd6zgN+qPZk2Rch+JaW+jlKx/gKd+yu/4a2v7Xq94rgK EOZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=oIlfSxllIsnZgpPEiTP2UCq6MGTBd8nSx1RVDxGe7I0=; b=aTMRDMomR0jsenaE/uFxcO+OX13HZs2/0EwhdArFXkomSnl9F2DiSUnHNCLEgiv1Ga LatvHeXBP6xv9xUmlv36CHvie9vaN59GvTIxJsM03QzvH1x3vBVmD9Ft3R94A2SsLhdW tmjZl4AIjm1DPQhHfca7vXviKfoA23N5jx/oB7qwTRMnSt8fSZRYb/Tz2yUy3cRp8DrZ CNloI4svGdMPr59Y1ZCHwQ8unmWmHs3ohJ7MX5O+qwzm3EBXvBxkw+SeIdO8NcueOU49 0acenkJwc8m3Rjk7rL/REKPVpqkO5RR2T68TfxT5S/LNLeQkr/BPk/DorjHMSnxy5q3N RWCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=VNlmEhn3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17-v6si3084702pge.99.2018.07.18.05.22.56; Wed, 18 Jul 2018 05:23:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=VNlmEhn3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730567AbeGRNAB (ORCPT + 99 others); Wed, 18 Jul 2018 09:00:01 -0400 Received: from merlin.infradead.org ([205.233.59.134]:40482 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbeGRNAA (ORCPT ); Wed, 18 Jul 2018 09:00:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oIlfSxllIsnZgpPEiTP2UCq6MGTBd8nSx1RVDxGe7I0=; b=VNlmEhn3rX0MXygcQOY292LE3 G0/fljkNKrZfyiuTniA9lqRLm0+D+g75T7VB583UBMeZOEOdtfGhxbnQfFtbkXvINcq7nvRDoQEYW yi9jpa6SVBPa70dR/v18sOr0wKpvQM7yGODTN6Yvbge7G4aCrLiiWh8ujVSzA7Xl/9Wtn1vKVzig2 hUPe5cc1LbAgfc67z8LdsbY17gfowHwO4pA+M64KaypSyDzt3fRjeUv8VJn/UEcJvUrP9W98wofMG zToMwXNpDNDPMtqCM/m+tHPFSYTdEeOA0pfVP6F9yQBBPNQD420zNTsXWWuOQzJHomU/9EgB4nEoW uEExyTdOg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fflT7-0004X1-D6; Wed, 18 Jul 2018 12:22:09 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BDDED20275F37; Wed, 18 Jul 2018 14:22:07 +0200 (CEST) Date: Wed, 18 Jul 2018 14:22:07 +0200 From: Peter Zijlstra To: Johannes Weiner Cc: Ingo Molnar , Andrew Morton , Linus Torvalds , Tejun Heo , Suren Baghdasaryan , Vinayak Menon , Christopher Lameter , Mike Galbraith , Shakeel Butt , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 08/10] psi: pressure stall information for CPU, memory, and IO Message-ID: <20180718122207.GX2512@hirez.programming.kicks-ass.net> References: <20180712172942.10094-1-hannes@cmpxchg.org> <20180712172942.10094-9-hannes@cmpxchg.org> <20180718120318.GC2476@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180718120318.GC2476@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18, 2018 at 02:03:18PM +0200, Peter Zijlstra wrote: > On Thu, Jul 12, 2018 at 01:29:40PM -0400, Johannes Weiner wrote: > > + for (to = 0; (bo = ffs(set)); to += bo, set >>= bo) > > + tasks[to + (bo - 1)]++; > > You want to benchmark this, but since it's only 3 consecutive bits, it > might actually be faster to not use ffs() and simply test all 3 bits: > > for (to = set, bo = 0; to; to &= ~(1 << bo), bo++) if (to & (1 << bo)) > tasks[bo]++;