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=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL 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 E63C2C4727E for ; Wed, 23 Sep 2020 16:41:02 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5971720791 for ; Wed, 23 Sep 2020 16:41:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GCCpqjt+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5971720791 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C79006B006E; Wed, 23 Sep 2020 12:41:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B668E6B0071; Wed, 23 Sep 2020 12:41:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 969FD6B0072; Wed, 23 Sep 2020 12:41:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id 743B96B006E for ; Wed, 23 Sep 2020 12:41:01 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 28360186287C4 for ; Wed, 23 Sep 2020 16:41:01 +0000 (UTC) X-FDA: 77294890722.14.lake49_060c21c27157 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id F252D1822989D for ; Wed, 23 Sep 2020 16:41:00 +0000 (UTC) X-HE-Tag: lake49_060c21c27157 X-Filterd-Recvd-Size: 4848 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Wed, 23 Sep 2020 16:41:00 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id 34so18413pgo.13 for ; Wed, 23 Sep 2020 09:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u26ETgHdMj6kI9HjFylSBAFJfoyLr2qc9o6DaGmIgsM=; b=GCCpqjt+xCbzlLZm3di8051exilcDeoMNjhg6RzrzuYxfdNlVC4DPmq2osvs2nhbLg AVRWcnVKfcl3Eye/39tHmojENyd1FmiUCjKmndh9bpgXv3htMg7P8L7aA9sA7CC65tRo IN7Np/U5aImgIeLco+W+JBJluAsjacIk3aitKdLycM3M7MmutRZQniczFhRcbOeTpzTJ Ew6PPkr5IDicU5nhpFFZt0BPsn+OkCPo4NU4foVMPTCCWV3rRr87fg+ctwjw1s3w18z2 ki5Oflv/oO/zrwiHCZgDVCukeIXRMYee45HZJhZstbJScUiboCOOXKJfayY6Gdv1ZgKm lkrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u26ETgHdMj6kI9HjFylSBAFJfoyLr2qc9o6DaGmIgsM=; b=LZF2fX1xW4oAxJ8Hfa2R/5IwLTfzA3q8x6a2vbOAXF2W5EFbEhDv6BhPBdU1xPjqGZ ntl+v+21WXL12/MmsQ/JiHbtdILkYsZU7bxh+714BbVlBpiDV36sapNZEeuFJewV3QfV u0M5hGCPrm5oOUJ8/tS/vc7aZEVOxxGiIwVRQC8PKlnPt+v7LCDo3duYyPvTYs5r3HKQ 68iDYx1mkWGt5AbXaExEMEJSjOyhvPO2InK20r3ZtEvNcvOxLZF2WRgEqRjpOzIatcCQ 6L+Dhay7X45pNFztNICvEB03GKvuwfZs9QsN5i1ynQZhzY5Rw+U18SMXyA4753E/X19b rtig== X-Gm-Message-State: AOAM532UB7SZ9w3VNUd6EmunmhHrXLiPepmJLdgxgdM56zdppGkYUh4O yZ8LjYdyGDLepbAzX34A2W36hWyEpYTqg2URKeRihQ== X-Google-Smtp-Source: ABdhPJyifYPt6VI6ck9zLGf+I19aMcVsmGBwJEnK5WAIIs8oiQmwI9vuLma09GDug/1Ia9XnhvlJ7Jtw2DDqRwyUAX8= X-Received: by 2002:a62:2985:0:b029:142:2501:34d6 with SMTP id p127-20020a6229850000b0290142250134d6mr581517pfp.47.1600879259125; Wed, 23 Sep 2020 09:40:59 -0700 (PDT) MIME-Version: 1.0 References: <20200917181347.1359365-1-axelrasmussen@google.com> <20200922125113.12ef1e03@gandalf.local.home> <20200923120924.49638d90@oasis.local.home> In-Reply-To: <20200923120924.49638d90@oasis.local.home> From: Axel Rasmussen Date: Wed, 23 Sep 2020 09:40:23 -0700 Message-ID: Subject: Re: [PATCH] mmap_lock: add tracepoints around lock acquisition To: Steven Rostedt Cc: Yafang Shao , Ingo Molnar , Andrew Morton , Vlastimil Babka , Michel Lespinasse , Daniel Jordan , Davidlohr Bueso , LKML , Linux MM Content-Type: text/plain; charset="UTF-8" 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, Sep 23, 2020 at 9:09 AM Steven Rostedt wrote: > > 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. Thanks for this suggestion Steven, it's working quite well. I also have a very short patch to the tracing which allows plumbing the string values through to "just work". I plan to send out a v2 before the end of the week. > > -- Steve