Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2347440ybp; Thu, 10 Oct 2019 06:12:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxU3r6VynnohsWqpAFYEXuQ9GpJN6rWnBPhJRTfGMipxubz6lrylau9hWrQEerS1VeWjGuB X-Received: by 2002:aa7:d389:: with SMTP id x9mr8129052edq.33.1570713140462; Thu, 10 Oct 2019 06:12:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570713140; cv=none; d=google.com; s=arc-20160816; b=cIz6LVBv7MCZcoacQ5jIr8g/vNS8NLTENdyUnwT/XRjFc9KeW1QyrZDjOUYIGh5pSq dF9X1pnlCS9YJ/cLfC/KjJ56qtLSutzYlnXbbz7laCH8Sv2wbnFskDZGNTdK0m2bAzNi pPazUi3m9QOPuJW1phtHkXZquzQxBXD+OpC1y9EaPHUmRXc7WhDYBpIcRKPqCqAAWPm1 /xTXtYhClCoGalaPMPouTy5MHxGp9YhJPdZs1cM3VP7GyOLTIk8Iw+sVFH03AmC/ZXVV H6wqQ9amSZNXsrgiBedCGbIqZTZbiJTQhJ3mcxbrA3Nnqjxvw+FD1Y113ELZqXZeKZCj wXnA== 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:date:from:dkim-signature; bh=ynQpPtUZ+/Dwh99O0vNfivFGwbWMd+jPnCKl3gN7cx8=; b=Jl5wjZDusHR4CuEHAUoe4AAmV6ZDAzFyKckzKrdrOnamuj35Xn9gv/FOdAG73EmuUN 5gsbe7MWeHx0I4ppqZsMMiBeTlkfyLqC4SzC7JkrxiiF1xBNE/zJE9sR8w/S+VocQo2l nABsKEkK9RrSPe9E+l2eDDxVemk8Gsu6jCd+Emf3BWgCGBUa6G7sIbmYokAC6rXz9xWS 4EfltuHh7IKKVP217CzLVUxB35C1GljeQBQmv+n8ILdOjwfiMW05q20ZRyYXdEiJXd9s 5OpnVd2Iy9zKTSKXJFeDLpCU15CTNqzM95Fq5erhzKGbNvUJfXDUybkmjynoxtSeGpwT VM1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b697RvLp; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si3395993edi.442.2019.10.10.06.11.47; Thu, 10 Oct 2019 06:12:20 -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=@gmail.com header.s=20161025 header.b=b697RvLp; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388017AbfJJNLK (ORCPT + 99 others); Thu, 10 Oct 2019 09:11:10 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:43889 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387504AbfJJNLK (ORCPT ); Thu, 10 Oct 2019 09:11:10 -0400 Received: by mail-qt1-f195.google.com with SMTP id t20so3237873qtr.10 for ; Thu, 10 Oct 2019 06:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ynQpPtUZ+/Dwh99O0vNfivFGwbWMd+jPnCKl3gN7cx8=; b=b697RvLpgD66fNL0sRDJxb4EoUm6P7eGUeDYU07IKU6/c+tPsR6BEAPJSKBdy+XRmT xdi1+eWPKxje2ZvIE0l2pIXaIuj8pj+XzHo8TGBYyPMnVzV90VTyWmBHUu43tVfbXSYM Zs2nBHjFhwb6yXo7RkhVe9gOaLVMUuP4j8Y4IOkCGXDis3gxLmWXI48iHR5HlANJb2XL WX23yIrLaGjkUHMh2z+vJIeJF9S3FRkJ/Htqx1Gv9oxMEyGZYglT3+LYcmSh6oorazy8 w7vnwI4j/V1nQNE+xNY3Ix+un+t8NjsdSGZIcnUZ/7HYfrWjQuFd6TrwiaSsv9CerYZN 2UKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ynQpPtUZ+/Dwh99O0vNfivFGwbWMd+jPnCKl3gN7cx8=; b=V1qoRmMpT5pytjQS643bWdAN65ay05syQQBxkaW02M7g228sQz9s9gd4mtgmRswlJI 7g6MWFOmnD2oRyvQR+jz5mGW5XoXLFqqZ+p2rTqoUzjA6nxy0aBYiWDq/ipiY8ong4QJ 7+O/d78dAGdh8ukLpLQwyS1KJukF4ioj2BPrZ8Zn3VzLhgmKWfJ5ovyWKkIijtNbf77r 89J6oX3ZwDwfgxmtD0W6Gs72LJCFHAtFFc35A4dWBVx2qPXRfYG/D3W3d9lIhHuWd4td pWHz+gWXrKOeyqnJoDL5Rbr+k8AptJAdLQ2+voL+zMLMANVJMjFWxhAEh9aUBHJTkvdp 6jRw== X-Gm-Message-State: APjAAAU63Ybmt9PFVYn3pUiJ67eAhWwIzVGSLO0+XN6/W2hkEtKqHVMq 1WmyEkUkXZP80eAxSQMkHug= X-Received: by 2002:ac8:259a:: with SMTP id e26mr10210612qte.134.1570713069082; Thu, 10 Oct 2019 06:11:09 -0700 (PDT) Received: from quaco.ghostprotocols.net ([179.97.35.50]) by smtp.gmail.com with ESMTPSA id l23sm4094753qta.53.2019.10.10.06.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Oct 2019 06:11:07 -0700 (PDT) From: Arnaldo Carvalho de Melo X-Google-Original-From: Arnaldo Carvalho de Melo Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 69C164DD66; Thu, 10 Oct 2019 10:11:04 -0300 (-03) Date: Thu, 10 Oct 2019 10:11:04 -0300 To: Jiri Olsa Cc: Alexander Shishkin , Michael Petlan , Namhyung Kim , Peter Zijlstra , lkml , Ingo Molnar Subject: Re: [PATCH 07/36] libperf: Add perf_mmap__put() function Message-ID: <20191010131104.GA11638@kernel.org> References: <20191007125344.14268-1-jolsa@kernel.org> <20191007125344.14268-8-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191007125344.14268-8-jolsa@kernel.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Mon, Oct 07, 2019 at 02:53:15PM +0200, Jiri Olsa escreveu: > +++ b/tools/perf/lib/mmap.c > @@ -3,10 +3,12 @@ > #include > #include > > -void perf_mmap__init(struct perf_mmap *map, bool overwrite) > +void perf_mmap__init(struct perf_mmap *map, bool overwrite, > + libperf_unmap_cb_t unmap_cb) > { > map->fd = -1; > map->overwrite = overwrite; > + map->unmap_cb = unmap_cb; > refcount_set(&map->refcnt, 0); > } > > @@ -40,9 +42,19 @@ void perf_mmap__munmap(struct perf_mmap *map) > map->fd = -1; > refcount_set(&map->refcnt, 0); > } > + if (map && map->unmap_cb) > + map->unmap_cb(map); > } > > void perf_mmap__get(struct perf_mmap *map) > { > refcount_inc(&map->refcnt); > } > + > +void perf_mmap__put(struct perf_mmap *map) > +{ > + BUG_ON(map->base && refcount_read(&map->refcnt) == 0); Added missing linux/kernel.h to this file to pick up BUG_ON(). - Arnaldo