From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 08/10] psi: pressure stall information for CPU, memory, and IO Date: Wed, 18 Jul 2018 14:22:07 +0200 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 Return-path: 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 Content-Disposition: inline In-Reply-To: <20180718120318.GC2476@hirez.programming.kicks-ass.net> Sender: linux-kernel-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 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]++;