Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp5083img; Tue, 19 Mar 2019 14:02:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzHifC0S1oos2mjxvDclfl057bhy0D6NppOsLBISqep+pRXEh18ymmnSLS0O6qnoTBHQA8c X-Received: by 2002:a63:d453:: with SMTP id i19mr3704722pgj.237.1553029321437; Tue, 19 Mar 2019 14:02:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553029321; cv=none; d=google.com; s=arc-20160816; b=VHoJIbRVY/uvY88lbrDz6AErfBbE0t9OpisVIJCRrEsrQLeAisUfD15OnXaxlO1ZVN rnyzrWn2+VvlFLAqQCkW0inCPQlOdcaOt/lBvUpK+Y4MVmCiD/qYoVWwD1mdvm+3x1Xg 7DY3yXjoF2oGZNYLnKzaBc0XyNAmuI/KnZb8I9P3srVwZzbRAr7bA72xb18ahmgpJ8NX k0QcmxFGBtuUkfMV3JXZ9V45XdeVnn9V8CkfZc5FPOulLQ6UHW/R301xsbOoozxI+qyh QjlbgojHF72vYsvRvjTjy/SaV9yAQY9fyfRKGnH45Cr1EGT5R0fCuWKLXAtUYapeY7Yk yDMg== 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; bh=SsHLgtv2tYTObwwyC6qG+Qh49rThPaG6hGq1pZpjEfI=; b=jG2Ftl8iyprzfsWJcYcvdIP9ZxkbUNbr7XNfHsKe7PYZacgkkdfIZ8Yjg26FU3w9mi wQHgWGWiShMkpctBm9877Kz7YdIP1mhAmKm1KVsghhMulMd5BYu6KxFeDMqYWSWOEx89 nCHykIX2bg5rPWX+a3CO1lZyPgnmtws6yg19AMA3gr7wssvZZXt9yO4ybbQaxjFd5xgu PEvuekMAvm63/PVGpuwJtSTspnscRNKkudCWBlgDqEQLp7v0sL1zZecjmK4uRJponA3Q wsRoB0rhvn69LmkRVK0R/gL++iJSpdEGOsgLQBiL/QKIDIOCpobwh+5ihU0OLkNsHGWD bySA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=h9lhySCS; 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 z28si802288pfl.22.2019.03.19.14.01.30; Tue, 19 Mar 2019 14:02:01 -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=bombadil.20170209 header.b=h9lhySCS; 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 S1727227AbfCSVAZ (ORCPT + 99 others); Tue, 19 Mar 2019 17:00:25 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:50280 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726627AbfCSVAZ (ORCPT ); Tue, 19 Mar 2019 17:00:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=SsHLgtv2tYTObwwyC6qG+Qh49rThPaG6hGq1pZpjEfI=; b=h9lhySCSbvJtjaKQ17GSxzZXh JMbsgqsBoYOOQMnStPqPpuqpDwMpi5y+NBg4Cmg4vlnC5UZpezvbjKNq2VezKXeexQZCMZ5JDwM/u p4P1HWIUSWpWZtzIKHctOR6427ggauv6mOY+z7X0tZTwEI3J6EuX1pn0S/+akCbRlXV3Tvyi2pYNn 4XK7g1Vl+aNt2XYX3gQmGDiQhNPC7pbdXbbQtF6KfzDGHmiTY8F8RV6+PLFZYjHo65i8khdtVS77L HR6hhJYKG+w/btEa05YENuxLe5ygX5k3ep/411lANSFwPMuJr0yABVIFBUTQoz7CU4VW5Z65BrtwC 3wYV7zN1Q==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1h6LqO-0008St-KG; Tue, 19 Mar 2019 21:00:20 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A91CD23CB6531; Tue, 19 Mar 2019 22:00:18 +0100 (CET) Date: Tue, 19 Mar 2019 22:00:18 +0100 From: Peter Zijlstra To: Stephane Eranian Cc: Ingo Molnar , Jiri Olsa , LKML , tonyj@suse.com, nelson.dsouza@intel.com Subject: Re: [RFC][PATCH 4/8] perf/x86: Remove PERF_X86_EVENT_COMMITTED Message-ID: <20190319210018.GP5996@hirez.programming.kicks-ass.net> References: <20190314130113.919278615@infradead.org> <20190314130705.750219024@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 19, 2019 at 01:48:18PM -0700, Stephane Eranian wrote: > On Thu, Mar 14, 2019 at 6:11 AM Peter Zijlstra wrote: > > > For x86_pmu_commit_txn(), cpuc->n_events is updated, but we can > > trivially compute the desired value with cpuc->n_txn -- the number of > > events added in this transaction. > > > I suggest you put this explanation in the code so that it is easier to > understand. Right, I actually attempted writing that comment a few times but every time it became a mess. I'll try again, because you're quite right, this is a bit magical. > > - for (i = 0; i < n; i++) { > > + i = cpuc->n_events; > > + if (cpuc->txn_flags & PERF_PMU_TXN_ADD) > > + i -= cpuc->n_txn; > > + > > + for (; i < n; i++) {