From patchwork Tue Oct 20 18:47:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Rasmussen X-Patchwork-Id: 11847653 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD1E614B7 for ; Tue, 20 Oct 2020 18:47:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 548F822244 for ; Tue, 20 Oct 2020 18:47:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="TP8nBRSJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 548F822244 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 7B3CF6B005C; Tue, 20 Oct 2020 14:47:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 763196B0062; Tue, 20 Oct 2020 14:47:55 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6A1BB6B0068; Tue, 20 Oct 2020 14:47:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id 3DAE16B005C for ; Tue, 20 Oct 2020 14:47:55 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CF976180AD811 for ; Tue, 20 Oct 2020 18:47:54 +0000 (UTC) X-FDA: 77393188068.18.cave77_11064d527241 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id BC2CF1027FB34 for ; Tue, 20 Oct 2020 18:47:54 +0000 (UTC) X-Spam-Summary: 1,0,0,9966517250a11e16,d41d8cd98f00b204,32tcpxw0kchoyvcjpyqksqqclemmejc.amkjglsv-kkityai.mpe@flex--axelrasmussen.bounces.google.com,,RULES_HIT:41:152:355:379:541:967:968:973:988:989:1260:1277:1313:1314:1345:1437:1516:1518:1535:1542:1593:1594:1711:1730:1747:1777:1792:1801:2198:2199:2393:2525:2559:2564:2682:2685:2731:2859:2912:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3152:3353:3865:3866:3867:3868:3870:3871:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4605:5007:6261:6653:6691:7875:8531:9025:9969:10004:10400:11026:11232:11473:11658:11914:12043:12048:12291:12296:12297:12438:12555:12683:12895:13138:13231:14181:14394:14659:14721:21080:21433:21444:21627:21740:21939:21987:30054:30070,0,RBL:209.85.222.202:@flex--axelrasmussen.bounces.google.com:.lbl8.mailshell.net-66.100.201.100 62.18.0.100;04yrb4jsmppnbuguk7jp1tk9mwxb8ypf7pf9kqzm1j8sp3inpdh1zjsbsifui41.7axa59nbuapf7opd1jrqgn9wex58thp4kq7i3o7yafewypfgigfiip35d1f9dpg.1-lbl8.mai lshell.n X-HE-Tag: cave77_11064d527241 X-Filterd-Recvd-Size: 5118 Received: from mail-qk1-f202.google.com (mail-qk1-f202.google.com [209.85.222.202]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Tue, 20 Oct 2020 18:47:54 +0000 (UTC) Received: by mail-qk1-f202.google.com with SMTP id s14so2687038qke.1 for ; Tue, 20 Oct 2020 11:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=hwnYnS0POYRKONpfl5Y/Ys+jEoJH3m03NmNt0RevWsM=; b=TP8nBRSJfRaWqME65iqiGRIlVlXhcRSvbMSO86q9MoZTkrF/wWlSA+9upwZFM1gvlR CCvfLshAR2LVEvn66ld821KN8/GjNIdQCqQjqHjq7rp2/eDFoFUT2xErzYwV2djd0OVv rvI68TGZh4lb6eqBy6N08w+i7aH7duC/sRio3sG8Kro0VcTSEPrQ8HlHXvjy5CZFksLH jGxRqK1RRCIpuNvhnDIHdMXXDTcs6v+7ZlZnTqppifOe/VpyWFLbOnzQzYt14NY54I7m 8ErTbjQGMfcZWqWT08dMBwT7UvMgh8nrdT+Wsr2uSWxOHd5iZPGDW0elfyWozr0YbL/b uYKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=hwnYnS0POYRKONpfl5Y/Ys+jEoJH3m03NmNt0RevWsM=; b=bs1QFCjdYjD+aGHYthWTIhY8bzdKixPMOpfbgGeqmngWLaPyrwudA1TufGuDRtoeQE hatkgkZUdcAdujNQiR++GBjXfqBggQPnhhhaalH5jLZTvf88Bk7xInxQ/pxHJ2Xfev7a bDfIsrRdvP6zGcGZ7fsEIOqV9SewgU9SftAJgxcRTn1IbkWM2sB1GcL++Bygc5XDiTQm u9J5pbHUP/cQ0WuOK3ESSRhkYtOd3JlDm7zXF56hJYqlEpGQyhGwHzZkT2lR5/yRrQYO 6QaXJ37jhVL+pjyuMk03Tu+W3MbLQie4bRsl3ae3J9zTQi6nBZUMq99Ln6S3IbKLOypv VY7Q== X-Gm-Message-State: AOAM531z8VgFhpYfUSFvfMrvS10q3dhitgWKCgyiDlRVSUVC9R3oLIci oDpjTCiYTnzGz4CDyAE3QZ/gcHjkrvcufxIPfJfy X-Google-Smtp-Source: ABdhPJyPGryQh7+sHevmE+5QyU3RZQJX1SAfmqe3elp4FKyFyMr2/mmFVZyf4fMf8ctbiW8Jmw3yeXI2qnquFg1Kuun3 X-Received: from ajr0.svl.corp.google.com ([2620:15c:2cd:203:f693:9fff:feef:c8f8]) (user=axelrasmussen job=sendgmr) by 2002:ad4:4e47:: with SMTP id eb7mr4932129qvb.34.1603219673444; Tue, 20 Oct 2020 11:47:53 -0700 (PDT) Date: Tue, 20 Oct 2020 11:47:45 -0700 Message-Id: <20201020184746.300555-1-axelrasmussen@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.0.rc1.297.gfa9743e501-goog Subject: [PATCH v4 0/1] Add tracepoints around mmap_lock acquisition From: Axel Rasmussen To: Steven Rostedt , Ingo Molnar , Andrew Morton , Michel Lespinasse , Vlastimil Babka , Daniel Jordan , Jann Horn , Chinwen Chang , Davidlohr Bueso , David Rientjes Cc: Yafang Shao , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Axel Rasmussen 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: This patchset adds tracepoints around mmap_lock acquisition. This is useful so we can measure the latency of lock acquisition, in order to detect contention. This version is based upon linux-next (since it depends on some recently-merged patches [1] [2]). Changes since v3: - Switched EXPORT_SYMBOL to EXPORT_TRACEPOINT_SYMBOL, removed comment. - Removed redundant trace_..._enabled() check. - Defined the three TRACE_EVENTs separately, instead of sharing an event class. The tradeoff is 524 more bytes in .text, but the start_locking and released events no longer have a vestigial "success" field, so they're simpler + faster. Changes since v2: - Refactored tracing helper functions so the helpers are simper, but the locking functinos are slightly more verbose. Overall, this decreased the delta to mmap_lock.h slightly. - Fixed a typo in a comment. :) Changes since v1: - Functions renamed to reserve the "trace_" prefix for actual tracepoints. - We no longer measure the duration directly. Instead, users are expected to construct a synthetic event which computes the interval between "start locking" and "acquire returned". - The new helper for checking if tracepoints are enabled in a header is used to avoid un-inlining any of the lock wrappers. This yields ~zero overhead if the tracepoints aren't enabled, and therefore obviates the need for a Kconfig for this change. [1] https://lore.kernel.org/patchwork/patch/1316922/ [2] https://lore.kernel.org/patchwork/patch/1311996/ Axel Rasmussen (1): mmap_lock: add tracepoints around lock acquisition include/linux/mmap_lock.h | 93 ++++++++++++++++++++++++++++-- include/trace/events/mmap_lock.h | 98 ++++++++++++++++++++++++++++++++ mm/Makefile | 2 +- mm/mmap_lock.c | 80 ++++++++++++++++++++++++++ 4 files changed, 267 insertions(+), 6 deletions(-) create mode 100644 include/trace/events/mmap_lock.h create mode 100644 mm/mmap_lock.c --- 2.29.0.rc1.297.gfa9743e501-goog