From patchwork Thu Sep 22 22:40:40 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: 12985907 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 4E99BC6FA8B for ; Thu, 22 Sep 2022 22:40:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D92D94000C; Thu, 22 Sep 2022 18:40:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 78827940007; Thu, 22 Sep 2022 18:40:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6036D94000C; Thu, 22 Sep 2022 18:40:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 4A522940007 for ; Thu, 22 Sep 2022 18:40:57 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 229A01C6717 for ; Thu, 22 Sep 2022 22:40:57 +0000 (UTC) X-FDA: 79941192954.29.538EF49 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) by imf22.hostedemail.com (Postfix) with ESMTP id CDD82C0005 for ; Thu, 22 Sep 2022 22:40:56 +0000 (UTC) Received: by mail-pl1-f201.google.com with SMTP id m10-20020a170902db0a00b001789bd49db9so6912710plx.23 for ; Thu, 22 Sep 2022 15:40:56 -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:subject:date; bh=MBOpi+V30VyxTJAocMNniALW6MRkylbw2LBwu6hBIIE=; b=oCIFKiW4OUoQtrTsXOTzbEwKVNj3saFB85MgUqa9cFr48OmpsyR1spCbGGEqcyYPFG 7YEMwrHdx3zwZ8hqx0g8fa+21utbCxsG/YoS645+NA4dDCrwoFB9tEJsfDHbYgveDgqQ CnqIbfysHBPRpIzSkkWe/59LIuau6cZPk0i2Hc0QmysIZbmcJMqYfOpfg4DZvb+jlsKL KkolsrymESXvFV3oLZXN6pBwGXgg3wdGK5tW//5Z5FtbMefTOJ1uzPjxGdxOmdjRdcV8 CMyAribGVqeaxHtoSIlpa4HGiBt592UTr0/CmDONCJ1n1a4YWfJu7f6toC9EHRYOO74w 9BYQ== 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:subject:date; bh=MBOpi+V30VyxTJAocMNniALW6MRkylbw2LBwu6hBIIE=; b=CJ1AyUNpXli27IZ0FwJGCA61+ECGPYrxsseYI0DrHc5O4gu3JNwsnaEnQsXbPToRqZ 5ZcHjSB/uUWPolIT/AW1Kz8on/S0WYdg91QDrBMa48RydfsSNwanGFBr+u7WFhYOgIG6 AQlBEWTKSlgxy/KUXOYPVDQi2zkNX7Q9qelBcND2F37haTvrgCfLhqobNvxrYIfWVqYV UmrK/Kx953eZUIwcXDSkZHHkAmPQynzMygI2YQVOYH8gswgw0QLpi8KP2+iV2EIywDmh RjQEK8r8aPiOeTBLIZVCDPjE9HE4mBBll7PwPqDfFeBLtu1yrF9zQq2ETRlkibYl9dzq iBeg== X-Gm-Message-State: ACrzQf2IPxXSw45HWlmqgWh/scr+JfVGwflMnv5SxI6lt5z97GZ82/F2 VKChvAZeGp17eYMKKvdgNqgPr0YQWd05 X-Google-Smtp-Source: AMsMyM4jj4v1oLXtfd10ojhtj3GOdmWxKUkaFwe9xELneMFuZPFD1yJUHeS6uz/V1MAyM3E0xOLKc9miAq6L X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a05:6a00:17a1:b0:542:be09:7b23 with SMTP id s33-20020a056a0017a100b00542be097b23mr5939804pfg.12.1663886455880; Thu, 22 Sep 2022 15:40:55 -0700 (PDT) Date: Thu, 22 Sep 2022 15:40:40 -0700 In-Reply-To: <20220922224046.1143204-1-zokeefe@google.com> Mime-Version: 1.0 References: <20220922224046.1143204-1-zokeefe@google.com> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog Message-ID: <20220922224046.1143204-5-zokeefe@google.com> Subject: [PATCH mm-unstable v4 04/10] mm/khugepaged: add tracepoint to hpage_collapse_scan_file() From: "Zach O'Keefe" To: Andrew Morton Cc: linux-mm@kvack.org, 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663886456; a=rsa-sha256; cv=none; b=HQ91KrHn0wIxuJF6PraMxwO4uuBomMWEmoRRbBIB5mdUUOSGQRSFLl4wN2o8NaZ7OWTEse LHApFncOTla48fW1EMKN02inzeD/CEvugBV/OvRVka3THZboSVV/zQyf5NS0sRM6fZN3dw IRfRESUFWsm7fl03LyHJrYb0L3vRiHU= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=oCIFKiW4; spf=pass (imf22.hostedemail.com: domain of 3d-QsYwcKCBQJ84yyzy08805y.w86527EH-664Fuw4.8B0@flex--zokeefe.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=3d-QsYwcKCBQJ84yyzy08805y.w86527EH-664Fuw4.8B0@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=1663886456; 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=MBOpi+V30VyxTJAocMNniALW6MRkylbw2LBwu6hBIIE=; b=WUlFD+2pHlUe0FsPnhHax/jxP9L+tE6fpDBVgP0BOcVGvJ8n6Wan9y3SUxrnYnti1K+WAw dOCHGZ1WNHxKdnmoPJZqv2BbsFCb8Zf4J/fAqJbw9GBqgER41rRzryUWy0+xiPGJ3J95nl Wq1rF/dUtj2HwZaoDX5WyrYkgdtOBSY= X-Stat-Signature: df4saj9z4qpbpe7k468cyujccqbkjdpn X-Rspamd-Queue-Id: CDD82C0005 X-Rspam-User: X-Rspamd-Server: rspam08 Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=oCIFKiW4; spf=pass (imf22.hostedemail.com: domain of 3d-QsYwcKCBQJ84yyzy08805y.w86527EH-664Fuw4.8B0@flex--zokeefe.bounces.google.com designates 209.85.214.201 as permitted sender) smtp.mailfrom=3d-QsYwcKCBQJ84yyzy08805y.w86527EH-664Fuw4.8B0@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1663886456-91762 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. Link: https://lkml.kernel.org/r/20220907144521.3115321-5-zokeefe@google.com Signed-off-by: Zach O'Keefe Reviewed-by: Yang Shi Cc: Axel Rasmussen Cc: Chris Kennelly Cc: David Hildenbrand Cc: David Rientjes Cc: Hugh Dickins Cc: James Houghton Cc: "Kirill A. Shutemov" Cc: Matthew Wilcox Cc: Miaohe Lin Cc: Minchan Kim Cc: Pasha Tatashin Cc: Peter Xu Cc: Rongwei Wang Cc: SeongJae Park Cc: Song Liu Cc: Vlastimil Babka --- 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 df33453b70fc..935af4947917 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 a272fc065dd7..6d2dfd96608a 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2159,7 +2159,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