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=-15.4 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 39495C4320A for ; Fri, 30 Jul 2021 05:32:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9C4E660F48 for ; Fri, 30 Jul 2021 05:32:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9C4E660F48 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 CD50E6B0036; Fri, 30 Jul 2021 01:32:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C83836B005D; Fri, 30 Jul 2021 01:32:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B72A38D0001; Fri, 30 Jul 2021 01:32:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0066.hostedemail.com [216.40.44.66]) by kanga.kvack.org (Postfix) with ESMTP id 9C0376B0036 for ; Fri, 30 Jul 2021 01:32:20 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 518261846F5F4 for ; Fri, 30 Jul 2021 05:32:20 +0000 (UTC) X-FDA: 78418133640.10.D282FCF Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by imf21.hostedemail.com (Postfix) with ESMTP id 436D4D016780 for ; Fri, 30 Jul 2021 05:32:19 +0000 (UTC) Received: by mail-pj1-f54.google.com with SMTP id pj14-20020a17090b4f4eb029017786cf98f9so2151099pjb.2 for ; Thu, 29 Jul 2021 22:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=tc/E0qrtXkKG5TqRhI2Z9x1vlmmiIqFXZ6WxPD+IjN0=; b=ajAyDT4MLNPRQ3vOGK024+ZLMZe0q08hEQ/v2442VjDZjJB0GkXFWTNhtuA0WlnQn6 0J5PzKV5vZmT1Vo0AEK+1MqBwSwDd+4WFbb6u9Scl+/xCpWRbtj+rPlVQH3y4z6l8NUI DNKn5+R4w1qMoiKKC2VdewVm54jEEq6co9ha5KDuxG2XDjQhqstBRzbAGJFFxEFitTWQ VI5QGbjuiBCNH4wOOST7J6aVibyFeCuGjlE46fcHf1gGEu0PMMPC+/fB3MyL0D/AsoH/ oUuzAZBEoRUZUep34XZvsPFZhrymYdppo7+Ei8acXH24ifE0T+PknoENv6T5mZWJe7Ho Yqrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=tc/E0qrtXkKG5TqRhI2Z9x1vlmmiIqFXZ6WxPD+IjN0=; b=bnw8HZ55L68Hd+9FkRrHV1B9DwEAQ7R+DWzwSWD9FaWWYsHISUqz21fJbu6i1n5f5N r+EYzwVE63d+zeG0IeSF3pBpqktCau5YX3RRV4mByqhCmFvBNB43XhIdsJg9QaT5aKWr dM9owYNj15vUjZWgH2pWVgr2wMeP2JnoEsk6E/mSgc6I0/O7wpWMZzYhXSEv26sN5ouu fADQrAbtrgcO3okBxV4636vf8OhvAZ8Scia6Yg5+tG6x53WZ1bCFCHXGpxa6RlZBGULD 54eiuMO8Bm9buZorUgaQcFRRaT5fZrI+cTK9Q1IEOraGQK0v3mLlS7WmeKp9WkQc7/AP yKVA== X-Gm-Message-State: AOAM530bnrY7+SchtSrutht26tZDFeycBnZtOuTd9VAIJBE5z3+B5P0h Hsdc6e5IaWRtiVnd+mskE8zzBqaTqgaEow== X-Google-Smtp-Source: ABdhPJyNuONqblrBqBkC6RaWPNkLKL/Yze00pMoniSvyjSfV8VO6bjonJnl0e4xqrrbztDp5x1ZRsA== X-Received: by 2002:a17:90a:e7c7:: with SMTP id kb7mr1190320pjb.43.1627623137771; Thu, 29 Jul 2021 22:32:17 -0700 (PDT) Received: from [10.76.46.68] ([61.120.150.72]) by smtp.gmail.com with ESMTPSA id 81sm364046pfv.185.2021.07.29.22.32.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Jul 2021 22:32:17 -0700 (PDT) Subject: Re: Re: [PATCH 3/3] mm: mmap_lock: add ip to mmap_lock tracepoints To: Axel Rasmussen Cc: Steven Rostedt , Ingo Molnar , Andrew Morton , Vlastimil Babka , LKML , Linux MM References: <20210729092853.38242-1-ligang.bdlg@bytedance.com> From: Gang Li Message-ID: <585f936d-9d27-a481-f590-bd07f98f34de@bytedance.com> Date: Fri, 30 Jul 2021 13:32:12 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 436D4D016780 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b=ajAyDT4M; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf21.hostedemail.com: domain of ligang.bdlg@bytedance.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=ligang.bdlg@bytedance.com X-Stat-Signature: 6uito39h6fj4wbmitdn65m49caaj61cy X-HE-Tag: 1627623139-273072 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: Thanks! I have tried your suggestion. They are great, especially synthetic-events. If don't print ip per event, we can only guess which one cause the contention by "hitcount". > (https://www.kernel.org/doc/html/latest/trace/histogram.html#synthetic-events) But it seems that they only support histogram, can I print the synthetic-events args per event in /sys/kernel/debug/tracing/trace like other events? I haven't found that in kernel doc. On 7/30/21 1:33 AM, Axel Rasmussen wrote: > Not a strong objection, but I think this can be achieved already using either: > > - The "stacktrace" feature which histogram triggers support > (https://www.kernel.org/doc/html/latest/trace/histogram.html) > - bpftrace's kstack/ustack feature > (https://github.com/iovisor/bpftrace/blob/master/docs/tutorial_one_liners.md#lesson-9-profile-on-cpu-kernel-stacks) > > I haven't tried it out myself, but I suspect you could construct a > synthetic event > (https://www.kernel.org/doc/html/latest/trace/histogram.html#synthetic-events) > which adds in the stack trace, then it ought to function a lot like it > would with this patch. > > Then again, it's not like this change is huge by any means. So, if you > find this more convenient than those alternatives, you can take: > > Reviewed-by: Axel Rasmussen > > It's possible Steven or Tom have a more strong opinion on this though. ;) > > On Thu, Jul 29, 2021 at 2:29 AM Gang Li wrote: >> >> The mmap_lock is acquired on most (all?) mmap / munmap / page fault >> operations, so a multi-threaded process which does a lot of these >> can experience significant contention. Sometimes we want to know >> where the lock is hold. And it's hard to locate without collecting ip. >> >> Here's an example: TP_printk("ip=%pS",ip) >> Log looks like this: "ip=do_user_addr_fault+0x274/0x640" >> >> We can find out who cause the contention amd make some improvements >> for it. >> >> Signed-off-by: Gang Li