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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 CC8ABC4727D for ; Thu, 24 Sep 2020 04:29:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2C40B238A1 for ; Thu, 24 Sep 2020 04:29:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hKpwx2YF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C40B238A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4C2C46B005C; Thu, 24 Sep 2020 00:29:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4745A6B005D; Thu, 24 Sep 2020 00:29:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 33AC16B0062; Thu, 24 Sep 2020 00:29:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0105.hostedemail.com [216.40.44.105]) by kanga.kvack.org (Postfix) with ESMTP id 19E436B005C for ; Thu, 24 Sep 2020 00:29:31 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id C60AD8249980 for ; Thu, 24 Sep 2020 04:29:30 +0000 (UTC) X-FDA: 77296676100.30.drink78_34087c82715c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 9B1FA180B3C83 for ; Thu, 24 Sep 2020 04:29:30 +0000 (UTC) X-HE-Tag: drink78_34087c82715c X-Filterd-Recvd-Size: 4618 Received: from mail-il1-f194.google.com (mail-il1-f194.google.com [209.85.166.194]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Thu, 24 Sep 2020 04:29:30 +0000 (UTC) Received: by mail-il1-f194.google.com with SMTP id f82so1814028ilh.8 for ; Wed, 23 Sep 2020 21:29:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=qj92FMGcpgxsdyUE56yoRlee9YhbsU/CYNtrILGXrHI=; b=hKpwx2YFNPQQjIl9obkIR88i8flXLlEDKWxisryuqYs45VmEht4DryPajZHZDrfgJo Lr7xg4gz90OwQUlv600R7W23mD8oRCNtjAiWMyhJuhjJ0BhDv6JdimhYmHd5J5gyT2Dy pKmtNuGp8qb2Y9/v95kVPaazILhYm8WAxoATiV7dl+O3/Jakwtn0wFCDwC8J2utZPAUN ooVNZsT2cnge4jawn/OSnkpR9vYPAJd3OGcXEs/E2HpK16SmkxjkEwQDl3enHcN86C3F a35u2//yA5cHN3x4scuZ/EPVcltWqAZWPmquI4A2wTaFTGa3B84C5AqlKGVMN0B60Yus vHwQ== 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=qj92FMGcpgxsdyUE56yoRlee9YhbsU/CYNtrILGXrHI=; b=arGFR1BeHtM/Y/6eSP608wpbRYAcRcIBLB7CfstgBlJIgd3fygp/+2AQBmj2szYV/f zQ2BmEFsKh3bGyaEnqFbr9r4vlyp2Y0So/XsntCqpi0hQpFN2Gk1J/IftUCjtx/ICeY8 J+Pj7sGqzm4Y/P1cDtalmE7xSTUDqvTWGQIuvxZLuKL5TzRKFWjZypcNnHpJ1NbZvHcp PKLewlS7v6X6ufyu98MYGfUKzzr/MpPyiIz6tXyp3ZhipydiWygHGHfCdzn4XEpZWAx0 Yt7YtDvOw8kh5xWdRwP1qiK0r1YiU2nD+oW2QlG2MwJQCOmZS4pwBKZeEHUQa5F2RcUT KVaw== X-Gm-Message-State: AOAM533n3pYgJGhBaj1pj4P2EDhdC3bY4rNrOUQiaRyecKdUuosum6sj MTql8lRT8p9+bbe0qDGUxqCYCoyVnxQUV4bsKUM= X-Google-Smtp-Source: ABdhPJxPfqY8QUPf2j8F+mjd8vxgY0gvW57lNgORQ3ajNglXpQPqzal3Fo3UsraealyXmnxEAKajzM/jFfds1uWW1fc= X-Received: by 2002:a92:7989:: with SMTP id u131mr2492233ilc.93.1600921769596; Wed, 23 Sep 2020 21:29:29 -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: Yafang Shao Date: Thu, 24 Sep 2020 12:28:53 +0800 Message-ID: Subject: Re: [PATCH] mmap_lock: add tracepoints around lock acquisition To: Steven Rostedt Cc: Axel Rasmussen , 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 Thu, Sep 24, 2020 at 12: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. > Yes, please. The new helper would be useful. -- Thanks Yafang