From patchwork Fri Jan 5 01:36:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bixuan Cui X-Patchwork-Id: 185188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5969740dyb; Thu, 4 Jan 2024 17:37:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGyBBSlgRj3CbjBSYVDN3o+6jw5TUi+QRRR3rv9oyu0Mw105E9uBy4G7toHqFP0dp/0omMW X-Received: by 2002:a17:90a:728b:b0:28b:db13:e9f7 with SMTP id e11-20020a17090a728b00b0028bdb13e9f7mr1203828pjg.31.1704418642827; Thu, 04 Jan 2024 17:37:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704418642; cv=pass; d=google.com; s=arc-20160816; b=j+2dCbL8OWolNxM31Ka3/8Z4KzawfoXioXDEhOLF+uMGXQmuyNFBiEO88j4g+o8Aca aJdDzNs5/3iREDwSQ/i47F2dN13y/NIQWChtrzGnCsFvNihd9kWfCMgBRMtugfcPD/bC 3NZJGU7ZMzw6BpgiY17gtbOZF3j7Dgi+mEhSI4jcjDnulHYclUsH6wqNZPp83+GOuaQi +5Tivc3jUhApC/qgYCXtPp0kyIuVjLi2O4sdJ1yi1/ZkVxDCnV4LBw243HDVYvOo5a7+ UixTTATF9CHo52L69ofhuD4T1WAXZ0y3XvCA3XAj6whDNTKfo+ZIwYlqK3B8D+Zqpfeq 1dwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/+HFuVXQet26qI0PvwZToEYKyK1hQvB+fF6C3EU4waA=; fh=2HSsn4N1CERFiGILG69mO9UenZHX2CPN9NVZTN2/rP4=; b=HD9aNsRUMP6xWBWFm6YhOhFTCjSpW4+RKgzi2I0mWkIjcnINS0WD9foH7td4zqSaaF HW59J7Q7FZjELdhAQkV12IfSQ65msyxNuzG+pgDdvR7t9S0iM2+FsRIsykKmB/qaekw2 wOv1ba3NE28NBzhQJejuVQTzNT5gBoTx5dxGQvwKfG7GOQLMVodRKvJOnAsVWjcbe6fq CIDXUBlIvQl++gqzWK3gri/Yfn8SF9ib1kTNbPmMnDXRIfRRXdy6p6i2aIVEkyUe2ks2 8Ppm6Hp+BwOHYLc3nwjZzBxCnLLV181UBMwTqu8dXMbiZkuG8WPSW1pZxa1xokVA+K1X mGZg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=ewSH2B4m; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel+bounces-17393-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17393-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y21-20020a17090aa41500b0028c8c48904esi3775142pjp.92.2024.01.04.17.37.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 17:37:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17393-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=ewSH2B4m; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel+bounces-17393-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17393-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9212E28669F for ; Fri, 5 Jan 2024 01:37:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 482D463AF; Fri, 5 Jan 2024 01:36:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="ewSH2B4m" X-Original-To: linux-kernel@vger.kernel.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2130.outbound.protection.outlook.com [40.107.117.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4574442C; Fri, 5 Jan 2024 01:36:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y08zRpsr+D9yVLbQgyWacusfOpeGjRAOF06dIwvBMmF0RzMWxsYCBrVuaYPuaAVjMsAj8cw+0YBGReu/6TPIe/WtaDsEc0SAr/o1lo2R+YMFSTTzuhx2yWv+SCyvT8grqgVVDr3vUcATVBx3nMy7Uz+MECV6NIFcNbdqpAUHY1c+Aqq7PIalxWCuevQQkINR4emaS6TSbHRYHLXEiXEUfcg2YNXwvYqA+EVQk5ZeFP+O0gjAqcB9YgStP4kpt7SwKTQ1j0pXeiUG4WV5WlS10pysHZGnESvZmCioFXdMHzk8hU/GI/dVl2iOnXYXLIMmkeOEob0XA0P9cf2nzCn1nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/+HFuVXQet26qI0PvwZToEYKyK1hQvB+fF6C3EU4waA=; b=fnn/+BLo0c5Xs2vGVRCQ1cW6WWGIVYVuM5yrVQbwWFnh6vz9rP4iBgELOgDfc82bz7IweI28rt4tCSHpMC0fcF/vzRH5+sBtvKHcjrU9f3KGxW3p0nrWUqnQ//V5gPzzNRdCZPlyUMZbOUikWy0/amY4kRrUdqNFVT4Apt2pae9ASu/VoHvpmkGZz1EcddLKIHgsV/WdRHjA1dERtBf9bhI+1uPG6Xo1GJMeZpdY+qChlP94ElFm15Af6Surjj14g2fYtuXYFiuSf+Ia1//2eJRttGuUVYeldpGCC2zqqwLdWY9U2vLGVrtcTKGFlCwD1IP056LW/1OpPLelv8Xi2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/+HFuVXQet26qI0PvwZToEYKyK1hQvB+fF6C3EU4waA=; b=ewSH2B4mjiR/8qBsjVwOxmZfUiYLyok9KqW5wa94fIk/tNCtl10BQQJl9kZWX9thdBcT55NzUz6oyibMiJlLdrwY4qC3Ffv060yJv24s998FNg8EQJ7D8JlGQdQboLNeqJc/kYXcqyYt8N0mg8cfMokwLH1mQ54iVreTt8cUXGGOrhAfBE5JENqL9OhVBB1aZHRHTZW6OxlnyIdqD+GkxiBLib48KrH3jYxt5nKBjPzoM5YO5UoQp40zob6GGOErNnXICgPcKtbaZ6G/6v0U+oDLyDvxPqXi6gh+PP0nXfVj2s1pCU/FFkHabkheqE+CE0G76zZphWH3vT3D4Q0zEQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB4045.apcprd06.prod.outlook.com (2603:1096:400:21::8) by PSAPR06MB4488.apcprd06.prod.outlook.com (2603:1096:301:81::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.16; Fri, 5 Jan 2024 01:36:42 +0000 Received: from TYZPR06MB4045.apcprd06.prod.outlook.com ([fe80::9925:32d7:c818:3c5]) by TYZPR06MB4045.apcprd06.prod.outlook.com ([fe80::9925:32d7:c818:3c5%7]) with mapi id 15.20.7159.015; Fri, 5 Jan 2024 01:36:42 +0000 From: Bixuan Cui To: akpm@linux-foundation.org, rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, opensource.kernel@vivo.com, cuibixuan@vivo.com Subject: [PATCH -next v6 1/2] mm: shrinker: add new event to trace shrink count Date: Thu, 4 Jan 2024 17:36:06 -0800 Message-Id: <20240105013607.2868-2-cuibixuan@vivo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240105013607.2868-1-cuibixuan@vivo.com> References: <20240105013607.2868-1-cuibixuan@vivo.com> X-ClientProxiedBy: SG2PR04CA0169.apcprd04.prod.outlook.com (2603:1096:4::31) To TYZPR06MB4045.apcprd06.prod.outlook.com (2603:1096:400:21::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB4045:EE_|PSAPR06MB4488:EE_ X-MS-Office365-Filtering-Correlation-Id: 93c84b2f-a06c-4b1a-4d20-08dc0d8ec4d2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: W5ib7TSsf151qQdLjOkJH69RCLYWSJKalN8XkBvzYJqabALlDWwPaeWmQyu9suc7bU11RlSlrCYC1k4SKy9zLezW0rYRHYd+FGpnSeaijCSgkggMyLu5TalHjUY1fqZdvdXtBRQxWd2g6U86FrbX1saRAJLA02YJMROZv8mLxB6AztWe+S3lNbaKLhQ1ONi0J999OwqLjQi6segjG2iCc24fsXaWZJGGkCSGhoMzcQy1SEYm6ktVy+M3wUzO+Jx/WHXJaKW78Ny0wrYnVPa1KHqyGZHrA6ojwF++N1ooINRO7Lo/2sTscaN1wyIsyu0dxXbEmpsBGxlgJW4jFyIOCSun1L4iIETCyPVNAi6NE2Ssz5XeflGGbJljoDh4yGDQspAU1bXWMLuygILmegma4LG6STrinMLhlJSpQfV/qXFIRBXVTNk/A2bD0SrSj7wPYhl0h9/b2KwGgn+8G4TlMFEdwCnqzIvBJM4tNidf3XVATC1/6dOatNY9nKx99t47+wuX+Alkku98KPfzrR9/nj51jeeW8pf/D8bY7WFl6DsN08AVNojYBWe2R+WcgHo1ZEhdNypitTgG19igNFszpZkXHoPQKk5RYNCATiL+urt5G1qcbvc2rt+SzTFOKeKk X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB4045.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(396003)(376002)(39850400004)(346002)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(52116002)(26005)(1076003)(6666004)(6486002)(478600001)(6512007)(6506007)(2616005)(83380400001)(107886003)(5660300002)(2906002)(41300700001)(66556008)(316002)(8676002)(8936002)(66476007)(4326008)(38350700005)(66946007)(38100700002)(40140700001)(36756003)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9nylH50KXxLXXrOTmteQIVeZhlXKHBJ8VqDr4Nh6wlaMi8Lj0s0Bwo1jAmPmIuBuPvG+xTMk6eZxSYpDXOBRYyrGOTjphVvqwf58rc5nvN0Xh5YzCw+OSD3o+PdTEYzI4CQ8Mvzn7PSDWg9d8Lnm0b0VWbExi9BlBTLXTH9UZ2YBKRpsvA3il6gtcI6aClZOL7wpOkPyAKHKSjjn5br0tWjMrTpoMeV2h2KDN3eEfvGU/4w54mcMaXtkC4bSyqmBmq4AOVL7SAiAf3Ds3AJl/GoCvCkZWa5SU4NEOeQknT+ZUEtO1Wf580rXxqaZpueYfTwL++AEn3VTzTwEkvzA4D0YPdiOWqQiTIQouHVObF2NkZoRq/iBHFQ/l9xmkO6iLg0u8JwkUwPqmvmnHWa/QDpFasih8LYhCIcPCuvwcU9d8Z60thbh4d72s+Kqo7Z0ZSQLAQqvHHbt48QskqdO2rzvrslcYv98IRULEj4LFqiCJedSW4MFYJV43D84VmbRdx3FVhcTzVAKJH5jBgbaWNvp53BLkp8ctvIFbDoNwLD0WnYPWoXzVlugLtZmVkAQvOlLJrPIiw0x1vf7l1AWt0uwCIpP+V2eCazqirfkQ4qccumdkDy3ZfceQklI0vIDOWsL9H3rjDJb7k7O0OFU8ONWb/DGOcu7gfTP7IE/fRWB4zH0pRdoqaCmEBM6nAMHY0+4Ag2f7k/CxrC6Aq0eXvE4QLGSwRhqApRkHAO3mbxj2T6vAX8oaovm96RsYkFlDvbezV6C7gyVwpz7Y9joi9BOCbJdHoxJz/6SkKVaqrsifVDBGTT0tw7Gutl026zISW4f5hZBR5iBiXvWa+MDOsmiH8028oecOK840q8NkUzFdhMEdQ1t13ufSYQZNY+UbYGiwchJGPp3VTzMVo+qoHZj5PbcS5OjWOUDPCaOwyGHAtbiY+X4MYhmXZ7AGiR5y9YNxWdSulNm0AM+PV9HhA5Xk/MaFIrUhyKG/g6WORm2YuGHTeZq71JxpMxpT86PxxXBR85x1ZqdxQMTr6/C1VEsgnolvSWge63JYDwpG6v8hzGqlntjLTTXaI2MjbgUrcTi18OmG5f5dvLQkhCUfEwTqZWb/qrG3pxGsnEAOMG5iXoekW0XAsNmmPLdhVT1hFLf/EShpxiL2ESr5vctcX3V/LIH/gqFJ/S00VCvrZQKOZVodO922srh2PuMmvHdZSiLqmEL1CW5xmUQGOk/8F2osK6iKPO1vNfo+g8jKRuSHOlHRQakg+ANGkr60cUe4iiVRINtFjAng/koOxC/dmqL/C3qky2GljSxd+T7cZ4R+VBU0UvdBBdOmpbHvIdgPDWyoPMCF0vo443FgWT6o5w8aBYVUQBLMxFxcn0Qnhpi3HKoYiv4Yk4dUX03sRzDMEDlmQFoUyRC2rNVAcNg+vKBEXKqh9g/yzwkW7t0YuNZVfg756cXkqDRo9csReQMlBFfV7QpPl2322JR69S0VNC9kM79D4byLZXdx+wNQmlkOBWnuRd9WkIKYqSfmFmkVcpzXsYrd0JnAV2/9/MP7/Y/n5JC/WmW4mvSOK5+zSsB5tAeJ6OpQcNTMmbsT4OK X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93c84b2f-a06c-4b1a-4d20-08dc0d8ec4d2 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB4045.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2024 01:36:41.9742 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eQGGnHYvTsxk2ouB6qlH6tOf+tA5pYbqSlBbCrZax6ahRrvJ7fweyl/z+4wHfjCGhpJkFPqAL2KcUSFX2CrxlQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR06MB4488 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787212482838691443 X-GMAIL-MSGID: 1787212482838691443 From: cuibixuan do_shrink_slab() calculates the freeable memory through shrinker->count_objects(), and then reclaims the memory through shrinker->scan_objects(). When reclaiming memory, shrinker->count_objects() takes a certain amount of time: Fun spend(us) ext4_es_count 4302 ext4_es_scan 12 super_cache_count 4195 super_cache_scan 2103 Therefore, adding the trace event to count_objects() can more accurately obtain the time taken for slab memory recycling. Example of output: kswapd0-103 [003] ..... 1098.317942: mm_shrink_count_start: kfree_rcu_shrink_count.cfi_jt+0x0/0x8 00000000c540ff51: nid: 0 kswapd0-103 [003] ..... 1098.317951: mm_shrink_count_end: kfree_rcu_shrink_count.cfi_jt+0x0/0x8 00000000c540ff51: nid: 0 freeable:36 Signed-off-by: Bixuan Cui Reviewed-by: Steven Rostedt (Google) --- Changes: v6: * Add Reviewed-by from Steven Rostedt. v5: * Use 'DECLARE_EVENT_CLASS(mm_vmscan_lru_shrink_start_template' to replace 'RACE_EVENT(mm_vmscan_lru_shrink_inactive/active_start' * Add the explanation for adding new shrink lru events into 'mm: vmscan: add new event to trace shrink lru' v4: * Add Reviewed-by and Changlog to every patch. v3: * Swap the positions of 'nid' and 'freeable' to prevent the hole in the trace event. v2: * Modify trace_mm_vmscan_lru_shrink_inactive() in evict_folios() at the same time to fix build error (Andrew pointed out). include/trace/events/vmscan.h | 49 +++++++++++++++++++++++++++++++++++ mm/shrinker.c | 4 +++ 2 files changed, 53 insertions(+) diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h index 1a488c30afa5..b99cd28c9815 100644 --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h @@ -196,6 +196,55 @@ DEFINE_EVENT(mm_vmscan_direct_reclaim_end_template, mm_vmscan_memcg_softlimit_re ); #endif /* CONFIG_MEMCG */ +TRACE_EVENT(mm_shrink_count_start, + TP_PROTO(struct shrinker *shr, struct shrink_control *sc), + + TP_ARGS(shr, sc), + + TP_STRUCT__entry( + __field(struct shrinker *, shr) + __field(void *, shrink) + __field(int, nid) + ), + + TP_fast_assign( + __entry->shr = shr; + __entry->shrink = shr->count_objects; + __entry->nid = sc->nid; + ), + + TP_printk("%pS %p: nid: %d", + __entry->shrink, + __entry->shr, + __entry->nid) +); + +TRACE_EVENT(mm_shrink_count_end, + TP_PROTO(struct shrinker *shr, struct shrink_control *sc, long freeable), + + TP_ARGS(shr, sc, freeable), + + TP_STRUCT__entry( + __field(struct shrinker *, shr) + __field(void *, shrink) + __field(long, freeable) + __field(int, nid) + ), + + TP_fast_assign( + __entry->shr = shr; + __entry->shrink = shr->count_objects; + __entry->freeable = freeable; + __entry->nid = sc->nid; + ), + + TP_printk("%pS %p: nid: %d freeable:%ld", + __entry->shrink, + __entry->shr, + __entry->nid, + __entry->freeable) +); + TRACE_EVENT(mm_shrink_slab_start, TP_PROTO(struct shrinker *shr, struct shrink_control *sc, long nr_objects_to_shrink, unsigned long cache_items, diff --git a/mm/shrinker.c b/mm/shrinker.c index dd91eab43ed3..d0c7bf61db61 100644 --- a/mm/shrinker.c +++ b/mm/shrinker.c @@ -379,7 +379,11 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, : SHRINK_BATCH; long scanned = 0, next_deferred; + trace_mm_shrink_count_start(shrinker, shrinkctl); + freeable = shrinker->count_objects(shrinker, shrinkctl); + + trace_mm_shrink_count_end(shrinker, shrinkctl, freeable); if (freeable == 0 || freeable == SHRINK_EMPTY) return freeable; From patchwork Fri Jan 5 01:36:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bixuan Cui X-Patchwork-Id: 185189 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp5969815dyb; Thu, 4 Jan 2024 17:37:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8BzywBvBdloat4beHZ1tXigPy+dTuh5/ln9c4cB+jBjASD/FYo3IGN3+CaaTKCaHrlF8/ X-Received: by 2002:a05:6402:30b2:b0:557:c42:977 with SMTP id df18-20020a05640230b200b005570c420977mr1294383edb.1.1704418654874; Thu, 04 Jan 2024 17:37:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704418654; cv=pass; d=google.com; s=arc-20160816; b=QIn+kKX0YfhQ94IcMjlBeZ6lkZs8YvlRo1E3ClrHxwPOasN0xjdJYW4SYr+MKIxA14 Qwvjm51a9B8Nu4zSthjoMGQm1JzQPqlkl0Bf8KMiloajGVdh2dgQn922KOfnuRal04ol QsqfrwqWFkdFNjfPmK6q+C41jCWSo+KPnnnYsxecnnA/6v5ghlZfSS0HbZydL33uAtmd BgDOhR2lHsgL72EgkQtf/SdjmGRybuJwfC4WYoirUgQr7cILJOMxhDBGBjFVL8FPl0DX fc78sF5z++WGe8BpD+gs9iHXvf9FqUkXWcqzGOl5j2ir7MMBOe1iNebnZllEAPme+XRg XjaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hf2c4QchU4YbB25u2sqDyI9eKLm7nDzoutilL6L5Rhc=; fh=2HSsn4N1CERFiGILG69mO9UenZHX2CPN9NVZTN2/rP4=; b=nkBRHY6I7Q4h5UD1DR3eHjf5ddx4xjmTk5Hp9tcnv0Zk2apvldZKSFbpRQ0Xk2hBMx 7rslfDoU/fj+x/ISZAqILHzU31bOlfDXVeA372z8e7FyxFe6ZyNr4niL+Ve2IEdZ7DaV Ak1jMSzeD3mVhc/uyUMv9A4SGUbUX/P0Y9CQRo12hIkhfJSa3xct2kqIeWT1TDW0uK3D OXyRQT9gHTMuYcf7YOFMZkeoDNNP74LMH/rWW0BTvRUBKU05Q52RxDIkHvGlvNCvKpEu 9zRRiB/JKpUcX/w6tMR4nbE22bf3lvJ1AODhA/e7+zAxUbK1zmMkpZzmu5tYiX7Lld0a dQhQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=bvxw5ABN; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel+bounces-17394-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17394-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id if4-20020a0564025d8400b0055650783ac6si244816edb.277.2024.01.04.17.37.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 17:37:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-17394-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=bvxw5ABN; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel+bounces-17394-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-17394-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4C9F21F22AC0 for ; Fri, 5 Jan 2024 01:37:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36ADBC2CA; Fri, 5 Jan 2024 01:36:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="bvxw5ABN" X-Original-To: linux-kernel@vger.kernel.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2130.outbound.protection.outlook.com [40.107.117.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 77011523E; Fri, 5 Jan 2024 01:36:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ENu5Rj7SbIGDQ4jftH5BGf1apxZOi+jkY6xNXm7QuihIXGqEaOXdsN2x6HUU+rmq4+465yCOrGYqQsBDU5+37mSSEi2eC9xTDaGCbrEg/DghB3R6LTDA66/ZgG4qTkHjYtG59Ul8v4x1BdMPJUlrXZ7mp6qN3qoZkd4DbqrCSZaL4NgFKZOUcloxcoZgl4QnjcxFM/KqRUiS7/JWKM8ImOWwH+n6Yt8BTn727zU5ItGrZKDuo7oPKvzQZ5wIMDqYaEIRWRXNuvIxyOE7dr5ANwP59puHPi7Sszkr0YRce7r8okxqdfiEtkPHR8DgwHW1yDfiVkzSH8voYDdXEKc/pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=hf2c4QchU4YbB25u2sqDyI9eKLm7nDzoutilL6L5Rhc=; b=YGGKyJsIpjsq1KpdItX7iogMfY7P/KFBU1WbuK0URqOHldnEJIPMuVPGvWH+qB7t8vVJITIttzEgEAYm++uRBMHzvMlcT0tMdIRM/g/1OY8D+22DrqFo02i8mZ5QvKSOH5H4LkZoJ3cMEGa+/wWjZrF7j5coCbfaH8UT6m2kMrJZcwzqA5eWB+g7wwI5NWbW11TVti1Fxc/V2eMz3NdvAGBPEcvtuF+qs/Ee55GDmy41ak0o186mXfM97m1W88aPjQsmVAnzx7p/Ry/mSElUCzhE7wSdpjpm3YQPAF8dOTso9rZicb8LNR2+n4tbeiiFmNpX9QCxjArCLvF/3+Bkrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hf2c4QchU4YbB25u2sqDyI9eKLm7nDzoutilL6L5Rhc=; b=bvxw5ABN8nOb5hx6KxJ0olyjJhRwUTLpPpD9FkSxKZOCbYO2aL4Y7266nzbrGhaJrsP6mhZn1Fg2HKJyU7fmkJ0A8t0I8XorSqdK9Fk0FzqdlwzGpGUgR3ynlkElIKRUoiqDxrwNqTo72ZkaypOXliGxRhUqcPy3Lgy/4tafDqzq5IzKWhXlS40YSPODFqSnPNpL4X2gmATMZ+N2tNSqMGmzAZOpvzaE+1ehUv8qdryLhLVPuRsTDmAjDWcY8TV/qVQ10Wi3yE09TTBEvRf02rR92tco6+YfZpcVv34bt16x2WAMpfk6wIGdciK7ZelcK7cZBvsQntK1iNfM3xGAtQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB4045.apcprd06.prod.outlook.com (2603:1096:400:21::8) by PSAPR06MB4488.apcprd06.prod.outlook.com (2603:1096:301:81::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.16; Fri, 5 Jan 2024 01:36:46 +0000 Received: from TYZPR06MB4045.apcprd06.prod.outlook.com ([fe80::9925:32d7:c818:3c5]) by TYZPR06MB4045.apcprd06.prod.outlook.com ([fe80::9925:32d7:c818:3c5%7]) with mapi id 15.20.7159.015; Fri, 5 Jan 2024 01:36:46 +0000 From: Bixuan Cui To: akpm@linux-foundation.org, rostedt@goodmis.org, mhiramat@kernel.org, mathieu.desnoyers@efficios.com Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, opensource.kernel@vivo.com, cuibixuan@vivo.com Subject: [PATCH -next v6 2/2] mm: vmscan: add new event to trace shrink lru Date: Thu, 4 Jan 2024 17:36:07 -0800 Message-Id: <20240105013607.2868-3-cuibixuan@vivo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240105013607.2868-1-cuibixuan@vivo.com> References: <20240105013607.2868-1-cuibixuan@vivo.com> X-ClientProxiedBy: SG2PR04CA0169.apcprd04.prod.outlook.com (2603:1096:4::31) To TYZPR06MB4045.apcprd06.prod.outlook.com (2603:1096:400:21::8) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB4045:EE_|PSAPR06MB4488:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b17d349-03dc-44a0-0ffb-08dc0d8ec737 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s1TieorddW6c14F0tpenRUzRD5ZGDnVlnhvA7S9mVthShH1M4/evgphjMGSsgfk95nqmEG07qml+bRlk9V7I+lbaK9h/EB1vdVs4um8LmLI8GQpfPMRdERHdGRg97Jh9aY5AydG4ZonzMqqAiiK9VpXRT5vsdnH7sFXvhuCihKW8mxSbGQDgzM8pk3nni6HPo+cslf12iWda5F9Ok3IwtHCGtC3KJjLilyLUscUO+30eYsAcHpdgqtUeiGawlSUiVvyDwNHPwo1vFX2ryPLH6RKNEJBQm6oLOBaeL51NkOX4t8rKQy2BhHz7w0uE6bx0AdwD3VXYwzXyJQCsY6FW7EA0c2/nMi/+K5glg6Gbp7jk5GZBmA4VsVeELADbGvEP1oTk34mjnJ0ZVLwc0tGSsXRdiVbYsEyb8DnsaEVxA456Csh8leSDvRorxEpUDmYHoN9oJh/E6DqSSbJZRt9ZKPrb1Z7N5anRUxiA6iShwc8dYRGKzWNbns/YGrV6Vol5w44pFg51cgNIjiGTsBfnKG9CjKoPutWPnxrRmFkCyzXu13Su1MX05Pd/IhidInZgAJ634rnKCjD3KUlJjuJ9Ruu7xbcWshuFauLL7ZzIG6Jav79ZgKYzwXaTLkQIcpSt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB4045.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(136003)(396003)(376002)(39850400004)(346002)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(52116002)(26005)(1076003)(6666004)(6486002)(478600001)(6512007)(6506007)(2616005)(83380400001)(107886003)(5660300002)(2906002)(41300700001)(66556008)(316002)(8676002)(8936002)(66476007)(4326008)(38350700005)(66946007)(38100700002)(40140700001)(36756003)(86362001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rv8dmPPjuWJ8m1gKvkIMxvbNwqHjw2IzNXEwQ+soK+K0qYo5c+jOE61IDU3ga3BXtQ8PMXRdUp72lmLzl+zBFV7Aw0krZFewCYca8HuN18klEGpTGWWA5OdW2YkAcDSOe4wAqfy5g8qk9y2+ZYou0/yLE7fI7OW/iarWV2LES96i1i80CU56wRHPSDSJS9b9Fhp9iebOds1NL9f9TdYE1QNETfiSSstTyN61RFTDYqdGwYDPCGyMdblMWI4D2lV/kP78c/A83+Wf4YMZ0K0cJXElYEapL4GvtUhId3VIwhCpo0KNFVhEjBOgY63HMq5t528ndfK+iIV/GwOi36AIqXTtE0bsjPNXmTpbcgLojH3swktS9ar5H8juSz0x/7erzfktowV16jkwD61LK5i1DjvG2HCBcn8RRHbpFK+TWnOFcSgxnwM2qq5nIzhmCIBdbuqy4eTsrC5n/L72wX/Fob2Kg1rVuadLxHHD2zTjEr/0d5FDT3OcVO31tqYg7R2RnBJPRyiZAX3yTv250KaqALljMre/N5QjGHUuuGEE2My1xSi+Zccxwvr+73JRtcF9G4U4Jw2NdZW5M58hKamEo5nA+46OjafuiZI6b8kTLEVholMW2weKukE3Q+i0Ufdt5SGXx4IoUaf7GFRzsLfJZl3Dc8PmHQbmd9v60oOol6Umqa06nx6owp9C1nFfIQRKTXbeUunS8ZumVVtlVoHleeMO2hcewgCgzYed4wsE6QBX725nRVLog1obRBDUWCqLvHCkiligc7zC44O9CH9GWM2Rvn6atiXXP/7sgaFFfmcKNLoBzHKbBHiqx/ZnxlT2WSXXfzz8B5toR3WtCkr4tDvomFS0QVxsH4ujz8kS5XVPODLJBsHK07MEgTsaS69v5oATq+ULDC8yGPHRsLQ1dtlRQNhVXvs1oiZWDUPLE0+jIlUwzb3I8VN+jxc++jMBIkMdrEcWwDU9rIRKb0dMsoA6usVq3YAmFK85n4yxEkbauzK0upUWinJ0DeyBm7BoTLoZ3zjohYU5JP2Kv5X4WrBAIJdLM28e6hB+/nIMLVENhKRL1vBQGffSZ1j6SoXEJCsn60rAc5g5HiooZkyX270QFHtXTACyoFuxLrQLkd/+wzeWvUNINHLzeZW/3Q+/qVwb81L+grvLse/1QRBI4AXZjo0gzAVFIdXLmf2ZWBoirHHDwU58U+omQaQ/Iv66evbOc2z2NPCxl9FOYsfvmEBSrMV0640cqZ6XYKSMtghxTWs861OCkbilJGIAiXMtIaqyv2wZty6U8sfQj696ega4nH0GsVHwy4ZlmfQciLpKnBeDD26UfRGOgTyt0zgFqfrVtUK0rHuSf3ldJARopXPJAEcXGCIE9VwexJ+fnQXASTNLUlpJ7wISv6WtrS/tUfOyQYJBw5aZp69S79kuEZweDVNJ11gdvuOsC/Ho2ac+E3OR3G3cXySnSWYlElKWaXNMgqiW0V0WWLziKSabpMwOkKA1FLunEmZ1xfB0NJ0SUNX4hXeWOd8Mfy7v3jzdpYIWdL701b4tH3gpNn0+NbZ8EuZBTd39ItLUE04BBhFgO9b7OrmwlWtv9JpMw6/4 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b17d349-03dc-44a0-0ffb-08dc0d8ec737 X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB4045.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2024 01:36:46.2204 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M0IOWpqV3yeNAPdCoeHqb846WnZ/P90Sbu8dWwOYirBoJTsCXQDVqkegbwClsx8c4sasFDnmLuryMhUMKdS5LQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR06MB4488 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787212495543405559 X-GMAIL-MSGID: 1787212495543405559 From: cuibixuan Page reclaim is an important part of memory reclaim, including: * shrink_active_list(), moves folios from the active LRU to the inactive LRU * shrink_inactive_list(), shrink lru from inactive LRU list Add the new events to calculate the execution time to better evaluate the entire memory recycling ratio. Example of output: kswapd0-103 [007] ..... 1098.353020: mm_vmscan_lru_shrink_active_start: nid=0 kswapd0-103 [007] ..... 1098.353040: mm_vmscan_lru_shrink_active_end: nid=0 nr_taken=32 nr_active=0 nr_deactivated=32 nr_referenced=0 priority=6 flags=RECLAIM_WB_FILE|RECLAIM_WB_ASYNC kswapd0-103 [007] ..... 1098.353040: mm_vmscan_lru_shrink_inactive_start: nid=0 kswapd0-103 [007] ..... 1098.353094: mm_vmscan_lru_shrink_inactive_end: nid=0 nr_scanned=32 nr_reclaimed=0 nr_dirty=0 nr_writeback=0 nr_congested=0 nr_immediate=0 nr_activate_anon=0 nr_activate_file=0 nr_ref_keep=32 nr_unmap_fail=0 priority=6 flags=RECLAIM_WB_ANON|RECLAIM_WB_ASYNC kswapd0-103 [007] ..... 1098.353094: mm_vmscan_lru_shrink_inactive_start: nid=0 kswapd0-103 [007] ..... 1098.353162: mm_vmscan_lru_shrink_inactive_end: nid=0 nr_scanned=32 nr_reclaimed=21 nr_dirty=0 nr_writeback=0 nr_congested=0 nr_immediate=0 nr_activate_anon=0 nr_activate_file=0 nr_ref_keep=11 nr_unmap_fail=0 priority=6 flags=RECLAIM_WB_FILE|RECLAIM_WB_ASYNC Signed-off-by: Bixuan Cui Reviewed-by: Andrew Morton Reviewed-by: Steven Rostedt (Google) --- Changes: v6: * Add Reviewed-by from Steven Rostedt. v5: * Use 'DECLARE_EVENT_CLASS(mm_vmscan_lru_shrink_start_template' to replace 'RACE_EVENT(mm_vmscan_lru_shrink_inactive/active_start' * Add the explanation for adding new shrink lru events into 'mm: vmscan: add new event to trace shrink lru' v4: * Add Reviewed-by and Changlog to every patch. v3: * Swap the positions of 'nid' and 'freeable' to prevent the hole in the trace event. v2: * Modify trace_mm_vmscan_lru_shrink_inactive() in evict_folios() at the same time to fix build error (Andrew pointed out). include/trace/events/vmscan.h | 31 +++++++++++++++++++++++++++++-- mm/vmscan.c | 11 ++++++++--- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h index b99cd28c9815..4793d952c248 100644 --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h @@ -395,7 +395,34 @@ TRACE_EVENT(mm_vmscan_write_folio, show_reclaim_flags(__entry->reclaim_flags)) ); -TRACE_EVENT(mm_vmscan_lru_shrink_inactive, +DECLARE_EVENT_CLASS(mm_vmscan_lru_shrink_start_template, + + TP_PROTO(int nid), + + TP_ARGS(nid), + + TP_STRUCT__entry( + __field(int, nid) + ), + + TP_fast_assign( + __entry->nid = nid; + ), + + TP_printk("nid=%d", __entry->nid) +); + +DEFINE_EVENT(mm_vmscan_lru_shrink_start_template, mm_vmscan_lru_shrink_inactive_start, + TP_PROTO(int nid), + TP_ARGS(nid) +); + +DEFINE_EVENT(mm_vmscan_lru_shrink_start_template, mm_vmscan_lru_shrink_active_start, + TP_PROTO(int nid), + TP_ARGS(nid) +); + +TRACE_EVENT(mm_vmscan_lru_shrink_inactive_end, TP_PROTO(int nid, unsigned long nr_scanned, unsigned long nr_reclaimed, @@ -446,7 +473,7 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive, show_reclaim_flags(__entry->reclaim_flags)) ); -TRACE_EVENT(mm_vmscan_lru_shrink_active, +TRACE_EVENT(mm_vmscan_lru_shrink_active_end, TP_PROTO(int nid, unsigned long nr_taken, unsigned long nr_active, unsigned long nr_deactivated, diff --git a/mm/vmscan.c b/mm/vmscan.c index 4e3b835c6b4a..a44d9624d60f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1906,6 +1906,8 @@ static unsigned long shrink_inactive_list(unsigned long nr_to_scan, struct pglist_data *pgdat = lruvec_pgdat(lruvec); bool stalled = false; + trace_mm_vmscan_lru_shrink_inactive_start(pgdat->node_id); + while (unlikely(too_many_isolated(pgdat, file, sc))) { if (stalled) return 0; @@ -1990,7 +1992,7 @@ static unsigned long shrink_inactive_list(unsigned long nr_to_scan, if (file) sc->nr.file_taken += nr_taken; - trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id, + trace_mm_vmscan_lru_shrink_inactive_end(pgdat->node_id, nr_scanned, nr_reclaimed, &stat, sc->priority, file); return nr_reclaimed; } @@ -2028,6 +2030,8 @@ static void shrink_active_list(unsigned long nr_to_scan, int file = is_file_lru(lru); struct pglist_data *pgdat = lruvec_pgdat(lruvec); + trace_mm_vmscan_lru_shrink_active_start(pgdat->node_id); + lru_add_drain(); spin_lock_irq(&lruvec->lru_lock); @@ -2107,7 +2111,7 @@ static void shrink_active_list(unsigned long nr_to_scan, lru_note_cost(lruvec, file, 0, nr_rotated); mem_cgroup_uncharge_list(&l_active); free_unref_page_list(&l_active); - trace_mm_vmscan_lru_shrink_active(pgdat->node_id, nr_taken, nr_activate, + trace_mm_vmscan_lru_shrink_active_end(pgdat->node_id, nr_taken, nr_activate, nr_deactivate, nr_rotated, sc->priority, file); } @@ -4524,9 +4528,10 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap if (list_empty(&list)) return scanned; retry: + trace_mm_vmscan_lru_shrink_inactive_start(pgdat->node_id); reclaimed = shrink_folio_list(&list, pgdat, sc, &stat, false); sc->nr_reclaimed += reclaimed; - trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id, + trace_mm_vmscan_lru_shrink_inactive_end(pgdat->node_id, scanned, reclaimed, &stat, sc->priority, type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON);