Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1242180ima; Wed, 24 Oct 2018 17:32:19 -0700 (PDT) X-Google-Smtp-Source: AJdET5fgzAz/qNqBwEqTI7DNH11bRrvlK3RtEFaLuvPNsKKWvkrXdnDwYAUZadM6F0MsTiT5nj+l X-Received: by 2002:a17:902:8c84:: with SMTP id t4-v6mr4536748plo.188.1540427539068; Wed, 24 Oct 2018 17:32:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540427539; cv=none; d=google.com; s=arc-20160816; b=o/+dw93oCm/B67a5U2/3QuHfQl9UliM8lqzojyttgZMsjT8x7rjk+2b/BrZAgFR/LP pihN80uNlf6wbKr/Oe1ejFeOqiK5Wf2rlhVMMXUk+TRyZmsoc6xzLVyqJyG7gKflUCWq vO4fBIis6Ef9EHrHyK35rmj524n7l5wZVuJOiGFnw7POTJwPH3tDw+vVI5v29vshmKRR qtJKMuJHGih66eSJ9xsz5mUaVZ5qlEHd9BT5G7lVjGaNSRjRXsiz02tvMmcpmZYsjxt9 EQSwELHKfgxArcOAh22homTweppkJ+tfEh7B0rC9FUO5sHSGn3Ja04iCnovPNIusyLAT CJuA== 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=CgC4g0mll3ZZWqx4PkJGZeMlKrBWbcp3tZ2wKgX2aUo=; b=oezoy20wSVA9I2hNihHMSf03esxE18ixrR8fj3EIPieyan2OeL4kLSkqIRaS5Jj4RD HFfjVCVxBYW5Z62WjV1/SFrPKaGGyHdKhOzrEJY+iunTi+T+cDKqWvl/fXlNRJc3Bc70 ZuGNGernjaEBMIM961esIEJGX1Raj8n6tG+3MMeyH/MY98ukYZyWMzcEoAWbUFaecdxL +ehlIHB2bHLHwT9FAnJ7mTAQbLZ4c+Ey7S+sT4BMRfAtqx4BYi2YyLRYh12Qavso90+z dhM9AHjE0JKAOcf424HIscViT+hORuyxsAkr+xLSFzFeBZaixTaJB+KUS+0Ldy7O7o3r tVBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="FErjD/W7"; 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 u128-v6si3818616pfb.181.2018.10.24.17.32.02; Wed, 24 Oct 2018 17:32:19 -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="FErjD/W7"; 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 S1726443AbeJYJB7 (ORCPT + 99 others); Thu, 25 Oct 2018 05:01:59 -0400 Received: from merlin.infradead.org ([205.233.59.134]:42890 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726117AbeJYJB7 (ORCPT ); Thu, 25 Oct 2018 05:01:59 -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=CgC4g0mll3ZZWqx4PkJGZeMlKrBWbcp3tZ2wKgX2aUo=; b=FErjD/W7EKmLANk8bT0AXqQ+9 N/uKe1/Ar/eRnaJopl3bSIim2cjjpHkiSiVWZ+gLX3LyxnGWAKSq9IxJee06CfapnuoNclAeBngkn fnw+opUE+jYK/C/gHD4SIADzFji43Ozv+6FEEycAyW3NlxjtXKXK0kzY1GBFZ2FyKR2ouGbMOGAr0 Tlef1J0AC+6Yf4XUDeU0Yp7hV7zzCGWqK8cJW48msC4Q9Vd1q/ib00Fid+2mZ6PveCpJuxqnGu54G Sgez83uTTZb5xP6SZVNRhb+jYzxVYZUFSq50JrbhynlUT4eONvG03m/ZfxVrVWw+gNIktzoLITd96 MQz9HwqEw==; Received: from [167.98.65.38] (helo=worktop) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFTYj-0002Up-Dm; Thu, 25 Oct 2018 00:31:33 +0000 Received: by worktop (Postfix, from userid 1000) id C92CD6E0794; Thu, 25 Oct 2018 02:31:30 +0200 (CEST) Date: Thu, 25 Oct 2018 02:31:30 +0200 From: Peter Zijlstra To: Andi Kleen Cc: "Liang, Kan" , Arnaldo Carvalho de Melo , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, bp@alien8.de, Stephane Eranian Subject: Re: [PATCH 1/2] perf: Add munmap callback Message-ID: <20181025003130.GU3109@worktop.c.hoisthospitality.com> References: <20181024151116.30935-1-kan.liang@linux.intel.com> <20181024162334.GG6218@tassilo.jf.intel.com> <20181024163208.GC15106@kernel.org> <18d5fcf4-84b2-806c-eb2c-787b96e0fb90@linux.intel.com> <20181024182854.GH6218@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181024182854.GH6218@tassilo.jf.intel.com> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 24, 2018 at 11:28:54AM -0700, Andi Kleen wrote: > > > void perf_event_mmap(struct vm_area_struct *vma) > > > { > > > struct perf_mmap_event mmap_event; > > > > > > if (!atomic_read(&nr_mmap_events)) > > > return; > > > > > > } > > > > > > > Thanks. I'll add the nr_mmap_events check in V2. > > No, that's the wrong check here. The PEBS flush is independent of mmap > events being requested. > > If anything would need to check for any PEBS events active, which > would need a new counter. I think the easiest is to just check if > this_cpu_ptr(&sched_cb_list) > is empty, which should be good enough. It is just the CLI+STI, not PUSHF;CLI+POPF that are required and that is a lot cheaper already. Also, you need to have preemption disabled in order to check the per-cpu cb list. So I don't think it really makes much sense to try and frob a fast path in there.