From patchwork Thu Dec 12 09:56:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hailong X-Patchwork-Id: 13904938 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 DA6DBE7717F for ; Thu, 12 Dec 2024 09:57:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42CF46B0082; Thu, 12 Dec 2024 04:57:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DCFA6B0083; Thu, 12 Dec 2024 04:57:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 27DA76B0085; Thu, 12 Dec 2024 04:57:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0A5D86B0082 for ; Thu, 12 Dec 2024 04:57:27 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 515DA16173A for ; Thu, 12 Dec 2024 09:57:26 +0000 (UTC) X-FDA: 82885853778.12.94E7D4A Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2087.outbound.protection.outlook.com [40.107.255.87]) by imf23.hostedemail.com (Postfix) with ESMTP id CF5B9140006 for ; Thu, 12 Dec 2024 09:57:06 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=oppo.com header.s=selector1 header.b=sSOjReEO; spf=pass (imf23.hostedemail.com: domain of hailong.liu@oppo.com designates 40.107.255.87 as permitted sender) smtp.mailfrom=hailong.liu@oppo.com; dmarc=pass (policy=quarantine) header.from=oppo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733997432; 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: references:dkim-signature; bh=y19EQsVygP9K9V9bYVBEpblh0sNEKwAAVCYLQO7LLKg=; b=KAh8gLvaQmJ6kOpiQ/AxjcGLEojlwkOSICJpZWJ0/269NR5bN2M+fK9szTmv67khjDICXD sCcqMlpWHuEt68OJ1VtFghwgWdZqI2HIsZJsOEqLZxoIUfrh6AQp6DuPNvcV3qWsI779rk ERzS9LJtCLwDpzAP08lV2G4huLFYDPc= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1733997432; a=rsa-sha256; cv=pass; b=bVPPAMZCbPic+glyxZes/mOgU0lqvnEgk2scAfxBk8yBOgBO1dOyGjMca+kSHbOfg/HJy1 DW+Uv+HECjGmpYTY33mTbCNl2MLy48oapp67bk+OrTGg0/xMwVQiikCvVbWa2e8+2YhKE5 59GAC1RroD1DSSSSfHeVn9lCAdHAAyg= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=oppo.com header.s=selector1 header.b=sSOjReEO; spf=pass (imf23.hostedemail.com: domain of hailong.liu@oppo.com designates 40.107.255.87 as permitted sender) smtp.mailfrom=hailong.liu@oppo.com; dmarc=pass (policy=quarantine) header.from=oppo.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KArLxVd1drQeb6yQrYaHbpoFjQVa6jJfLCh4loZfipCYpZydlC3vZj58VfQvVVBYEYrvZqkaDmObc1cq71FEdnCJR5wEpo/nnJkP0LRsJ7LWjEQ3WFrHDdYoIVpE4ScJo8QzNibXoXLMn/JAZmvMqCFOfOeGKlVx4arnFL40vmVvRYsGQ56DxMcFY/y4iluHqphhHSNG+YJgASWJl063Y1PHUI2lBFFJnkMuTf8YifkNqyWnEyHOfnwnYrQLiTQahVEX9TXenO5zubduO7KgmpBHzfbkBtpz4LtQ7eskSlsSOyDbdZ3FmykRiKnlrMeRJG0Nxh2BFdIEGzde9/MJ2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=y19EQsVygP9K9V9bYVBEpblh0sNEKwAAVCYLQO7LLKg=; b=czJJRtX5c8ykSmMyLnqF8k4rww3uQSYAYbcYqx+pwc8TF9m4wxpKO+F3oUFQeNp7A9y5ptVbCjMyDRE26pSdiWfpB75fjf5an2Fu/KgnCQZ2HfXYcjl3+aIqgQkY/7FW+1vZNZSdYphIqtqJoFv+Gn25KYm7wGUEw9LiSkCZAwG/oFTT0JncCJ1nTnWgh44cU6wjc7mSRPebo53zoT3kilnImttQw7SY/2cVNoriF4Z1gGSUNBJJPkqQzUV2kgH81bsqhlDzMc+M83w/a1EdJBT5xLv/U/b2ojXRudQwE6dLQV4z0SFrzRFiUD90YOlr1spgmo3yLssXbx608nBN1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 58.252.5.68) smtp.rcpttodomain=linux-foundation.org smtp.mailfrom=oppo.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=oppo.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oppo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y19EQsVygP9K9V9bYVBEpblh0sNEKwAAVCYLQO7LLKg=; b=sSOjReEOuZSIU/1Z8CBC602kFNgBAAI1vfI5jvE3rjgqwuTAn0UOH5LCi4f2hYzq/4Oio32/3s7VYUx1rzPzwXHFE0Rrput0i9+1zAFRILLTVA9FVk8FZU9YdH2V46jksYhXeIhorNxYDunFGcVVdo9gTDzooRYmA9+VysOPdDc= Received: from SI1PR02CA0033.apcprd02.prod.outlook.com (2603:1096:4:1f6::14) by OSQPR02MB7767.apcprd02.prod.outlook.com (2603:1096:604:277::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.18; Thu, 12 Dec 2024 09:57:14 +0000 Received: from SG2PEPF000B66D0.apcprd03.prod.outlook.com (2603:1096:4:1f6:cafe::3b) by SI1PR02CA0033.outlook.office365.com (2603:1096:4:1f6::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.15 via Frontend Transport; Thu, 12 Dec 2024 09:57:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 58.252.5.68) smtp.mailfrom=oppo.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=oppo.com; Received-SPF: Pass (protection.outlook.com: domain of oppo.com designates 58.252.5.68 as permitted sender) receiver=protection.outlook.com; client-ip=58.252.5.68; helo=mail.oppo.com; pr=C Received: from mail.oppo.com (58.252.5.68) by SG2PEPF000B66D0.mail.protection.outlook.com (10.167.240.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8251.15 via Frontend Transport; Thu, 12 Dec 2024 09:57:14 +0000 Received: from PH80250894.adc.com (172.16.40.118) by mailappw31.adc.com (172.16.56.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 12 Dec 2024 17:57:13 +0800 From: hailong To: CC: , , , <21cnbao@gmail.com>, Hailong Liu Subject: [RFC PATCH] mm/mglru: keep the root_memcg reclaim behavior the same as memcg reclaim Date: Thu, 12 Dec 2024 17:56:46 +0800 Message-ID: <20241212095646.16164-1-hailong.liu@oppo.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [172.16.40.118] X-ClientProxiedBy: mailappw30.adc.com (172.16.56.197) To mailappw31.adc.com (172.16.56.198) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SG2PEPF000B66D0:EE_|OSQPR02MB7767:EE_ X-MS-Office365-Filtering-Correlation-Id: ad1139d1-7385-4c21-052c-08dd1a935af4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: 0ZxG8oofBQjUTY0xRJEHsd/kSGj4JQXrRAjvscbIiRRWIZENjoZXDMrEuV1yFhG+E/oBhQcbnR/zP2IUhPyNj43QEeg7NJJeybNwRRImksAZ4/s1aVOPseRhUSSmd4U9ZEQXtpV2hujk0uu1qivSiLmhOQbQlHXpAUWnmXQQHY03mHIgwWhXKiP1ScYjf6aPx9q2w2JAYpwcZVmNXdbAGdLQTe1urRhOZdRQAC80EAiiclZ7LSyi9VooKeEhtKaQA0cdhB8Kg7JrvAf6D/kHXKMAjIry66zqy93UdAmMEoWnRIXs0zyXAjbLR+09FOJVmHGuCZ6+RTg+7ll8SRtB6Ma4Jq2/4oD8qQkNxKBruZNQiuynqNLut31piVt+SHPo2ugQtYBt9XLS2VqVrL4BQKnYGuBhISb7KuJLkJ8EmP/N1iV4mdhffYM6hfeMa9QzGXOJTdDqh+vcxS/kAv/8ifKx2Q8Cqkihjjiv+Khc7v8EuoqL/MW0Wdpw48KBxftci6L5hEJlSJ8648pcAwfo7VEdSf7jZzbpCOYwpmj96QrrliydeAFO6ZgOjycT8gPPfy+rBRRGJEJNiSohKWLYAPwfsBwb198pAX9toPVqpxPc2GizL84LDGndxbIZuUBuwi2VLODCm0wD4HQK1q50gDYtEyQ81BKMpgBHOH6LaAaTTEMcTLSyPXB7nfVSmLFRp5vRVwlU5m37dsTcKP1Y4VW2lc4bguXhinyYTmkuu2ano+b0OfB/aQM9fU78iPJDOTcG+nfXtkLf7y6Fz2IO/cxnDxcFJYUGyU/w5+qZaU7oj1iySaFyIDsJLxl+FJqKNStl6jtlF4qw7C4MLb5Fzz/mZ9AT5Eaa1rlQ3u1MkMNn8eW66fI6PlE5d0kWQD6NjYlNT4S9RyW7WlYQfn0q8mK0dQXaclxYs/yNK5CPTA46a3ugjKj4junZVEijvF0ZANynv9Qf9qimWjpUR5ARJfOCWrCLj7/ADNalM3bL/6wsL4aZJjhzjD1r9LnmPga13ho2avV7UK261D+YJjRGM84pw36KPwywOR0wBB4l/uqk0yzayGqDr/WqOMG1CdLGOufsZkQrRujgtVesbDgfdmiiJ38Il7t62bJ029rilNwqba25IP46EilkMOtX2oL6R99QIFRmp3XZElQTwFg+63b5hDBs2Y8zzsbDkkg8C4MvLy+iJjFFtBquKp9o4IkyIrhi5GlSQ7rXtOmnBFIfq1P2xLpvsv/TKKfpi1qSobCAj4018mEZ7uHQ1+MVKSGq76aE9c8w0+B+IuLhtPodZEnGBnzo8yeCJbqqxhEpm6H8hTMtRbWl9Xy447YkZT7JqyJN2C37u/JtxH0j4MMNBQR/G3inrmREgwSTL7gQlKf+TyB03TU2vpQ9U6/DKWfLhdIHkBBw4VD0UDwc8w5BzuSA7qhiXa3oOq1hrJx2L3yJEQTlMUz+HZps3o2/acrc X-Forefront-Antispam-Report: CIP:58.252.5.68;CTRY:CN;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.oppo.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: oppo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2024 09:57:14.3997 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad1139d1-7385-4c21-052c-08dd1a935af4 X-MS-Exchange-CrossTenant-Id: f1905eb1-c353-41c5-9516-62b4a54b5ee6 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f1905eb1-c353-41c5-9516-62b4a54b5ee6;Ip=[58.252.5.68];Helo=[mail.oppo.com] X-MS-Exchange-CrossTenant-AuthSource: SG2PEPF000B66D0.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSQPR02MB7767 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: CF5B9140006 X-Stat-Signature: 8smoq8fricano1emwbyjcoydokem6cja X-Rspam-User: X-HE-Tag: 1733997426-959227 X-HE-Meta: U2FsdGVkX1/IdRliTz1kaQIeRVlmoXgpuWJCK21qrcR+jr5KaHfNQ005rlBpeOBDtoaXGBUsQdY+6QTtrCQuuiZ3B13ZJPiQGv5FrROoTYJX+Q3rWjuTWjU46HygV6BL2XhD9MZZBf6HOTCN6EOKSK1PablesMzNoXdt5sEpPUGKpJ1CMPoz4lu5pVw/bPKLW4tzzDbzHNELoRUdVq2H0tfR2vSFVTE/0mEMll0PgrX3oxOxU5TDvx1+ASSQSGOVAEK7aQM3bQnCUHDCdHTI1IAEzGp0r0tF5sbzunheU512Djx9f2+8diDwGGseRl4lRU6WNElyJFfSJuEgfF6mqmjrT+u81j1C/sYMetsI9sbomYqlIcJ8D2Pbf7u7wmEtvPOL14SSuQSl1Yur7USjAoJ2YOjYBCPg6XcSSE5DMELYhgfakH0IUjabbLNKKxZRMPqJgZZwwMNNBSVBRtzm/5YRGx3q1macIKpEnK7wwH++yO8ny0QQyaSlv595kaP3YEg0FZU7qtdhajdkBFg24WR1oXB970BNfmQzj1BLzVu+T7iQ5+nDtO0BwuHk2WMcfesxdNEUZCiJccP9c550JNaoWN/Rnb/6Hnjjs5y9EYjn5AH9R/lxG/WE0GYRaGeuyfoZ6CObeoQIV2OULN3FXJy08TDE7iszajv+cSJlTP4uV3gm27eBdMIcGdiJyq3ur+zI/ULAclIA+kEc0aSBT5LMskB2Dq72P+pGL/UnmJLWTmRigfP8G+ZXVFxVV/dkB25UjHvysanaxPca0PiAuhn5/jadZ3b5JWV9ULiELjDMzZC3D603ilKwEU/KD728CCuS4Xo/9MycYaghFCHDhhxmBqLge/veakmd0Q7u1oNVNHzVFHCsXyShLss4wiXX6J3LmWvC4Yvtt9rHC1nr356gXvMZEYDpJAhWxkeqDwEKEM6MBDc/QvilzG/cliXZyqQpL8uMVhfdiiEtvb8 r7GFlgC4 bAC80eyYNxavNrTj08n/KFBcLFrZRCv1QriWHMpP2HowZbNfWdJKBvsogaqasIPxiTgkMEDyn3o6PYJmxjYcdRc3tIsf6yDHhnk7n896FVa8uuFIBb31JFlCoXnQF2vPqiiuUXBTRB58KfWld/0P/kxr9Wuf8aqWo+LJnlrkqigAWKCSG6k4zGW7/V7Y0d0HSD48eUwmBZDZKnow+x4xJT+clFhN1OdQoNBlAdLEIZKMi8awLpaNiV7fU723TUpcn1poCzHpqP698b3WDhRA7JV4exSwLFSaViSt2HxwfIPfr9AiGUAkclu3rBXrmdM8vBta1zZKVVVDnAmAhhDCsGEupyb8jeeFXtpJqm+vLWlqdm9JbNyONF6Rbn/SKgPSqP11x1q+OFkmch4OXhoqynlVNXfjPsJEmIdUC5V6Ik3cQn4pm+ByS6LltmoD4A2BGBC+puGjzYSlTsb/fCIpw1966rjVWOmjpopn58AJkgHCzb8aVNoPxBDeH/aNz2yxWByNT 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: List-Subscribe: List-Unsubscribe: From: Hailong Liu commit a579086c99ed ("mm: multi-gen LRU: remove eviction fairness safeguard") said Note that memcg LRU only applies to global reclaim. For memcg reclaim, the eviction will continue, even if it is overshooting. This becomes unconditional due to code simplification. Howeven, if we reclaim a root memcg by sysfs (memory.reclaim), the behavior acts as a kswapd or direct reclaim. Fix this by remove the condition of mem_cgroup_is_root in root_reclaim(). Signed-off-by: Hailong Liu --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- Actually we switch to mglru on kernel-6.1 and see different behavior on root_mem_cgroup reclaim. so is there any background fot this? Brs, Hailong. diff --git a/mm/vmscan.c b/mm/vmscan.c index 76378bc257e3..1f74f3ba0999 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -216,7 +216,7 @@ static bool cgroup_reclaim(struct scan_control *sc) */ static bool root_reclaim(struct scan_control *sc) { - return !sc->target_mem_cgroup || mem_cgroup_is_root(sc->target_mem_cgroup); + return !sc->target_mem_cgroup; } /**