Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp551816pxk; Wed, 23 Sep 2020 09:42:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDlLflzd7qnn8pn4ut24iK+ztoqI+i8Y+m/2qUdKRzF0jYZRE3veyRlapkA8Qofvi/d+eh X-Received: by 2002:a17:906:a156:: with SMTP id bu22mr523071ejb.177.1600879342312; Wed, 23 Sep 2020 09:42:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600879342; cv=none; d=google.com; s=arc-20160816; b=e79Mihv1Ye6aVUUh2V3IMURktr9Pa8EXR8VfIVOpzYEeXNno7JqpI8t/j5kb3NHyx7 PSJQAcFmzOGXqWEmsFNbvBk5O0l//0WYd0rPt2zJ3lp1XMhoo4mD3WvbNV5AMf9qOSR5 K62GrOAFWhG9Iw2Jqqxu/d0RNmmmlgh/AZuDO7YVU60Ug3faxW5PjXsmmacHLLxDBgtL 8On5hRFZXRHICHvxRih/pec41gb9ytW1FoOZdOcwBuHyM/tl3KWdDXCXofH0siKTPRaT /7dKhtdmw4ASnHkwrJZDO4CVBXur7TtWaxuSvBpPmRWeodHQe1aC65e4WDSkMHABxd5T 2bRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=u26ETgHdMj6kI9HjFylSBAFJfoyLr2qc9o6DaGmIgsM=; b=aD13FUxSfSPZKTCrDGbV5Vnxd/5am3hDIjTy2/LNiL1C+tOZ/f4glSadPDfiRcGu8i IICdEnktYg+CeU6w6EEh3z4MOBl1ncagHMH3JkVv8Kjwvf+3ZQll2N3FM3XMDpcTjWY3 CrlYGPMlbkEsVih5ASlZelbypi2HA/Xt8e39pQhbChI7NC4saH33wtbf6xtKyGP/ZpGw op3GlnlPjoZ9MymQh7XkHKDkGlrXcSVlOvvLNRHi3HUsHPCY53oOrVWPOl8ySJokFjyP xkSw8drc5eGKD4k+n+9pi1K7GWWEjXPyvlSevjkkrryq9laqr+WLy5+ooS0CAwE1sks/ /ccQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=GCCpqjt+; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n12si282536ejr.182.2020.09.23.09.41.58; Wed, 23 Sep 2020 09:42:22 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=GCCpqjt+; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726466AbgIWQlA (ORCPT + 99 others); Wed, 23 Sep 2020 12:41:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgIWQlA (ORCPT ); Wed, 23 Sep 2020 12:41:00 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04AE2C0613CE for ; Wed, 23 Sep 2020 09:40:59 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id b124so15345487pfg.13 for ; Wed, 23 Sep 2020 09:40:59 -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=ln82oYi5/SzrcuCdG9yKIF08TH8REBs7ZdyAJ3UxyoOMktDww14F5eiSTbOxY6no0t JnAtU8GDLoiZyyBGrU5ez3JRoZIg4ejgcgqfqIY92N/JYi7HG6JBATv8d/rENgU1Y0Wa 1PBbmysrAjCdTYwadCJYjbiMwf/s4ZhYZZREEMiRbIFXyQ2vqd8vgfjAxQn/yu5bfLGp dCELhNddewdZ09qCbQyEFdqV66afD0NAaaWIQMRU+J8jTM0Y4mVyhdX2tItLvQkpm93Z RMJHSWIVDOU1M8tpFHgNgXQkHcEXv6NjEH03FB1v0EAPdxNBbnEEAlFR3Po5T5RoErl5 9XrQ== X-Gm-Message-State: AOAM530H3+AVjD7lIX0ek3WSaVDE9s/N2JwnHjKU5fzQud7rfZHzdDsd fCW5n+AxeAk7qFdElcg+xGPMJVKCSJVkP/NxopdizQ== 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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