Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp532171pxk; Wed, 23 Sep 2020 09:13:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdmRRidLYPC9PcgsYHfXoHa9e81vFd7SnDhTlspV9kmJGC7Z7ikp3FuRVZ28ZWD2OInvPN X-Received: by 2002:a17:906:2b06:: with SMTP id a6mr377389ejg.209.1600877604802; Wed, 23 Sep 2020 09:13:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600877604; cv=none; d=google.com; s=arc-20160816; b=UTXdl1WqT1HvlDfQ3TrBAYD5g5Abb0zuNeES/BbMd/bXRXQadWcNwO89TteZlNkZHu dqFKKP+12TqiZimrQlBTXv9QX6biyfXLa4uYZZEf4tQiQPr7HS/MiFBy1sWpHjY5XHMf YSNhhAffIl/4nuI5ugPLpAMSNzH+r9DCvuHOGlQwVAlDwbg22S1DQpG6SOoZaOo6uU/u 8k9CegybeHI5taC7QopmhuINCZ7Jxkpwx6Kdp6GpvAgldMrdcRLnK1jZrlL094pP0hOU xdSjyT92ZjnNuWjjH0YXuk1RRUAA9GwPBE1XVCPkVd2eNCowjo+XouSnPck22h8cgPf9 SzwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=2iyu8eg/OpwfWsJyJb1bz3GHscdbfwKTAU6//hHMtEg=; b=RL8Qxuv2LauDNwKaUyOAtJsXRZNOWv/8+x+zZmFYBtPBtXrtHvftmNgchp6z7oNken wnT83hjIfqaokCLoRE0IH1JDUdtJR8yd2f2DNMbyGQP8rjPLbhYLZnclDB+KMMjpRs0S ozO9LJtj16yVPfxRkggnEWFX1dYrJxUOt7dH+6wLwolTZvFwJlgalw8OVjdfXGfHeT+T 5jnpN8a0awO/HWPI3z/PFrJtTAMY/qzbYcHi2054j311Sw0F2tFBzS3AK3Ohf/PYfSc2 8UQIpYkjXYL6ztdn1HCbQRVKcmCJx0wzunQ26HZPaQctkak6YGPjql9HpM2vpscbAQ8n ZjHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u15si194968edo.55.2020.09.23.09.13.00; Wed, 23 Sep 2020 09:13:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726755AbgIWQJ2 (ORCPT + 99 others); Wed, 23 Sep 2020 12:09:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:39774 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726537AbgIWQJ2 (ORCPT ); Wed, 23 Sep 2020 12:09:28 -0400 Received: from oasis.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (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 92194206B5; Wed, 23 Sep 2020 16:09:26 +0000 (UTC) Date: Wed, 23 Sep 2020 12:09:24 -0400 From: Steven Rostedt To: Yafang Shao Cc: Axel Rasmussen , Ingo Molnar , Andrew Morton , Vlastimil Babka , Michel Lespinasse , Daniel Jordan , Davidlohr Bueso , LKML , Linux MM Subject: Re: [PATCH] mmap_lock: add tracepoints around lock acquisition Message-ID: <20200923120924.49638d90@oasis.local.home> In-Reply-To: References: <20200917181347.1359365-1-axelrasmussen@google.com> <20200922125113.12ef1e03@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Sep 2020 18:04:17 +0800 Yafang Shao wrote: > > What you can do, and what we have done is the following: > > > > (see include/linux/page_ref.h) > > > > > > #ifdef CONFIG_TRACING > > extern struct tracepoint __tracepoint_mmap_lock_start_locking; > > extern struct tracepoint __tracepoint_mmap_lock_acquire_returned; > > > > #define mmap_lock_tracepoint_active(t) static_key_false(&(__tracepoint_mmap_lock_##t).key) > > > > #else > > #define mmap_lock_tracepoint_active(t) false > > #endif > > > > static inline void mmap_write_lock(struct mm_struct *mm) > > { > > if (mmap_lock_tracepoint_active(start_locking)) > > mmap_lock_start_trace_wrapper(); > > down_write(&mm->mmap_lock); > > if (mmap_lock_tracepoint_active(acquire_returned)) > > mmap_lock_acquire_trace_wrapper(); > > } > > > > > > -- Steve > > > Great! > > Thanks Steve. If the above becomes useful, I may just add helper functions into a header file that you can include. Perhaps call it: tracepoint_active() and you need to pass in as an argument the name of the tracepoint. -- Steve