From patchwork Fri Oct 9 22:05:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Rasmussen X-Patchwork-Id: 11829719 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 C143615E6 for ; Fri, 9 Oct 2020 22:05:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7C3702225D for ; Fri, 9 Oct 2020 22:05:31 +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="sKVTHK+/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C3702225D 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 BE00794000E; Fri, 9 Oct 2020 18:05:30 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B8EDB94000C; Fri, 9 Oct 2020 18:05:30 -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 A56E094000E; Fri, 9 Oct 2020 18:05:30 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0233.hostedemail.com [216.40.44.233]) by kanga.kvack.org (Postfix) with ESMTP id 75C8C94000C for ; Fri, 9 Oct 2020 18:05:30 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 104E73626 for ; Fri, 9 Oct 2020 22:05:30 +0000 (UTC) X-FDA: 77353769220.09.stem53_07157f9271e4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id EA202180AD806 for ; Fri, 9 Oct 2020 22:05:29 +0000 (UTC) X-Spam-Summary: 1,0,0,11a4af9c0335477c,d41d8cd98f00b204,3qn6axw0kcgsjgnuajbvdbbnwpxxpun.lxvurwdg-vvtejlt.xap@flex--axelrasmussen.bounces.google.com,,RULES_HIT:41:152:355:379:541:967:973:988:989:1260:1277:1313:1314:1345:1437:1516:1518:1534:1541: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:7875:8531:9025:9969:10004:10400:11026:11232:11658:11914:12043:12048:12291:12296:12297:12555:12679:12683:12895:13069:13311:13357:14093:14097:14181:14394:14581:14659:14721:21080:21444:21451:21627:21740:30054:30070,0,RBL:209.85.219.201:@flex--axelrasmussen.bounces.google.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100;04ygh8edqpiy7cyhfmketthjdp95topsrwtsg54bfh5i6mgh3ij9b7e5fibxi41.7axa59d7wh3k6yoix5pnj8sr1o75nitpqjfi3o7yafewbf6fot6kkrh4ak76k1w.s-lbl8.mailsh ell.net- X-HE-Tag: stem53_07157f9271e4 X-Filterd-Recvd-Size: 4788 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Fri, 9 Oct 2020 22:05:29 +0000 (UTC) Received: by mail-yb1-f201.google.com with SMTP id d143so10368744ybh.11 for ; Fri, 09 Oct 2020 15:05:29 -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=Oskwxi1g2+xZxPqyNpkhozQHPxUzxe/EfOOI24BudKs=; b=sKVTHK+/cJgmnRYH0J5BpycpZImtw2W1PcV/EkLthKq0viMSlKaHqOSTqweSit4mVU XfI+7lzYCx1FXDv7DwP/bnYYMy1u2vemzjYq+2Y7wGL0JgeZlnlCib1TUbfMPet3GmcO 9TOGw2er8Rsn/w5HUER10CTGnAAnOPe0I+h92FRiGO2pUvA6iTM8Co2ZqOf5j/+Dj8XC 9A1GgcCrr6vQNVO/rWDst5RSlfcRAvLvbeg2XwVX0GgZZaH3zgdUCxZJOlP76Rk7Ljud TCfXwqcllEMZAQZfECd+HK9YI7ZMIqeTSts3WZYjj+XK/SsjWklcOxMBO+tbKGdGTXld /uIw== 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=Oskwxi1g2+xZxPqyNpkhozQHPxUzxe/EfOOI24BudKs=; b=Gltw+2XfnJyD/i3bgoaaL+Nuk4gQxAI6FREPa0jqoKV7WWIpdBqFfhrxbwnApyTTdg H6bmRXtdqu7wjPRNHeBMgy6av/+shj7G3qb/3ji4+UyPd7e47iZ/B4Hu/YexyBPDbIfD 1Wb59mbN+t9bYCrA5vnik5GeQFFrp3bcmshCd8uKGAwBR7EmW9xcOJGsr6dTzZzAqv08 Pj7wRlaR/gA1nDtqOGSzeOCvqLqfL3WbrFupn1R3KyfYbIhvGb0eVq7lnq7+wqO/bM9d B0/agGEaLDoYpL/yw2W5ZOw4HV3b/jlBWvDCLSCJDaGapGSOfMaFZDcqa1unDw0tJu9Z BmeA== X-Gm-Message-State: AOAM5305TOyneP+u5kzTtwXL9LTsG2crYTOOYWf49yhC7JVp3b5kTEkO WbdLtQOlCnF2kDkdzq196HizB+IynX5Ja37IRFNY X-Google-Smtp-Source: ABdhPJzX+v1XxsBETju7nWZwVjITzY2J5kD46J+3KxJOdrkI3MnlEbcgHrq0Amsd4LL2182+9hCL8q8dHjWHjNdJZt2z X-Received: from ajr0.svl.corp.google.com ([2620:15c:2cd:203:f693:9fff:feef:c8f8]) (user=axelrasmussen job=sendgmr) by 2002:a25:eb08:: with SMTP id d8mr20071031ybs.23.1602281128551; Fri, 09 Oct 2020 15:05:28 -0700 (PDT) Date: Fri, 9 Oct 2020 15:05:22 -0700 Message-Id: <20201009220524.485102-1-axelrasmussen@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.1011.ga647a8990f-goog Subject: [PATCH v3 0/2] Add tracepoints around mmap_lock acquisition From: Axel Rasmussen To: Steven Rostedt , Ingo Molnar , Andrew Morton , Michel Lespinasse , Vlastimil Babka , Daniel Jordan , Laurent Dufour , Axel Rasmussen , Jann Horn , Chinwen Chang Cc: Yafang Shao , linux-kernel@vger.kernel.org, linux-mm@kvack.org 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 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 (2): tracing: support "bool" type in synthetic trace events mmap_lock: add tracepoints around lock acquisition include/linux/mmap_lock.h | 93 +++++++++++++++++++++++++++++-- include/trace/events/mmap_lock.h | 70 +++++++++++++++++++++++ kernel/trace/trace_events_synth.c | 4 ++ mm/Makefile | 2 +- mm/mmap_lock.c | 87 +++++++++++++++++++++++++++++ 5 files changed, 250 insertions(+), 6 deletions(-) create mode 100644 include/trace/events/mmap_lock.h create mode 100644 mm/mmap_lock.c --- 2.28.0.1011.ga647a8990f-goog