From patchwork Fri Aug 12 01:28:38 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: 12941852 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 9BE84C28B2B for ; Fri, 12 Aug 2022 01:29:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36F578E0006; Thu, 11 Aug 2022 21:29:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 281E28E0002; Thu, 11 Aug 2022 21:29:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D5898E0006; Thu, 11 Aug 2022 21:29:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E41EE8E0002 for ; Thu, 11 Aug 2022 21:29:18 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id BB3AE121818 for ; Fri, 12 Aug 2022 01:29:18 +0000 (UTC) X-FDA: 79789207596.20.E6B3C54 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) by imf05.hostedemail.com (Postfix) with ESMTP id 5C9B5100049 for ; Fri, 12 Aug 2022 01:29:18 +0000 (UTC) Received: by mail-pg1-f201.google.com with SMTP id p9-20020a63c149000000b00420f9b67f0bso709017pgi.19 for ; Thu, 11 Aug 2022 18:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc; bh=jDF7dMpuWYOG8UKbkC4L3SFnWIZkMKf/Zh805z9oCHM=; b=Y3m0BXocyTl5mEsD5PBF9KTfAs6zkewRsQcGgZ9G1OOwLy3gLvfQj9VfsVAc7wz72e ydOzFFic3cRGCVb1iGqZCMtbFmGqWET3LA9QWNfvpkz2iZrmwOWMHpunueEynkmKSlGu THaXRbc7XRPI64byuEAB89HA2pP8zcnh56dOLpZyhbmWnbu2itvGkmIZe7ZM9iFtX2d5 3IF2Ct6/oDXtVyrOx5t3TSiaLtA1kRiXuBbXqlkcaXHuwz1kVH3VIBAckiy8ThYiNrDX cyo6S9p1Mg3po6Fi71ZWkJe2XO+Wq+xlcXXHFoOlOwZTSgElfL4HQumahkElurSL8ot2 BiuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc; bh=jDF7dMpuWYOG8UKbkC4L3SFnWIZkMKf/Zh805z9oCHM=; b=L8HU10PVNitwmPO/n1DlVJasn06mP4GR2TGg1AyWvw/u5E8daYOxj8NAqxWzVUwr7M fkfDuM6QLIgGn3xo5xfOckTEYEci3jlFVaTSf5+B3QCPNfZzEUWlAuUp12SmRToF7pxO PE4ZJmTJ3bwcXqkc0QF62JgtgAhd6ob9aCapPTTfy7MUb0JRchI9Zcl6s3UmCS+ZmRxu FE2KHLKLOD/ONAuUabvhNg8XueeNEmz1Z01R2zQUkHqFY1X572KeGx+qvkB7832JSfPI hRLQgWdLOA40lnPM2mmaUw8bUmXekXeU5O1SBPs2i9j2/wE8tPhTEqNop/zU05hXKHO+ b8HA== X-Gm-Message-State: ACgBeo3csN7KmMJ3aIHuT7aCpueXnOli+FUxfXSjXSHYeEC8o+eHJ3ZA m+NUiO7BG1SCk4W18tQp+LadR7Xp07I6gAH2+D84MXG9QTt2ZVlRjPUuvYUr0dgS7BPqw6BZTtj scWe9Q4ABQBZSE/3fPUYXcILPxbU6z0myHro/z8DTHkTyhArZ+N/p1/vdbhM= X-Google-Smtp-Source: AA6agR7Ae2xcZcviGvVh4A3ONRePNnbNXtCAzLeHWqQ7v/7hQD/l9nlG+rPbSV20jYVNytWNAursmG1w3FFl X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a17:902:8f8a:b0:16f:975e:7c6e with SMTP id z10-20020a1709028f8a00b0016f975e7c6emr1873309plo.136.1660267757160; Thu, 11 Aug 2022 18:29:17 -0700 (PDT) Date: Thu, 11 Aug 2022 18:28:38 -0700 In-Reply-To: <20220812012843.3948330-1-zokeefe@google.com> Message-Id: <20220812012843.3948330-5-zokeefe@google.com> Mime-Version: 1.0 References: <20220812012843.3948330-1-zokeefe@google.com> X-Mailer: git-send-email 2.37.1.559.g78731f0fdb-goog Subject: [PATCH mm-unstable 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=1660267758; a=rsa-sha256; cv=none; b=AD3Vt9L5+b7FsR1qTCVAn8yDy9NzPIg3UQ9yx7UWn+4lfU9XLaaFnmfEI0bYsYO6JRLzA9 SqBGD60iSJlMSQ0pKtXAjPSL1Xub+j+rfBqys4Rrxw6f4okvEd6P2kj2hdjQtW6FbYBAqi F6A+igxig60cAG8GYi7P9ZbWPGtMApc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660267758; 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=jDF7dMpuWYOG8UKbkC4L3SFnWIZkMKf/Zh805z9oCHM=; b=r3/g5Y1IkvunsKxi8pAyJ5G2uXfGW+su2Ii0xn9xrUdMpLX+BRqkJ6Cat5bomP0Vy76I9h Fd9gJuacrwJJb9X/kX0FfJZq6AfrWvAW0dGMJ7dnSACnb6aasvSD3mTWE3NuSJKhRAKRGW kmAi9sbAmgXDt3OzpG2z5oUzWDzdWjI= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Y3m0BXoc; spf=pass (imf05.hostedemail.com: domain of 37az1YgcKCDwxmiccdcemmejc.amkjglsv-kkitYai.mpe@flex--zokeefe.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=37az1YgcKCDwxmiccdcemmejc.amkjglsv-kkitYai.mpe@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Stat-Signature: dnzduz76qxkst1t8brsgs4j6g8eybdpy X-Rspamd-Queue-Id: 5C9B5100049 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=Y3m0BXoc; spf=pass (imf05.hostedemail.com: domain of 37az1YgcKCDwxmiccdcemmejc.amkjglsv-kkitYai.mpe@flex--zokeefe.bounces.google.com designates 209.85.215.201 as permitted sender) smtp.mailfrom=37az1YgcKCDwxmiccdcemmejc.amkjglsv-kkitYai.mpe@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1660267758-462528 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 f89c60ef8382..5710c4f4925f 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2173,7 +2173,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