Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp34724pxk; Wed, 23 Sep 2020 21:30:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzhTORjAw6dnDwaG/ChwZYo+uJZOZz+Gd6LCV8WqK+5f6wV4evUkjzzJYn5xnG+ZYQ40CC X-Received: by 2002:a17:906:1787:: with SMTP id t7mr2837150eje.173.1600921858175; Wed, 23 Sep 2020 21:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600921858; cv=none; d=google.com; s=arc-20160816; b=Cg1nsoCcN/RpFZgtzg0phOc+HjZ/Trzg59Dh2DzCBSiP4lF21s0Mq2OVFw5fRQjlB2 63gd4hRQGPxvbVyU/EppVtHxgiRN1NHx11zxrO9qI6DwNj6IRDOTB1zgIGiu44L7oZ5G rzKwPVpvZ+KLkb7RGfaPJJDMaQxs9JrgJQ+yqqxstXhRvm96Kp8JvXzBdu7+yOTFjnbd toEf6RJuZlDB7Bp47d/z2dcmcp2jtctW+FI2aTFvFmFaUvL5ywJVFB2dMjBDkP0i5StE gkK3FE/ve0ov5NTlQkuemBaIzbZiIwyR9QX3B9g+PWr2xStnG4W3IKjFSbhFUFqbC12D jhiw== 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=qj92FMGcpgxsdyUE56yoRlee9YhbsU/CYNtrILGXrHI=; b=DRApVOMHHey2M0c0pW7XNMV8d9O01s5GC2qcomziNJjtQqmZATYd5rZ69EKgyROzsp EGHhO3AtYOwLRx7HsFPgkK6GicPMnfRn2VHvkl9fDcPzw3zCyaiVP+lyOC86RfKrXnLL r3c+X+fm0QkHspBLMLImJx21P6Iel/Tm94idvDabHnG+8ilp3UhcdhT/moN1v4sT9HoC GAm9ue2CY35ruUKIzmoq9SgFjl10pXW863cnJ8KRJsIcw9G6fnFJzCv+TWDWHnWHOsov +o3M7INYO2glp+tBEwQXyYGk0wi6pE5CiGepMWQQ2+2w7hW9LZYPi8YhlqDg3nHB7jat Yumg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hKpwx2YF; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn20si1406380ejc.196.2020.09.23.21.30.34; Wed, 23 Sep 2020 21:30:58 -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=@gmail.com header.s=20161025 header.b=hKpwx2YF; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726684AbgIXE3a (ORCPT + 99 others); Thu, 24 Sep 2020 00:29:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726466AbgIXE3a (ORCPT ); Thu, 24 Sep 2020 00:29:30 -0400 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E7B6C0613CE for ; Wed, 23 Sep 2020 21:29:30 -0700 (PDT) Received: by mail-il1-x142.google.com with SMTP id c5so187105ilk.11 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=BDMJBb6h8NQQMT0foxxQkO4kuen2Q/ThP1LGO4Qss0XW/fNCieF+U8+X9hGtUTZ3Lz 5lwMStbinWZZz7y7x4eXztF7QfS3cFfsdVddggYHtitjwAJl8ETLBSZmNAQhPLnP/Sub ZeN+e1pLdnmaZ2EOINk9m97/UYBLECFdmSHb78RkBdfMzKXGdQgRhQCGoJRuqZ97Ddp7 VYys0MLzMHMrnO4xddtQW3Vf/a4zuPSZ0lg/64eTI1DwvwZJRGG9qbsEhVr+AZ/wQE1R 1irz22d/A8INv/TqOLLtgFpQlIgmtBrwVYCpJ5//oFp/ibbwCiYX/PN55fTOTAK0NcsQ 46Wg== X-Gm-Message-State: AOAM5304qb629ElschW90AaQy3KzP9sAKtcDrUS1uFA4TLtIs2WiGwTt NAwry/qm5xiVmoROC0N3E7z7g0e/apH+hakII5A= 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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