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=-7.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 EC8A0C4338F for ; Thu, 19 Aug 2021 18:18:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7351660E76 for ; Thu, 19 Aug 2021 18:18:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7351660E76 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 013756B006C; Thu, 19 Aug 2021 14:18:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F05F78D0001; Thu, 19 Aug 2021 14:18:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF4276B0072; Thu, 19 Aug 2021 14:18:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0153.hostedemail.com [216.40.44.153]) by kanga.kvack.org (Postfix) with ESMTP id C32E36B006C for ; Thu, 19 Aug 2021 14:18:37 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5887E1801369C for ; Thu, 19 Aug 2021 18:18:37 +0000 (UTC) X-FDA: 78492640674.33.75606B4 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by imf30.hostedemail.com (Postfix) with ESMTP id 5853CE0016BE for ; Thu, 19 Aug 2021 18:18:36 +0000 (UTC) Received: by mail-pg1-f170.google.com with SMTP id e7so6651555pgk.2 for ; Thu, 19 Aug 2021 11:18:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=5LOdLcnvC+SRsMPPojHQsg4OR8TH3GpUEW54S9ehwTc=; b=Ks6q097BGB14mxGFJ+1T04aF/0zcz1ec/Pp0kvtjmwkEJdIjMR+97oDLvcuRGT8evn C8e8t7ekuTGf4gtD8eBzSYlsXSWOeTDRD8yyXecjUyqrRyLXLVY0sfRSQ+rs5O7PKzC+ RuG4vglbxDgFPl4TI7pa9elvXKIL/ZR8co7+pfwin8MuL/Jmvobwa2y1eY7dJoU9wvHS aPfR6l5pncYgFc8PA1l1zHpK4fTEopZdc1u+fl23A7MDGRfT3P02GCX59G1WvJ/Mttxv Hi0XIgqNoQ1M2O6KNvLJ858wJvKVIUO9LKLz0MDE03wLdc3Fl/hODenagpZwf/fJw1Hf UvCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=5LOdLcnvC+SRsMPPojHQsg4OR8TH3GpUEW54S9ehwTc=; b=IJyMVO6lmwas7PxJE5klh7vCbh+vzXJkT64tRCxK6JtSYI6XxetUPA+l/3B2jCd8eV Tw1wLG4/GSf2pHBiznwuKwP4STfKiUUFc7alx4kFCK7aNgj1Ar9kD58n1XMblDyzISZw gJjLOwzANOjW5Ag4KvZiBPSYXDZWErHQPQ0jCxt1/vFMOMkqSfuqRH7OMXVGOGNgBxlD e7MRsU+ZSgee/aBqHlx83Uh3ne0nRWCZhY4OTQ5OixH/bAfLD+rcdK7vrW22fUQ35OrM OupV8hXCBXOK/0nC3kl+kU2QRVV5yH1/NJ4KPLTz1QXTw59pk9eByfJVkxgW1A4HjpFr 6whA== X-Gm-Message-State: AOAM532hQiQD8QDgXUNzZ0tzkpPQ6FiAyNVjmnf4q3ukwj2eJ+OyntSF J7yVsNHhv9Ybc8C65Avlz0rCQ3TreVzFpA== X-Google-Smtp-Source: ABdhPJyYI9QQqhAJu7H6uM6DOnFbh1AdA7RM5hj2qc40uFgB9DMQ36HOi2eZmEptewNPr7BmI427VA== X-Received: by 2002:a05:6a00:ac6:b029:374:a33b:a74 with SMTP id c6-20020a056a000ac6b0290374a33b0a74mr16028120pfl.51.1629397114742; Thu, 19 Aug 2021 11:18:34 -0700 (PDT) Received: from [10.255.196.11] ([139.177.225.250]) by smtp.gmail.com with ESMTPSA id p10sm4046174pfw.28.2021.08.19.11.18.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Aug 2021 11:18:34 -0700 (PDT) Subject: Re: [PATCH 3/3] mm: mmap_lock: add ip to mmap_lock tracepoints From: Gang Li To: Steven Rostedt , Axel Rasmussen Cc: Axel Rasmussen , Ingo Molnar , Andrew Morton , Vlastimil Babka , LKML , Linux MM References: <20210729092853.38242-1-ligang.bdlg@bytedance.com> <585f936d-9d27-a481-f590-bd07f98f34de@bytedance.com> <20210730160319.6dfeaf7a@oasis.local.home> <89c20b62-c0ab-3200-fb33-eb2058b7ba67@bytedance.com> Message-ID: Date: Fri, 20 Aug 2021 02:18:29 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <89c20b62-c0ab-3200-fb33-eb2058b7ba67@bytedance.com> Content-Type: text/plain; charset=utf-8; format=flowed X-Rspamd-Queue-Id: 5853CE0016BE Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=Ks6q097B; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf30.hostedemail.com: domain of ligang.bdlg@bytedance.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=ligang.bdlg@bytedance.com X-Rspamd-Server: rspam04 X-Stat-Signature: 8abggpgxeio87o4chpiqc7iiq6g4h6s1 X-HE-Tag: 1629397116-308146 Content-Transfer-Encoding: quoted-printable 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 8/2/21 10:44 AM, Gang Li wrote: > On 7/31/21 4:03 AM, Steven Rostedt wrote: >> Yes, synthetic events are just like normal events, and have triggers, >> stack traces, and do pretty much anything that another event can do. >> >> I'm just finishing up a libtracfs called tracefs_sql() (hopefully >> posting it today), that allows you to create a synthetic event via an >> SQL statement. But I don't think this is what you are looking for. >> >> What about using function tracing? Because the tracepoint is called >> from __mmap_lock* helper functions that function tracer can see, you >> can just do the following: >> >> =C2=A0 # trace-cmd start -e mmap_lock -p function -l '__mmap_lock_*' >> =C2=A0 # trace-cmd show >> [..] >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 trace-cmd-1840=C2=A0=C2=A0=C2= =A0 [006] ....=C2=A0=C2=A0 194.576801:=20 >> __mmap_lock_do_trace_start_locking <-do_user_addr_fault >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 trace-cmd-1840=C2=A0=C2=A0=C2= =A0 [006] ...1=C2=A0=C2=A0 194.576805:=20 >> mmap_lock_start_locking: mm=3D000000006515cb1f=20 >> memcg_path=3D/user.slice/user-0.slice/session-2.scope write=3Dfalse >> Hi! I find that sometimes the output data is out of order, which leads to=20 inaccurate time stamps and make it hard to analyse. node-953 [001] .... 203.823297:=20 __mmap_lock_do_trace_start_locking <-do_user_addr_fault node-955 [002] .... 203.823297:=20 __mmap_lock_do_trace_start_locking <-do_user_addr_fault node-956 [003] .... 203.823297:=20 __mmap_lock_do_trace_start_locking <-do_user_addr_fault node-953 [001] .... 203.823297:=20 mmap_lock_start_locking: mm=3D000000004395a005=20 memcg_path=3D/user.slice/user-0.slice/session-1.scope write=3Dfalse=20 ip=3Ddo_user_addr_fault+0x270/0x4d0 node-953 [001] .... 203.823298:=20 __mmap_lock_do_trace_acquire_returned <-do_user_addr_fault Is there any other way to collect ip in each event? It seems that adding=20 "ip" fields is the only way to do this accurately and effectively.