From patchwork Wed Sep 7 14:45:15 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: 12969073 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 55F49C54EE9 for ; Wed, 7 Sep 2022 14:45:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D4C46B0078; Wed, 7 Sep 2022 10:45:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 283508D0001; Wed, 7 Sep 2022 10:45:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08A816B007D; Wed, 7 Sep 2022 10:45:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id ED9776B0078 for ; Wed, 7 Sep 2022 10:45:42 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CADB81C7474 for ; Wed, 7 Sep 2022 14:45:42 +0000 (UTC) X-FDA: 79885563324.04.1984E7C Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf21.hostedemail.com (Postfix) with ESMTP id 69DD61C0082 for ; Wed, 7 Sep 2022 14:45:42 +0000 (UTC) Received: by mail-pl1-f202.google.com with SMTP id o14-20020a170902d4ce00b00176b795c623so5095809plg.13 for ; Wed, 07 Sep 2022 07:45:42 -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=IipW9wJLhoaQM8RoLqkPizpPvc0vhUndK21L4oCs0Ys=; b=bfSyJF4wDhiW4pzRU/9m+TH6Beqq8Xf2702aof6FOKeCB6TReNQvra17hBIB505R5p cDedDK5QoByJHBKRt/xLuFbjrixS/92boQmikZSk+s8aDslt4l6XRaXRdsybhKyHFy5G o7+bAI95G5a7nS9qZ3p9HaI/yZRCpA9nVhMl41fKsyCbo8CF2EIgEmuwUINPrz1t1Gur 6kggTnXfqM8zmmT60T+GBPUG4QdpSSONROXNMnQsoSzH5in3RKefhuy9Z0FyvgKXlB4A 9vgn4EdcyUb66isFFBEN/AESOUMJbf5mdp/dSk5MrVglNMORROVJFHPeAPru8TK7CXXW FY+g== 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=IipW9wJLhoaQM8RoLqkPizpPvc0vhUndK21L4oCs0Ys=; b=HZsI84//lnC7CfTCsKlY91JbGiLJHr/oSRavE7Hcy2xq+utzcHnB82dMsXeVU7lYtM S+TbFAcM49oqThSyZyaNAJ5l2YjGb7l1iAVnwjsUzVs5aMX5pEuXP92gY2YFh+cA59sV oIMKwKZ66RXIaXq0BZWXLfrGPjYDuxohNbuV1+KpSMLduugtwUrD33l3AlFcKx/oh5Iw UE8mkvayVpkd3+BZ50t5CUNjKB9zf7ikuJEKfK4sAbrYu58D9dPjOr06Qj5hhf+CoCi9 SBQSKhIZKf/GuAA/9aFMG9VXrqsdUmrp5vR1WhaEfSHWa+T3YDgdZu97aImm+aNGcEY7 Ar4A== X-Gm-Message-State: ACgBeo11gJPjN0oVtlEqKCwAFkcm+fKB0iUYWPx9juD4iIzLKgRi/4ry QQjxf8L6uvhirEOPAaoPzIPxiL0fxV3hj1k47c5Tdx7mQlY9dPluHPb1nH/WDw5RuKGhQftPo68 q4YNtEfvj9g3fyUfrebNRteUQPSQ06jqCw5+GcNGc/GF0h+BcEWQpqV+AyUo= X-Google-Smtp-Source: AA6agR5Srjteij5eEYwwNdglpqDjiZvvqDhsGDYSz5TD9OcblGDRJDujZI50XIbAXxdnGIVGwxCRZHvOkYAB X-Received: from zokeefe3.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1b6]) (user=zokeefe job=sendgmr) by 2002:a17:902:f64f:b0:172:a790:320a with SMTP id m15-20020a170902f64f00b00172a790320amr4263311plg.149.1662561941434; Wed, 07 Sep 2022 07:45:41 -0700 (PDT) Date: Wed, 7 Sep 2022 07:45:15 -0700 In-Reply-To: <20220907144521.3115321-1-zokeefe@google.com> Mime-Version: 1.0 References: <20220907144521.3115321-1-zokeefe@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220907144521.3115321-5-zokeefe@google.com> Subject: [PATCH mm-unstable v3 04/10] 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-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=bfSyJF4w; spf=pass (imf21.hostedemail.com: domain of 3la4YYwcKCHQrgcWWXWYggYdW.Ugedafmp-eecnSUc.gjY@flex--zokeefe.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3la4YYwcKCHQrgcWWXWYggYdW.Ugedafmp-eecnSUc.gjY@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662561942; a=rsa-sha256; cv=none; b=c6VUD3DjebQa7Ckj5lzdFniidcgcND6NW1+3S9SNRWzqT05tt4mb7Bj+nYUDbVWGRIeqGe WJ46JEMBxDrACbUjMbtRcRVvlm0cAonYgFB2g1lV4YYrAf6SYWUCo0rL9XQPH6Eofy/kY+ xRnaQ8MqWkGTDPJuOdmnnlIcrl/JBUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662561942; 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=IipW9wJLhoaQM8RoLqkPizpPvc0vhUndK21L4oCs0Ys=; b=nb8VYMUIA9wz4fShqTg3NOmQSH112Qmr0k8xL2+gAqluSBC1ekdY7UTc8Av4yBBPRz1enc e8ODJugTTZgfpING3m3PAYHEMnKpSTy1FJEnA5pbIUilKuSQJEEiI5V0u8pQ8P404fR/xD ZLskqG5huEteUJG3yQG00y94uzjfKDo= X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 69DD61C0082 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=bfSyJF4w; spf=pass (imf21.hostedemail.com: domain of 3la4YYwcKCHQrgcWWXWYggYdW.Ugedafmp-eecnSUc.gjY@flex--zokeefe.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=3la4YYwcKCHQrgcWWXWYggYdW.Ugedafmp-eecnSUc.gjY@flex--zokeefe.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Stat-Signature: y117rhqwohg9d874wsirwkymnwcnhe1d X-HE-Tag: 1662561942-663591 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 Reviewed-by: Yang Shi --- 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 66457a06b4e7..9325aec25abc 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -2152,7 +2152,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