Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2548632pxu; Fri, 9 Oct 2020 22:36:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywlWSniu+qCsoVieHZIcfLf82vy0it/5F/eB1+3tb3DMGbucpgkLQGKDsQpiVyv2DBjlYi X-Received: by 2002:a17:906:4902:: with SMTP id b2mr17611555ejq.208.1602308211416; Fri, 09 Oct 2020 22:36:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602308211; cv=none; d=google.com; s=arc-20160816; b=fttmvY0Cf6E6epfBs304ErveJhE6t9Bg9HlEkwrVPiGmo+oydEOVkKRR/GKIMC+Oui q19rG+j6wcm99u6n5CM0fFvDfYPL38WHO6EJYozpU0fB9Y2vMRBk69MTAVrgBFDRvC3x NCtBf/YjxmSL9f9W8Cnf5iOHk38gi5Zs/r0Ro6nixi5AHWsZ2LU5fUqI2sRtTEjoN2H6 NGcAiGdvrr63isE0cdLy7E4S6Wy/mUJwCcW1xpfehdIC8iIs2Hua051ENIWyIygcPfss WKBvdWoqasd9+B86vLUIKSvdbuPktM2lLy4YhcWgz2OJoNXHXIWuIz1XQg//gRd3xEnT 2Y0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :sender:dkim-signature; bh=Oskwxi1g2+xZxPqyNpkhozQHPxUzxe/EfOOI24BudKs=; b=XBnnnhzT9j0BUhARWZVIR9sj404orLrwsDMOjS3JaX2nmziS0WzbndHu3Npa0tIxQi ixWxXw6ohEU5aQyVIkeZBAkQ//pTaKNXTqiC1jba4BwZ+U7CjKJRpUtNhLH7Fu2gmDT8 vufKFPgY2OmcU+CqPg/3PPrcJrvUN9qE4ttcnxt8BgJrfrjyYrKnsn+D8my4TXPkhA2O WWzuqn9qR0iT7vlAtI315978yCLhCsEzc0DQp1hVz8HWh2p7iE8QKeltO0a6laeYz/EH m98cyEiEKnpdBvzSjanSrDKTajdtDbiR1YmaFMomDJH8sm5jZ4dhKNb8TPVbCjUJRZh0 Webg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="sKVTHK+/"; 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 dc10si7579365edb.26.2020.10.09.22.36.27; Fri, 09 Oct 2020 22:36:51 -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="sKVTHK+/"; 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 S2389623AbgJIWF3 (ORCPT + 99 others); Fri, 9 Oct 2020 18:05:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbgJIWF3 (ORCPT ); Fri, 9 Oct 2020 18:05:29 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 627BFC0613D2 for ; Fri, 9 Oct 2020 15:05:29 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id r2so10388249yba.7 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=bbywTztKvusDoKL/p3WMNIgop5qWdOCi5QjBq5n1qYrfDAuI51q0JtNWtv2jAA5Je/ J0RErVTycp3OjGcnsfPgG0Rwxj6uu06T/hrKv2z5jsaAgb4nVHVwNhOPiz9rpZRWKL1P JSMmuJ8tB0+Dtc/Xqzpaelqyj8OZSnkNDl33jrdNUATK6szy3QKPxGivhXQyheQFSCh+ a7B7ww6wha3iKVPo/i6fN36P9j34tyHRPg9eAuVWaikzXVXWVr4xuB3H3LkRG/dAt3/8 fkCpy7i1LGUqExBPCA0o2eSSON/YKCFsUvmAmBV5bQmdO8oVpXAjk0WdTk95Vlh4jJX6 Z9ng== X-Gm-Message-State: AOAM531LPNrW94XF2s2K6vPqGg4U6pnCJe7CGEJwx3u2lyuvSfE7z91X +6eAkLR/LCu3bWMh844j5bubjPY1fczPjFo9OoA8 Sender: "axelrasmussen via sendgmr" 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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