Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp982882ima; Wed, 24 Oct 2018 12:16:26 -0700 (PDT) X-Google-Smtp-Source: AJdET5c1/qhyRIbNG+iN+SzlLapfMhr5A4IY+BudWmXJWrn3qbFDoQzEwWnPfJITdibj8gJI7a+b X-Received: by 2002:a62:cf04:: with SMTP id b4-v6mr3822584pfg.224.1540408586855; Wed, 24 Oct 2018 12:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540408586; cv=none; d=google.com; s=arc-20160816; b=nFBFmr3Qt2RweGLSFF9fXjCINMWASPJ9lMe5hDnAZwqAJ8c/ADmwhJaVWQWUby94jK 2LzcB6FNjz7ipByacMgpVTjErq5JIRgCJizi+oMBp/3syz45SgJOzDmBQ9ILhTdtkne6 Cix0Ex1Y7FfcIHQewflDBBahDSamwHFgUwCzSfp1oCpIF2reNsLQ7hSBmd8TfjdMHDfU 1HYal8q7XQ+5YbIHTqlY2xu0MFq1kbIKC4WOMqeBGEaYQq9X5Al0GR0HZp6PG3RoAZNO I8Z363S0SvgPOWU/xV0+qqWJE0I/uATsLFslhe7mUyofJGtngqJEf90CPlmLaf/uyUFX 8HNg== 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=9JixF628nSoAs4hQcPi652c0hR4YcH+YbTCvRNne4is=; b=JdUcxoygX76uau4x4IutnbcU91i46jzp/trQsO+bqxXA96o5OsNWIxJEt47UBTbb7+ q34F639tBHnBKJxw0El+nvIM0NXv8TlGUhqXdegvBPqovK7SDPaRQcSMF4xTJ8LB4mMf t/kfb8V+C4UYrfBO5UslnKG57akrJ9pmzWOyXMws4D/29+ZFmxj8t1dx1VnvpyOE1N0O qGYOpFhCeIDtS2yn0+VVXwA/XTimwBKShZux2KC4SyRiP2gp1awC1q7anak0VS0zkdcG eeYSvuj+6nkgI+qP947Xofe1TPfT9VYXm1umSNVzQ/JWHLQqJHb1tmOnb7WMjAYKE2si L6eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VnoP2zDz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2-v6si5675860plk.350.2018.10.24.12.16.10; Wed, 24 Oct 2018 12:16:26 -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=pass header.i=@kernel.org header.s=default header.b=VnoP2zDz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbeJYDov (ORCPT + 99 others); Wed, 24 Oct 2018 23:44:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:50790 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726497AbeJYDov (ORCPT ); Wed, 24 Oct 2018 23:44:51 -0400 Received: from jouet.infradead.org (unknown [190.15.121.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DEEE42082F; Wed, 24 Oct 2018 19:15:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540408534; bh=64L2UZV1uJuYnUXy+xo1F4+Lz6VvJ1+/1wfI4wxy/0I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VnoP2zDzLpV2itganNf2nX0pUfEohcwHn6xXvcWLdc6KrEV3IB6l/ArPd8z1YT4ZF 6gJerJZ/0FGqt3mxsQcwNjPEy4bahKaBkw3gWc4KfcjGsSm9iN3gRiiQjXPSWCFh7G +anhFVtylmKM4S52IjiciDYnf+l78yMjypjRn8ms= Received: by jouet.infradead.org (Postfix, from userid 1000) id 56A27142C5F; Wed, 24 Oct 2018 16:15:29 -0300 (-03) Date: Wed, 24 Oct 2018 16:15:29 -0300 From: Arnaldo Carvalho de Melo To: "Liang, Kan" Cc: Andi Kleen , Peter Zijlstra , 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: <20181024191529.GF15106@kernel.org> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18d5fcf4-84b2-806c-eb2c-787b96e0fb90@linux.intel.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, Oct 24, 2018 at 02:12:54PM -0400, Liang, Kan escreveu: > > > On 10/24/2018 12:32 PM, Arnaldo Carvalho de Melo wrote: > > Em Wed, Oct 24, 2018 at 09:23:34AM -0700, Andi Kleen escreveu: > > > > +void perf_event_munmap(void) > > > > +{ > > > > + struct perf_cpu_context *cpuctx; > > > > + unsigned long flags; > > > > + struct pmu *pmu; > > > > + > > > > + local_irq_save(flags); > > > > + list_for_each_entry(cpuctx, this_cpu_ptr(&sched_cb_list), sched_cb_entry) { > > > > > > Would be good have a fast path here that checks for the list being empty > > > without disabling the interrupts. munmap can be somewhat hot. I think > > > it's ok to make it slower with perf running, but we shouldn't impact > > > it without perf. > > > > Right, look at how its counterpart, perf_event_mmap() works: > > > > 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. That would be a nr_munmap_events, if this is tied to PERF_RECORD_MUNMAP (right?), which it isn't right now, check Andi's response, mine was more of a "hey, perf_event_mmap does an atomic check, before grabbing any locks". - Arnaldo