From patchwork Fri Aug 26 22:03:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zach O'Keefe X-Patchwork-Id: 12956668 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D03FCC0502A for ; Fri, 26 Aug 2022 22:03:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 638116B007B; Fri, 26 Aug 2022 18:03:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E8FA940007; Fri, 26 Aug 2022 18:03:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43BFF6B007E; Fri, 26 Aug 2022 18:03:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 34E4A6B007B for ; Fri, 26 Aug 2022 18:03:42 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 191C5120FB3 for ; Fri, 26 Aug 2022 22:03:42 +0000 (UTC) X-FDA: 79843121484.25.3D64D6A Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf11.hostedemail.com (Postfix) with ESMTP id B66934000C for ; Fri, 26 Aug 2022 22:03:41 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id e16-20020a17090301d000b00172fbf52e7dso1806082plh.11 for ; Fri, 26 Aug 2022 15:03:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc; bh=xLLp8vTNhH59q1o8fD2SQ2kq8Qu3/LkoSxB3VWIQLC0=; b=XvGjn7gHG0Jy2AgL77bVjBMmKvfX3u39kZPEEpJFPH3teQ46Dx+8hErcT5acLyHFxg BiyWrmpM4RizBfuDsPxpBk943ZIjrRWOxEy2zkWBTftKoyNWlj9lf9QklHxMy3vC+xlv V3seD2HOV6EveLNH+xLmeGYqsBn02pZFAvymqrL0OIC7CSiBfl66bGJsjFqYqFiV5zJs QUQpdIUZWpEMSFiB65kNDqOrA5YXNZMKgBOEwShMJZ621cuDotTqKpmUDfeC7N9LO++c oZML7KAJBXdszNb7u7KfIKDVylXzic3HQ+nnItcuZFTHijcTYJdofdihTYG/d05OCaoM p53g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc; bh=xLLp8vTNhH59q1o8fD2SQ2kq8Qu3/LkoSxB3VWIQLC0=; b=unZYUOhI90rXr+C5o1YxfXfmVWyxg7zjbfTW6MU0IJWcW4UUoDp/qYhMJjeFK7IyXR jmf+JM4ko+s6V9w/ATP+mHPzym20ePxvBTT/iAJIKMeBlCDE+hcRnGt2fZ6WjGkRnave b1uGA14QbvqkcBQqODIRqid5mR6mBP5LIkC/Bkm3b4HopxUEjCVS3ueGfN0coP3IF1WZ VEJumvM/iWA3QY7gpwVO8ADhOEvK73bnhk8OMkvfUt7Mo/3PKa9UCS2oNi7B8XM2kWsK FddELm1PFDlij9PzgxSYY+TzaD5H6qgSPwNiuyhcFUuIwZGwKb0+2yTrxg/fDGFrfUKU /JnA== X-Gm-Message-State: ACgBeo0l8/Yd9zTPdEzs1tY6WocAL5C1elW26nh+50FTnbos8XOhWXJz F5w4H2YXrwGuEH5c2JK2LoePr+VulZ4HJFgGlbnoX2w9bdBa5o9oU9FnUzoZ68qEGl/ZsK+jt0I 5ey4ZOb47afA77c8I9P26ZsTWcVqrbhrxHy4A54fFbtiEKxQR0IPwTom1eGw= X-Google-Smtp-Source: AA6agR6DfENa/SqqjaPKPVw6ISWE0peW5BCO0Jlhcvcu4MaLoFQGGb8x4Ck9MTRbtfqdId2FemtcKWQt4S0Q X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a17:902:b489:b0:171:5091:d53b with SMTP id y9-20020a170902b48900b001715091d53bmr5690727plr.44.1661551420635; Fri, 26 Aug 2022 15:03:40 -0700 (PDT) Date: Fri, 26 Aug 2022 15:03:23 -0700 In-Reply-To: <20220826220329.1495407-1-zokeefe@google.com> Mime-Version: 1.0 References: <20220826220329.1495407-1-zokeefe@google.com> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220826220329.1495407-5-zokeefe@google.com> Subject: [PATCH mm-unstable v2 4/9] mm/khugepaged: add tracepoint to hpage_collapse_scan_file() From: "Zach O'Keefe" To: linux-mm@kvack.org Cc: Andrew Morton , linux-api@vger.kernel.org, Axel Rasmussen , James Houghton , Hugh Dickins , Yang Shi , Miaohe Lin , David Hildenbrand , David Rientjes , Matthew Wilcox , Pasha Tatashin , Peter Xu , Rongwei Wang , SeongJae Park , Song Liu , Vlastimil Babka , Chris Kennelly , "Kirill A. Shutemov" , Minchan Kim , Patrick Xia , "Zach O'Keefe" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661551421; a=rsa-sha256; cv=none; b=AolsuZ/YFsqlYP+C65WIjzSj7GQ1YQXGafGRWPQSprdwCyRtm0+07znwJBk/5/uFMutWrI XZxesSGLXq4Kza4iOO4PUwiigcK7t6N4FurJUWQEF4jHGrFZk/Z3osAKix1d6xxoiMT/bN wr/Pk6xhpJ6jCFy3gYpPK0l9zJAHNMs= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=XvGjn7gH; spf=pass (imf11.hostedemail.com: domain of 3PEMJYwcKCAc6vrllmlnvvnsl.jvtspu14-ttr2hjr.vyn@flex--zokeefe.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=3PEMJYwcKCAc6vrllmlnvvnsl.jvtspu14-ttr2hjr.vyn@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661551421; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=xLLp8vTNhH59q1o8fD2SQ2kq8Qu3/LkoSxB3VWIQLC0=; b=8eo15QC10ozk5Q1vDaXtYzF+31J9R2OAJWcEF/z9KLMOM1B7OszrHNzXJ59UrdY8tTof7N hL9Y3t4PW9Bk4N3gDeiLc2yqT3ANuUwBQKr6UNFvCovi2AnuXyi2sRrIbXFkxbXGbBKUuX 8PfxwAlXXgKj1AZiwMvjHxrOISsVDbY= X-Stat-Signature: w479g9h8c4gh93fdyfrmazbgoqamt8hy X-Rspamd-Queue-Id: B66934000C X-Rspam-User: X-Rspamd-Server: rspam06 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=XvGjn7gH; spf=pass (imf11.hostedemail.com: domain of 3PEMJYwcKCAc6vrllmlnvvnsl.jvtspu14-ttr2hjr.vyn@flex--zokeefe.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=3PEMJYwcKCAc6vrllmlnvvnsl.jvtspu14-ttr2hjr.vyn@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1661551421-504267 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: Add huge_memory:trace_mm_khugepaged_scan_file tracepoint to hpage_collapse_scan_file() analogously to hpage_collapse_scan_pmd(). While this change is targeted at debugging MADV_COLLAPSE pathway, the "mm_khugepaged" prefix is retained for symmetry with huge_memory:trace_mm_khugepaged_scan_pmd, which retains it's legacy name to prevent changing kernel ABI as much as possible. Signed-off-by: Zach O'Keefe --- include/trace/events/huge_memory.h | 34 ++++++++++++++++++++++++++++++ mm/khugepaged.c | 3 ++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/include/trace/events/huge_memory.h b/include/trace/events/huge_memory.h index a8db658e99e9..1d2dd88dc3c4 100644 --- a/include/trace/events/huge_memory.h +++ b/include/trace/events/huge_memory.h @@ -169,5 +169,39 @@ TRACE_EVENT(mm_collapse_huge_page_swapin, __entry->ret) ); +TRACE_EVENT(mm_khugepaged_scan_file, + + TP_PROTO(struct mm_struct *mm, struct page *page, const char *filename, + int present, int swap, int result), + + TP_ARGS(mm, page, filename, present, swap, result), + + TP_STRUCT__entry( + __field(struct mm_struct *, mm) + __field(unsigned long, pfn) + __string(filename, filename) + __field(int, present) + __field(int, swap) + __field(int, result) + ), + + TP_fast_assign( + __entry->mm = mm; + __entry->pfn = page ? page_to_pfn(page) : -1; + __assign_str(filename, filename); + __entry->present = present; + __entry->swap = swap; + __entry->result = result; + ), + + TP_printk("mm=%p, scan_pfn=0x%lx, filename=%s, present=%d, swap=%d, result=%s", + __entry->mm, + __entry->pfn, + __get_str(filename), + __entry->present, + __entry->swap, + __print_symbolic(__entry->result, SCAN_STATUS)) +); + #endif /* __HUGE_MEMORY_H */ #include diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 34c0c74b3839..55144f33ba09 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2171,7 +2171,8 @@ static int hpage_collapse_scan_file(struct mm_struct *mm, unsigned long addr, } } - /* TODO: tracepoints */ + trace_mm_khugepaged_scan_file(mm, page, file->f_path.dentry->d_iname, + present, swap, result); return result; } #else