Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1826967pxb; Fri, 18 Feb 2022 16:52:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyyP+TpiUQLqNkmJExVYtpPWi+mY10qUlSJW79wl+Lx1jPa79WN66ncsmgDwhgt807gDt29 X-Received: by 2002:a05:6402:34c1:b0:412:d12c:e713 with SMTP id w1-20020a05640234c100b00412d12ce713mr3878644edc.312.1645231931699; Fri, 18 Feb 2022 16:52:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645231931; cv=none; d=google.com; s=arc-20160816; b=0H/8h3JuGRyvYOPIt8i6oHREIcvjKfoOWtXhGWhOj9y0zljOrfKyhs1Z0IdXehlCcZ Ezbkbc5Kj97dkai7TW03QlpX6/CD/UJVH9pgS9DbkpQW4bTxBVxhio7O1HgRnMccNZdT UwsyCDvgG1FHA+SZe6l0y+txNsCFOL7RjU7Fm9EsSN3qsoBVISo22iCWS67RM3p/g30z uiADz9Cxn1HEfewBIilTaCVyu/hHib7e9beV6RvvIyvaYTc5OlqB6Lrwk4QOlD/Pugpg /FpC0L/Bq0lpiG+n+/k8frk9tw6q54wBTQMHTnDycVFQvSpM1NucN1eg9pFfQzPVI71h 5vew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=oZ0B0k9TEVJxJQ/WisQMmdzCzxzUGShGzQCMhNWsuFQ=; b=fMdIJwkeUslDWlE+eF255C15pS4Au0mdfqtg7u+lqyt3UN2uvTE7h0G0G9MqiozfG6 xN+M4fH7jkZ9a3RIDgN4MmQLw51UaMMDgmoGeYFUpftRLEcSuURc+O5O+ipYMdZx7+w+ 1zw8usBrTcTpvZHtUylQd4ZYio9fgzviH8TAc4vHSWhVra3Kq7ZIs6oc8GWpk/KyfJQ9 gpQJ2dAOe/uDkPR4zcNaQV35i9Z1w3dHAWoT5GMiD+vsCc+Jh7Oob5OyD8/ILqjD4ZLO SN/Qj74RK0tEdGJ4cfF6bJrTV9kKzPS8mXHlGawUqdVULH9BhKsY1SDivvx/aulg/Kgl pD3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j10si6514130edt.555.2022.02.18.16.51.47; Fri, 18 Feb 2022 16:52:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238979AbiBRSJm convert rfc822-to-8bit (ORCPT + 99 others); Fri, 18 Feb 2022 13:09:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238838AbiBRSJl (ORCPT ); Fri, 18 Feb 2022 13:09:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70FD727F2A6 for ; Fri, 18 Feb 2022 10:09:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0BEFA62034 for ; Fri, 18 Feb 2022 18:09:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09EB6C340E9; Fri, 18 Feb 2022 18:09:21 +0000 (UTC) Date: Fri, 18 Feb 2022 13:09:20 -0500 From: Steven Rostedt To: Jakub =?UTF-8?B?TWF0xJtuYQ==?= Cc: linux-mm@kvack.org, patches@lists.linux.dev, linux-kernel@vger.kernel.org, vbabka@suse.cz, mhocko@kernel.org, mgorman@techsingularity.net, willy@infradead.org, liam.howlett@oracle.com, hughd@google.com, kirill@shutemov.name, riel@surriel.com, peterz@infradead.org Subject: Re: [RFC PATCH 4/4] [PATCH 4/4] mm: add tracing for VMA merges Message-ID: <20220218130920.5902d967@gandalf.local.home> In-Reply-To: <20220218122019.130274-5-matenajakub@gmail.com> References: <20220218122019.130274-1-matenajakub@gmail.com> <20220218122019.130274-5-matenajakub@gmail.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 18 Feb 2022 13:20:19 +0100 Jakub Matěna wrote: > diff --git a/include/trace/events/mmap.h b/include/trace/events/mmap.h > index 4661f7ba07c0..9f6439e2ed2d 100644 > --- a/include/trace/events/mmap.h > +++ b/include/trace/events/mmap.h > @@ -6,6 +6,7 @@ > #define _TRACE_MMAP_H > > #include > +#include <../mm/internal.h> > > TRACE_EVENT(vm_unmapped_area, > > @@ -42,6 +43,60 @@ TRACE_EVENT(vm_unmapped_area, > __entry->low_limit, __entry->high_limit, __entry->align_mask, > __entry->align_offset) > ); > + > +TRACE_EVENT(vm_av_merge, > + > + TP_PROTO(int merged, enum vma_merge_res merge_prev, enum vma_merge_res merge_next, enum vma_merge_res merge_both), > + > + TP_ARGS(merged, merge_prev, merge_next, merge_both), > + > + TP_STRUCT__entry( > + __field(int, merged) > + __field(enum vma_merge_res, predecessor_different_av) > + __field(enum vma_merge_res, successor_different_av) > + __field(enum vma_merge_res, predecessor_with_successor_different_av) > + __field(int, diff_count) > + __field(int, failed_count) > + ), > + > + TP_fast_assign( > + __entry->merged = merged == 0; > + __entry->predecessor_different_av = merge_prev; > + __entry->successor_different_av = merge_next; > + __entry->predecessor_with_successor_different_av = merge_both; > + __entry->diff_count = (merge_prev == AV_MERGE_DIFFERENT) > + + (merge_next == AV_MERGE_DIFFERENT) + (merge_both == AV_MERGE_DIFFERENT); > + __entry->failed_count = (merge_prev == AV_MERGE_FAILED) > + + (merge_next == AV_MERGE_FAILED) + (merge_both == AV_MERGE_FAILED); Please indent the above better. That is: __entry->diff_count = (merge_prev == AV_MERGE_DIFFERENT) + (merge_next == AV_MERGE_DIFFERENT) + (merge_both == AV_MERGE_DIFFERENT); > + ), > + > + TP_printk("merged=%d predecessor=%d successor=%d predecessor_with_successor=%d diff_count=%d failed_count=%d\n", > + __entry->merged, > + __entry->predecessor_different_av, __entry->successor_different_av, > + __entry->predecessor_with_successor_different_av, > + __entry->diff_count, __entry->failed_count) To make the above easier to read for humans, you could have at the start: #define AV_MERGE_TYPES \ EM(MERGE_FAILED), \ EM(AV_MERGE_FAILED) \ EM(MERGE_OK) \ EMe(AV_MERGE_DIFFERENT) #define EM(a) TRACE_DEFINE_ENUM(a); #define EMe(a) TRACE_DEFINE_ENUM(a); AV_MERGE_TYPES #undef EM #undef EMe #define EM(a) {a, #a}, #define EMe(a) {a, #a} Then: TP_printk("merged=%d predecessor=%s successor=%s predecessor_with_successor=%s diff_count=%d failed_count=%d", (note, no "\n", get rid of that) __entry->merged, __print_symbolic(predecessor_different_av, AV_MERGE_TYPES), __print_symbolic(successor_different_av, AV_MERGE_TYPES), __print_symbolic(predecessor_with_successor_different_av, AV_MERGE_TYPES), __entry->diff_count, __entry->failed_count) Then the output will show strings instead of meaningless numbers. -- Steve > + > +); > + > +TRACE_EVENT(vm_pgoff_merge, > + > + TP_PROTO(struct vm_area_struct *vma, bool anon_pgoff_updated), > + > + TP_ARGS(vma, anon_pgoff_updated), > + > + TP_STRUCT__entry( > + __field(bool, faulted) > + __field(bool, updated) > + ), > + > + TP_fast_assign( > + __entry->faulted = vma->anon_vma; > + __entry->updated = anon_pgoff_updated; > + ), > + > + TP_printk("faulted=%d updated=%d\n", > + __entry->faulted, __entry->updated) > +); > #endif > > /* This part must be outside protection */