From patchwork Fri Oct 20 08:43:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huan Yang X-Patchwork-Id: 13430266 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 C7859CDB47E for ; Fri, 20 Oct 2023 08:44:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 31CEC8D0094; Fri, 20 Oct 2023 04:44:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A5948D0003; Fri, 20 Oct 2023 04:44:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11F5D8D0094; Fri, 20 Oct 2023 04:44:44 -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 F16F48D0003 for ; Fri, 20 Oct 2023 04:44:43 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C9721803A6 for ; Fri, 20 Oct 2023 08:44:43 +0000 (UTC) X-FDA: 81365204046.11.8A844D1 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2128.outbound.protection.outlook.com [40.107.255.128]) by imf05.hostedemail.com (Postfix) with ESMTP id 6EBC810000E for ; Fri, 20 Oct 2023 08:44:40 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b="TgDc/Nzr"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.hostedemail.com: domain of link@vivo.com designates 40.107.255.128 as permitted sender) smtp.mailfrom=link@vivo.com; dmarc=pass (policy=quarantine) header.from=vivo.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697791481; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LmrND01Q0+/12qlcR4UJDMsXyi2NfbqyOefSLc2w0gM=; b=T/hxP9v2KYuS7JxqSv47HJwYqemEliOIsPu9KC3zg3TghNGfAA91itYaZAeHyY5VFhvSFU KXo9ElHPhi6rVABKETg6YnfRPrnfQRsF1PwqNuxW2pVWHgjdV3gQNvSksHycWnlMUGDJXF 5PRVYI27aSWgojEoLFNyu0TIx1xa0Oc= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697791481; a=rsa-sha256; cv=pass; b=Sb0Rml8rQ9uoqUf1Big4Cf2bWGHAJQghWJFJ6SXprjdGE3d/gm2gWkwYIjhg8XfW0aRQ3M J5bj8JJST2PJ12gZRhp+9RWecYalxKvrK20y8Kw3yPWdgmO/sB+/AJeddS8c/TH2yRblw0 iptxj+UOweDbQLC8/dz3JRAOfIzGvcQ= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b="TgDc/Nzr"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.hostedemail.com: domain of link@vivo.com designates 40.107.255.128 as permitted sender) smtp.mailfrom=link@vivo.com; dmarc=pass (policy=quarantine) header.from=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nVcoXAwUMP6Osn+zQjUMTze5BnCxOpNXx/k9KqG5uU9kTlhazVz/BHi+ubGNtj2+Tnes4/UCC98Xnyn0+3D3WLM/1NPq6LJSE6v7faN8/0ghQxMPE13A2Ik88EtOM7Rvr32lAg2VpnU3PLgQn5NKDZgOyZ7jKPubSTFTWtqt8qXwXINWqXLmvqPho8ou8HPW/XMcHvSyfDVHJGNhTWGZB821XGWiUXfn5695VAWsDUe0H6857CjkQ/PUZyfvq25Lw0DVIKqIj7IH+B4jO1pbeqFXON/7BQ+EHde61DJCAFUpS9t4SWQWqfa626kx1lEuH6FB7pJ4dsw4hT3u9lb9eQ== 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=LmrND01Q0+/12qlcR4UJDMsXyi2NfbqyOefSLc2w0gM=; b=c+PwYjkQh2Ak+u4+ALa9id3ALUBkL4NOSRmLJnLh6EKzYKl61tOWOa3DDihtpaz1YrQhXKA+SXCKUIRMZmcP/GnfKuJBxgwoY70B51RY6muP5YgpAmYHBHN3W720mcz/uZJErvjVfV+cB7WVBmZZjoMJ0cFtqWy7IFDhmqc7h5e7Gm7JVV8qBIZSEGsSug8Octh6PWfyiXwUu9kPrh5wF0S7lOisPwceNFTNLHMANCsWZ988fKslx8j0xiz6hPhy6DDcpJzmisyTPpV6xTJm8Fu5Ir0mOcfh0gqpF4lk6raWgvJFf32ZnZEAVYJHBQXTxOhkPjTQljJC2fk1z3k/9g== 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=LmrND01Q0+/12qlcR4UJDMsXyi2NfbqyOefSLc2w0gM=; b=TgDc/Nzr9yZ2seYgmFI1eKVt9eDa4lpKBAA2hheSEsqKfF81J6pJZjtoKCzIO5/idbnyo7L7fi49flF1ePtVm3dGYY+Mjrv/efx409z9jk9wXxWmk2U7PmW5YvrZsHnBsgacFPyBcFBuaZDpF5vx2UkQRBf6jja+m99TtcDdFu4yLQgYOnRS3yAtk6S/E+p5Rs+YYceRtB3ai1LTUTUuEFO+MZQcxp1z5CCJbZIeLVxXbLzU7tJEgeupNJmbP8nom/FTmEVtKjF17objcukDOdaN7OlyQXP0P8pG0ulDHXrba+ddVCpMb4LUW2S9AsJ/lPBM327c0lHngnd3WYzdNA== Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) by KL1PR06MB6553.apcprd06.prod.outlook.com (2603:1096:820:f1::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Fri, 20 Oct 2023 08:44:34 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::40ac:5701:4617:f503]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::40ac:5701:4617:f503%4]) with mapi id 15.20.6907.025; Fri, 20 Oct 2023 08:44:34 +0000 From: Huan Yang To: Yu Zhao , Steven Rostedt , Masami Hiramatsu , Andrew Morton , Huan Yang , Suren Baghdasaryan , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org Cc: opensource.kernel@vivo.com Subject: [PATCH 1/2] tracing: mm: multigen-lru: fix mglru trace Date: Fri, 20 Oct 2023 16:43:50 +0800 Message-Id: <20231020084358.463846-2-link@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020084358.463846-1-link@vivo.com> References: <20231020084358.463846-1-link@vivo.com> X-ClientProxiedBy: SG2PR04CA0198.apcprd04.prod.outlook.com (2603:1096:4:14::36) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|KL1PR06MB6553:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c4bdcc8-cfe3-41e2-996f-08dbd148c8f0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VpPmLQe5R/gDoE+9scAaxBPNIyxzhvOV84iAX3E85B1YWDNOX1W8GLTIaYEUQOploM9f8q6MXdV89t0JJ3H/SgP/8/nDLPgqBZre8WczKCUt/1Uysf3m4dVDNyjI73sjsURKpt6rvGPiDuYWktJm3ZhAVs9dsZxoGqo3r4BHSmGmujiq8RFazvBw97Ic99c+H+7VFV/BI30J2aG7ed5DjuktQe0A+PPrHXaXAE2jtw7jFK2mTbIxQFaNmBWDJ5OVaT7xhhC+rTorXMDTehu8XIc303vQCkZM0Blm1ymY6rufB+stH3qVF7RW93z04ippU/IUoeDYkd36cHTOl6nkp5EAtvqMpc5YKj/Jy7dYdmW03Sb5FjK0k4lW0QOMo6Y8StOukwOxLtSTqe5ZaeFsfwg0aMgtyv9kij1F8+/Vyqcr/AuSOWMcH/lCJp86qRHI5zG2XfmsFgBXBkTdGWzeMcQVT/5tW8ZkpGLSiHzCF2KkQopenV/L7BmDRuWOXncRLb4RQ9erca+PQq/HWl5bRAX8pOXxY338wUSlavXOkxXZJWHLnDrALIj2QIWDfggfyJPphtOqpgrROpbdE7LDuSve59ISG4IKpGnVW5Z5gbVB2PCXLqSbS/BT57ebaec9PpI58vrNXJhHD4mMDu0eaQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(136003)(366004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(36756003)(38350700005)(6512007)(83380400001)(110136005)(66476007)(66556008)(38100700002)(86362001)(52116002)(2906002)(26005)(107886003)(2616005)(1076003)(6506007)(6666004)(4326008)(478600001)(6486002)(66946007)(41300700001)(316002)(8936002)(8676002)(921008)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EUtlMl4ut0/McgcSHfLpgO7LTf6xKIXgmIdsrnojY4lHx7dojWTJzNXcPT1RdplrrrClWABjQS10q+ptUuwHEYjy8hhzQzDI3ihh75IEN1fBXUUbnYvHDqxao6ZNNlAWfN4FG5i/xMLS3HGpXaVtUdFaUCXWUcPFluVHLBY1o6qUw6cj4uW3eVGqWql5STFAAJ/BCUFlHr2wTYt8ujevYqxqFxSeYnUrV/Mndws6Rss5XhB/AlZiwpM5OVOypFFWkbJQMVRi08B6KzZd15361S7o0R1FKYhoTZaDRX22Mbi2P0p7GXomkBgp4Hrj3qqsbj7wbBaU7XXaP4KvkquTSst+db0Pzl6Fz8JuREY+CqkRIXtkM5DUm5vr9f6NmX0orNN5nilKYre0K2M7GXHG5hDwJXmOggy85O8vXw3Ci30thlFWWM2eBqzlzdq24Y4FGWbq9gs0HZcjXa4cTyx32F7eC2hfEjC2FiZnOIhLhC2gF64OV6e0BfmIbT5GrEq+VfoK4nepaPXKT28x00ffQ71VnILHT1dLLDC93ov3ZzHJf+lZqdWOSY814nznAER9N5jsMJWu8/089syjr09MT/yq8vyhdTndAlkIuJYJPbLg2nnj9RdYDbB2tBZctGXD2YxrhgtvG284NvdDYV9NMYqXXgjvrd9HRn6KECuH6p4LpnMhOWZpoxMaN/p+LKVFumAWATuOeMHcv5MlHawhnETO6ISRJHah09PtwUYkqrLVrpziPLxjH7NVUXb03jVMq7PCL7BllVCuZ+ZC1DOV0tG/W4WmPHxDbs431BH8JVOm7UAWsNHFW5V9dWLQp219yL8SKr6cnhRwupU6qLbHYqtUE6srgwAzZ6JjauW44+KPwXHAXPphFwjOUDmV2LPg43kczam7z9mAIaWAeUTGrg3R69VjtQOkHlqTdo8PFEDSzsuwCBRB927y0N5j5VsNqKYMHQH9/k2PfFgDjhk4z8bi8O5AmXb5my5bsKNoepuj2l0r9OLBJfZJwW/Vspz0/2iyjpwH5agHrxArgndd5pPOwlTBDG1T/S+QgWaYLt1M7eyrRtOmFJi3RffLR6CE3eUchX2kZGkkGu8lYPPiJs7U9ZP36ThmIkBp1PUaO1yimksKqgMXMruIqPCy2ZdaTMNdO/n22lD0LOfj52S+0fAGRf9VH7Btq43kJu4JNWuXy07nWpvQ+CM8VXGAKjWa7NtNZlUWMuJt0N7Hj+YRzT3SGXkWxmJ52bM+E8VKj16gBNiVx057YK+mzWlB2/M+yDiXn3OyrIuE6GaQLrKyDJ3lN4kdP03/Jcv2PQmxRDA0G06uEnzbLDP/gqoEdXqXmp0sOfEDQTQoeqQxZ4NONeuvq8ZHRcSpplpXik0CLXZDtpiI3R/PHE5X8AD3phVpG+Jbbb0ZbBw4ml79yiRHljr9go9uEJDiLk0x51XI0e6TsjU0qheHdfsyOtmnFV93Qdhlo0dip6jf47iU7+Yw5XKM7TfHwJ5oiFHbP3i1m/mQtRx1vob+V79aHNHrC9gEmv1GayAmiBdz0YI/RY3rkN4GtNPouZQh2NIxVONWtjyY2q72B8suiZ+0GSWaue5+ X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c4bdcc8-cfe3-41e2-996f-08dbd148c8f0 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2023 08:44:34.3688 (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: yrqKXxB6PPam+5zTV/vzSYj9J0d09yaMaGxRBqSPU/8H20ytE9oZVmHjBYY6cUJdaOeoYsU9flpshwOhXqBvSg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06M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ir4hYtHa+b+nQBO3ZpmbByrm4wI8p4 doY6RpqA Sv1Eq6arumYvSUlZdxxzs876Zz3iEQfTOswRGshzsI7NXPguRJtU9GHm8Vylx1De7CmDVcexcTM5cDpgMSPMcgXqoPCEAkeMhIHMRGOH7lq0V3eY1BZVRQGTdBZDKHPr6fe+Pm9zGxsoVcimwhYcKch3pO1g9ujEWLgk3H7w2jxZV9/YEuFlTG52fBd17khkIfCp7jx2AMJ3M8D9vlK4XoeMOz+NRzvkTcSx6IVVHvfGdTXNYyNU4m8kPho22SS6nWFxnogW9QaJHyWnKYHc/VPo0FDqT8lYkmvtUG+NjI1b7cOlPUeXY6B2zxqSSMbS10Z0Ah3xf4tLYjADrXmIhXQR3fA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000145, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This patch add reclaim stat: nr_promote: nr_pages shrink before promote by folio_update_gen. And then, use correct nr_scanned which evict_folios passed into trace_mm_vmscan_lru_shrink_inactive. Mistake info like this: ``` kswapd0-89 [000] 64.887613: mm_vmscan_lru_shrink_inactive: nid=0 nr_scanned=64 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=0 nr_unmap_fail=0 priority=4 flags=RECLAIM_WB_FILE|RECLAIM_WB_ASYNC ``` Correct info like this: ``` <...>-9041 [006] 43.738481: mm_vmscan_lru_shrink_inactive: nid=0 nr_scanned=13 nr_reclaimed=0 nr_dirty=0 nr_writeback=0 nr_congested=0 nr_immediate=0 nr_activate_anon=9 nr_activate_file=0 nr_ref_keep=0 nr_unmap_fail=0 nr_promote=4 priority=12 flags=RECLAIM_WB_ANON|RECLAIM_WB_ASYNC ``` Signed-off-by: Huan Yang --- include/linux/vmstat.h | 1 + include/trace/events/vmscan.h | 7 +++++-- mm/vmscan.c | 25 ++++++++++++++++++++----- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index fed855bae6d8..a3710ce08434 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -32,6 +32,7 @@ struct reclaim_stat { unsigned nr_ref_keep; unsigned nr_unmap_fail; unsigned nr_lazyfree_fail; + unsigned nr_promote; }; enum writeback_stat_item { diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h index 1a488c30afa5..ffcf288879e0 100644 --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h @@ -366,6 +366,7 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive, __field(unsigned int, nr_activate1) __field(unsigned long, nr_ref_keep) __field(unsigned long, nr_unmap_fail) + __field(unsigned long, nr_promote) __field(int, priority) __field(int, reclaim_flags) ), @@ -382,18 +383,20 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive, __entry->nr_activate1 = stat->nr_activate[1]; __entry->nr_ref_keep = stat->nr_ref_keep; __entry->nr_unmap_fail = stat->nr_unmap_fail; + __entry->nr_promote = stat->nr_promote; __entry->priority = priority; __entry->reclaim_flags = trace_reclaim_flags(file); ), - TP_printk("nid=%d nr_scanned=%ld nr_reclaimed=%ld nr_dirty=%ld nr_writeback=%ld nr_congested=%ld nr_immediate=%ld nr_activate_anon=%d nr_activate_file=%d nr_ref_keep=%ld nr_unmap_fail=%ld priority=%d flags=%s", + TP_printk("nid=%d nr_scanned=%ld nr_reclaimed=%ld nr_dirty=%ld nr_writeback=%ld nr_congested=%ld nr_immediate=%ld nr_activate_anon=%d" + " nr_activate_file=%d nr_ref_keep=%ld nr_unmap_fail=%ld nr_promote=%ld priority=%d flags=%s", __entry->nid, __entry->nr_scanned, __entry->nr_reclaimed, __entry->nr_dirty, __entry->nr_writeback, __entry->nr_congested, __entry->nr_immediate, __entry->nr_activate0, __entry->nr_activate1, __entry->nr_ref_keep, __entry->nr_unmap_fail, - __entry->priority, + __entry->nr_promote, __entry->priority, show_reclaim_flags(__entry->reclaim_flags)) ); diff --git a/mm/vmscan.c b/mm/vmscan.c index 2cc0cb41fb32..fb5df298c955 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1063,8 +1063,10 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, /* folio_update_gen() tried to promote this page? */ if (lru_gen_enabled() && !ignore_references && - folio_mapped(folio) && folio_test_referenced(folio)) + folio_mapped(folio) && folio_test_referenced(folio)) { + stat->nr_promote += nr_pages; goto keep_locked; + } /* * The number of dirty pages determines if a node is marked @@ -4495,6 +4497,8 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap int type; int scanned; int reclaimed; + unsigned long nr_taken = sc->nr_scanned; + unsigned int total_reclaimed = 0; LIST_HEAD(list); LIST_HEAD(clean); struct folio *folio; @@ -4521,10 +4525,7 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap return scanned; retry: reclaimed = shrink_folio_list(&list, pgdat, sc, &stat, false); - sc->nr_reclaimed += reclaimed; - trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id, - scanned, reclaimed, &stat, sc->priority, - type ? LRU_INACTIVE_FILE : LRU_INACTIVE_ANON); + total_reclaimed += reclaimed; list_for_each_entry_safe_reverse(folio, next, &list, lru) { if (!folio_evictable(folio)) { @@ -4582,6 +4583,20 @@ static int evict_folios(struct lruvec *lruvec, struct scan_control *sc, int swap goto retry; } + /** + * MGLRU scan_folios return nr_scanned no only contains + * isolated folios. To get actually touched folios in + * shrink_folios_list, we can record last nr_scanned which + * sc saved, and sc nr_scanned will update for each folios + * which we touched. New count sub last can get right nr_taken + */ + nr_taken = sc->nr_scanned - nr_taken; + + sc->nr_reclaimed += total_reclaimed; + trace_mm_vmscan_lru_shrink_inactive(pgdat->node_id, nr_taken, + total_reclaimed, &stat, + sc->priority, type); + return scanned; } From patchwork Fri Oct 20 08:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huan Yang X-Patchwork-Id: 13430268 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 B8A13C001DF for ; Fri, 20 Oct 2023 08:44:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C5858D01C4; Fri, 20 Oct 2023 04:44:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 342508D0003; Fri, 20 Oct 2023 04:44:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 146D18D01C4; Fri, 20 Oct 2023 04:44:51 -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 EF6AF8D0003 for ; Fri, 20 Oct 2023 04:44:50 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C9186A04C9 for ; Fri, 20 Oct 2023 08:44:50 +0000 (UTC) X-FDA: 81365204340.21.A921E3F Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2128.outbound.protection.outlook.com [40.107.255.128]) by imf05.hostedemail.com (Postfix) with ESMTP id DFA8E100005 for ; Fri, 20 Oct 2023 08:44:47 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=TpLCD03N; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.hostedemail.com: domain of link@vivo.com designates 40.107.255.128 as permitted sender) smtp.mailfrom=link@vivo.com; dmarc=pass (policy=quarantine) header.from=vivo.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1697791488; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=aT41bP8r3trBeh7cRmEwTNlaQyvK5YLUexl8IQTAjVo=; b=C9AupK9+ZQNmbF9kRUEtWspGMWJSbGfypUhgzrUx9xonH+maAe1eKlVOJHvb1+u/hjr0Q2 zM6R75Gc13fsj4pAgQKhmNGbxK1NvF5CpshOsqth41haHjHcDp25Gzk8d3cgrWIlyP3Z5m uVr/su8wst4ui5/pEZv9o/73I9ly+V8= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1697791488; a=rsa-sha256; cv=pass; b=F3eOw6RFYe0drYWVhY1bZvhRXCsouAPT+dlzBuDkVBdAmq+of7TbunfuknwTxt0/DJC8ep bshKSzDTshu9SFYD1E4kiUero3bZc0bGHTVF4dD/kW0PJi7xiPBrEtpY3IgNErgX5JL5Q+ +CM/7rBEmd5uanHwJu4zE9rFoPbHrek= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=TpLCD03N; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.hostedemail.com: domain of link@vivo.com designates 40.107.255.128 as permitted sender) smtp.mailfrom=link@vivo.com; dmarc=pass (policy=quarantine) header.from=vivo.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WA7mEgLXLyG6XY4kFo1zUrFkFEOoK8CCiJ/R7Z8JaoIGeE2p69jPJ7R2LzAL1vXZZu7GohwZRIjP75lxgtxIkBcg0seY5DZRTjKc79fB2nbhVSw3azE8mT7ZsE9ttlNNXl0mFAfmCO6iEZI6aME5jJDwDfWnjJqkltASO52bVaS/kk/DhLTlAWjrJH1EgU6rMoBff2byIJC0oZ1Mq+vo3JqTSkbZCXMwS2bnlpTW+vJXgzNDTr7BiUIiW0T3u4XaiV04hK4fKhBYyRrt20lpKFKXbOQk/eSwdghVKtwqLJYy6bTW8yI3NRsvjDXIEulLsPoV+L8Vya8lpI1yKU+sgQ== 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=aT41bP8r3trBeh7cRmEwTNlaQyvK5YLUexl8IQTAjVo=; b=JokubdsG+BHAxAbPj8fjkRWDmpyMyApxO/7LNB3DVdI99h9gLOIDYwdCWQkYhNb1Ih1EkCZ5+IJD5iKOw1g+L3av+tmpeveQcZSiZ8Pwt14FDK+b+WFndn7phGIJA3I1RWSsC7qtmc016c4KJV2Cukd0oqbPxGisGFZuDkzEkpKkEWtQFF5gsDZa6J31FAVQOuYtODG2JRO9uou5TyXdh07ZevWO88Fvc0ky7/MocP1xwR65LMNfKwgfaeFFCfg85M2M/K+YlfdK6c6HlMN8TAP+emF5MlWfttX4eLnmV0dOpivRsKq3VWygXfRWkRhSEYgJAUuFCsStpGxKsiqo8Q== 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=aT41bP8r3trBeh7cRmEwTNlaQyvK5YLUexl8IQTAjVo=; b=TpLCD03NEsT447fCJhlnb/zvV3C/qFd61HnRqkYTOIJrAtKLx0hxykqQPJePOCYbgnHIDtfUojJgwZ70m1CKsKVW4AVX0Gwy0ZRvZWvAEQZcIcwD/HvCWnnq148eibSFJ5kkEPV2hQW0Iv5vPP1tHnT/jxhewbu/UyP96FVFOQhXPaL9zWwihpn5obiKZx4OyI67PVe//tygmrX1gbOpkAciCXpNYecHE6FD7ngIHX/Qou2r23fyMo3I7VXZdSeXaM0w4nMrQZk2sSmE/y6cTTEK4RBEsiRELrWD9zmTvpl7XGkICK6h3vUZgz1/fIMw5Q8xWDFEiCBdL15n5RnCcA== Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) by KL1PR06MB6553.apcprd06.prod.outlook.com (2603:1096:820:f1::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Fri, 20 Oct 2023 08:44:40 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::40ac:5701:4617:f503]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::40ac:5701:4617:f503%4]) with mapi id 15.20.6907.025; Fri, 20 Oct 2023 08:44:40 +0000 From: Huan Yang To: Yu Zhao , Steven Rostedt , Masami Hiramatsu , Andrew Morton , Huan Yang , Suren Baghdasaryan , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org Cc: opensource.kernel@vivo.com Subject: [PATCH 2/2] mm: multi-gen LRU: move promoted folio out of lock Date: Fri, 20 Oct 2023 16:43:51 +0800 Message-Id: <20231020084358.463846-3-link@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231020084358.463846-1-link@vivo.com> References: <20231020084358.463846-1-link@vivo.com> X-ClientProxiedBy: SG2PR04CA0198.apcprd04.prod.outlook.com (2603:1096:4:14::36) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|KL1PR06MB6553:EE_ X-MS-Office365-Filtering-Correlation-Id: a653b177-ffc0-4154-e9d7-08dbd148cc69 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: guCoE3hSns7e0lNAgTfd9SDeR4ey4mamtBgAg0RhN2enVJZJVReM2BAmwtD8wavgE3OlpS2FnzEaBCBB/AKn/fb4Ox29l6xxlUHBybrT/NPMGLueymHUzSQZKSKNvk7Q2zdaxsqyHyOlFKtrIi4Ohnjq/+pYH+cWIBdYwp9cMURBHrG8z9x0tvJIoU+kzdwqRMO2ZokgzfWq2d0o48lITlzU4DRia0M1axxC1Ra1MoMBB5NIrgvLOTQRT8uyNpK08ztCHDKgeAAjhEQ9pIiRpcp9VhQIiMug83WvhexcCrgRLDsGMfvBf5ijfEC84oSemn7n+gX4y96CGSj+s5UWB4GcEp8w0BMQje5QNiHKL7bVCs31tc5owVPsI7hUa5QxOJtPktRDFanBPbMH/j/8jbXHs5HqmK5AxVqxbiBv0Nk+kcepUs8Br31qGRGHETnQeOvrfzk8GW/ahX81TnBEwFTcyMJRRiEuqHnQB7LH/2cgqmhHYf8+XuR1eyQ+iQoo6UpxCLw+D4GKvZUQxYDXXEH0nZams4gsl0HrbH+o7YwtwvCPZfGgfO8xol01zq4XfhXU8GZ5zdv/tfl3E2qBUOp04FyAMKvLDVPUAAmVMNeT7PUxa6KptoT/9gELcB2yDb1hBiY1SZTA8yP+RL+nWg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(396003)(346002)(376002)(136003)(366004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(36756003)(38350700005)(6512007)(83380400001)(110136005)(66476007)(66556008)(38100700002)(86362001)(52116002)(2906002)(26005)(107886003)(2616005)(1076003)(6506007)(6666004)(4326008)(478600001)(6486002)(66946007)(41300700001)(316002)(8936002)(8676002)(921008)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KLCg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7Ja/frfh1zSbIrM/JuT+hxxEPOU3ZJHG8Ofg+KyJIBeuy3WiGw/w5Rg2bPh55JhkjkN3qkUK8RLBD9+QkUL7AU+EVR05apsXD5HuS6WW9Rh3g9lwR5WeXX6edvYNmzwvuz2zPL1efoXoNXIC29VjxLti7IGC0UrJCSKxDTZUVIPgTXN+hHTxm8HeVXC5zUfzIitCSz/VvPDlL1AdZ11qs73mR7KQoXr88XkQhD0HHSNWuLxYyTHtY/DCyMyDMXfXYK7SK7RV7aTGSSD3rfO/1WcvGy1Rc3fCRL3D00VysE151T/idqt1q07oBE1MR/B1q/XweSviXT0WZFBDLfIh45Z75zVVQjJHNdaUSNasZoLoQ3H6KwC+Rq/UPprYvXAZ75Zkb8/Me8W5ccjNCvnjF/jdWrBpuUw7Pm5e+xxdiKg/83+5/SasqjE0pgPETduxMYe2Q9b/H3zxh9hWaZRtnUzPClrlkbRYxzOnzl6Zb2vR7RQgod+ybA6KEpHMdf8U X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a653b177-ffc0-4154-e9d7-08dbd148cc69 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2023 08:44:40.1890 (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: V031SWY0F5NvOCCL/d6G9/bBUugs7whQJXgptuZBhuqYoohLuQe9+K4ru4lbWLrBf5zkNYexAI27glIv2mc8RQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6553 X-Stat-Signature: awfsjgw4xix8cpucyfpn7z6jf34beggz X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: DFA8E100005 X-Rspam-User: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P0kYX5eCEEUWqxNqZkpU9zZ5qg2IRh+/2n6Qt++tWitbX2xchVT9yggWzUm1f+1KxT74B9f9MvsxXfk7bnsAF2xM5ZSaAOJoaXJr4URUe8nV2Wu2wLbu7wJG5+P7AchcPF+SbS2Viym2D3I081d77o5zrCg+PV1Tcg3cfgclkb8H/X3RNOC7Sur7PdGBZ87XtQxraUCp+abxcvGrAWKFaq1fBgJvfd3cvsLeM3onNISD3E5rZqPsFLUvu4uA41anYhxlCMLiVplk4bCUw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000747, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: With nr_prmote trace, show that here are many folio promoted before shrink check. I just test by below cmd, and grep nr_reclaimed=0: ``` trace-cmd record -e vmscan:mm_vmscan_lru_shrink_inactive\ stressapptest -M 8096 -s 120 -m 1 -W trace-cmd report | grep "nr_reclaim\=0" ``` Then find many show like below: ``` <...>-9042 [001] 43.290759: mm_vmscan_lru_shrink_inactive: nid=0 nr_scanned=64 nr_reclaimed=0 nr_dirty=0 nr_writeback=0 nr_congested=0 nr_immediate=0 nr_activate_anon=0 nr_activate_file=1 nr_ref_keep=0 nr_unmap_fail=0 nr_promote=63 flags=RECLAIM_WB_FILE|RECLAIM_WB_ASYNC ``` Many scanned folio is promoted ahead. So, this promoted check better checked before trylock folio. And, now that promoted alread checked before touch, no need to trace it anymore, remove this trace. Signed-off-by: Huan Yang --- include/linux/vmstat.h | 1 - include/trace/events/vmscan.h | 6 ++---- mm/vmscan.c | 12 +++++------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index a3710ce08434..fed855bae6d8 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -32,7 +32,6 @@ struct reclaim_stat { unsigned nr_ref_keep; unsigned nr_unmap_fail; unsigned nr_lazyfree_fail; - unsigned nr_promote; }; enum writeback_stat_item { diff --git a/include/trace/events/vmscan.h b/include/trace/events/vmscan.h index ffcf288879e0..41964d6e8dd1 100644 --- a/include/trace/events/vmscan.h +++ b/include/trace/events/vmscan.h @@ -366,7 +366,6 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive, __field(unsigned int, nr_activate1) __field(unsigned long, nr_ref_keep) __field(unsigned long, nr_unmap_fail) - __field(unsigned long, nr_promote) __field(int, priority) __field(int, reclaim_flags) ), @@ -383,20 +382,19 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive, __entry->nr_activate1 = stat->nr_activate[1]; __entry->nr_ref_keep = stat->nr_ref_keep; __entry->nr_unmap_fail = stat->nr_unmap_fail; - __entry->nr_promote = stat->nr_promote; __entry->priority = priority; __entry->reclaim_flags = trace_reclaim_flags(file); ), TP_printk("nid=%d nr_scanned=%ld nr_reclaimed=%ld nr_dirty=%ld nr_writeback=%ld nr_congested=%ld nr_immediate=%ld nr_activate_anon=%d" - " nr_activate_file=%d nr_ref_keep=%ld nr_unmap_fail=%ld nr_promote=%ld priority=%d flags=%s", + " nr_activate_file=%d nr_ref_keep=%ld nr_unmap_fail=%ld priority=%d flags=%s", __entry->nid, __entry->nr_scanned, __entry->nr_reclaimed, __entry->nr_dirty, __entry->nr_writeback, __entry->nr_congested, __entry->nr_immediate, __entry->nr_activate0, __entry->nr_activate1, __entry->nr_ref_keep, __entry->nr_unmap_fail, - __entry->nr_promote, __entry->priority, + __entry->priority, show_reclaim_flags(__entry->reclaim_flags)) ); diff --git a/mm/vmscan.c b/mm/vmscan.c index fb5df298c955..98a7b0f738bd 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1045,6 +1045,11 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, folio = lru_to_folio(folio_list); list_del(&folio->lru); + /* folio_update_gen() tried to promote this page? */ + if (lru_gen_enabled() && !ignore_references && + folio_mapped(folio) && folio_test_referenced(folio)) + goto keep; + if (!folio_trylock(folio)) goto keep; @@ -1061,13 +1066,6 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, if (!sc->may_unmap && folio_mapped(folio)) goto keep_locked; - /* folio_update_gen() tried to promote this page? */ - if (lru_gen_enabled() && !ignore_references && - folio_mapped(folio) && folio_test_referenced(folio)) { - stat->nr_promote += nr_pages; - goto keep_locked; - } - /* * The number of dirty pages determines if a node is marked * reclaim_congested. kswapd will stall and start writing