From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4CDFC2D0A8 for ; Wed, 23 Sep 2020 16:15:43 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 525DF206A1 for ; Wed, 23 Sep 2020 16:15:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 525DF206A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C6CBC6B0062; Wed, 23 Sep 2020 12:15:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C1C918E0001; Wed, 23 Sep 2020 12:15:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B32386B0071; Wed, 23 Sep 2020 12:15:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 988676B0062 for ; Wed, 23 Sep 2020 12:15:42 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5759F185EEFE1 for ; Wed, 23 Sep 2020 16:15:42 +0000 (UTC) X-FDA: 77294826924.08.jeans09_501677e27157 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 24F72186BB2BB for ; Wed, 23 Sep 2020 16:09:29 +0000 (UTC) X-HE-Tag: jeans09_501677e27157 X-Filterd-Recvd-Size: 2898 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Wed, 23 Sep 2020 16:09:28 +0000 (UTC) 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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