From patchwork Tue Jan 2 01:19:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: zhiguojiang X-Patchwork-Id: 13508738 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 0B4A6C47074 for ; Tue, 2 Jan 2024 01:20:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 06D936B0261; Mon, 1 Jan 2024 20:20:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 01DBE6B0269; Mon, 1 Jan 2024 20:20:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E01A66B026A; Mon, 1 Jan 2024 20:20:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D247F6B0261 for ; Mon, 1 Jan 2024 20:20:00 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 93E2DA149D for ; Tue, 2 Jan 2024 01:20:00 +0000 (UTC) X-FDA: 81632614560.30.CF21493 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2101.outbound.protection.outlook.com [40.107.215.101]) by imf22.hostedemail.com (Postfix) with ESMTP id 6FE0DC0005 for ; Tue, 2 Jan 2024 01:19:57 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=WwBL9CO3; spf=pass (imf22.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.215.101 as permitted sender) smtp.mailfrom=justinjiang@vivo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); 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=1704158397; 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=nFvgQOvtF96Ehy9KgKAzMVqul/6o5kdBRKcfu/b63+A=; b=E0t9vZuJ79TpvXAByVjNh3zF3aKg4WlXl6bfYaY2WCONuaU9vcPE613q/3I01oxA/dcobL Oohfcjxa06wGpeSo7bdqi15X893YzWnuJ3WQYmMabpHzqLrpAteKLYI/Yih86DwQIvfFV/ MRo6gckyB/7CBDUpv/pY7vc1U00gW7E= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=WwBL9CO3; spf=pass (imf22.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.215.101 as permitted sender) smtp.mailfrom=justinjiang@vivo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=vivo.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1704158397; a=rsa-sha256; cv=pass; b=nMeYgN8k1GkRUH7NsZ6Vwy7nWERZhCy4Hv/xB0E/S79Pii3+4Opyvbndw8nry1+nhne190 bm3KMgxAi8MyFPHwlUFfRMnUh3na7zldP4RjB3F6OkH6RzveMwKmsehMgv5E621CAfoHEM JyUZM77qM0yXxfLqeJUJaHRaDKxCTIc= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XoVjnxBufqkTfXkZnyoaT/xSGmMhwPtwiwFd67N0JHLqnOXsfK0cBBpObVf0rTJLEmSQi5cnugRzQl9zapwJlw+xSAuWnp3D3/7Pf/BpYgBOV4HpmqI/hHb1OwSmDWD5wZkcZRyaD1S0ObHRFTNLfGZM4DBbKhVEE1fB/xLGi6OqbZ/DIPNRME2aP1x7k+LEMyaQDNnVRUM1nJA0NN7+ru8vyFcndpYwa2EQKH0/4Iaba94uzRen0YkfN0HZwmyXd3p9BHvII9wPMJFZmzoWOYpCkAIcFuYLb8hjyfRO/RzcdrU38pIfugI+/UnYNe6YtiHQvOAmuMV08kyF2+c8kQ== 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=nFvgQOvtF96Ehy9KgKAzMVqul/6o5kdBRKcfu/b63+A=; b=NkjXsiA+GRkxuhBrGsZrsvSJC2VBh54d8rhFmt5z5V/dAFVjyYUImJjH7ccFZr0GxakfU+tYZwoigvrNoDP4bf4NUkIHGIS+RzS4VcXi6LbuzcgLjkvJ51CpceLHQ8dQq10LqOcgneBJWbqyJLn+CmEaU5uxce7ewUMENekbWgrhpzhfwP4xbgFpRd9gqA+MSegdU8Bq6n4mwI8ikXN4mXQo2noaz/u8sYV/ritFhqkSEhEYMIottWD9fOaagubYMe9hE+W7iy87cOi25G1iiYYiOKYSZgkcb7fB6gUC25BIVa2QJOzr3RxdZ7gv9hpOuVbH/lc4HUTO13Lh+SO4Cw== 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=nFvgQOvtF96Ehy9KgKAzMVqul/6o5kdBRKcfu/b63+A=; b=WwBL9CO31rQs6PZ+qa+s+QJRmDLzYy2igLrhLEFN59sW3ySqVxXYtibTgNXNS9hBmmlFXF75o1h6R2xQ22SD6X5Z8PigzifzUGN/hwJCpSPJClR4/8/mFGdQ1ChPkc5Hf7rQeUEMp3HxXWCsJUUM9BGnTqVPro3Ce+LiQhbgS4fHaC9tt35ZSHyO8vU4T1aObOaFjIeABpm1UmMu6Y4aeE3a40m9JGDI8uPJQ8HcRXr8dUeMiFbqjKdk6PhpZxv0wXMiT5RG+bWXkSGJM3Evi2vDT6EC+ISSic5KejqHFB8KI7n0scFG7uKFNrgnsUYRs7fn8zb5NgkmnwZFBS6X4Q== Received: from JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) by JH0PR06MB6583.apcprd06.prod.outlook.com (2603:1096:990:32::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.25; Tue, 2 Jan 2024 01:19:51 +0000 Received: from JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::1be0:ebf0:eb04:6bd3]) by JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::1be0:ebf0:eb04:6bd3%4]) with mapi id 15.20.7135.023; Tue, 2 Jan 2024 01:19:51 +0000 From: Zhiguo Jiang To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Zhiguo Jiang Subject: [PATCH v2] mm: fix shrink nr.unqueued_dirty counter issue Date: Tue, 2 Jan 2024 09:19:33 +0800 Message-ID: <20240102011939.1026-1-justinjiang@vivo.com> X-Mailer: git-send-email 2.41.0.windows.3 X-ClientProxiedBy: SI1PR02CA0014.apcprd02.prod.outlook.com (2603:1096:4:1f7::9) To JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: JH0PR06MB6849:EE_|JH0PR06MB6583:EE_ X-MS-Office365-Filtering-Correlation-Id: 781873c2-4b1a-4080-2dcf-08dc0b30ead0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AIna4mOw4g7yXkM/BS7YzQRPbiJNH38dE0r/wkr7D3riJZ9MEI8wqWP1Ma5IUM0lLR6VKEFtNK2R7W6breQAbsl+89qUBZqNtPcIId4JYUKP2Jo1ePZx4mFcDMa+cDWgKdjxL6A6ylGW8e+eFR9rWUCNy+NF7R6/Y//YDIPpN7+fbrI9mrkFLXqcPJ9qWmym/gG30Bei67MeKyeGA6iQEf3vnJdakB71hwQTu9sLENkxrBwhbXpWb1SF5hJc/EuciTB1Dhh8W2ea3bRI+2h0VlXKNSAe63vaqriGSSWPjornQuJQN28FDU1sROsU4cGFTWoq87kP1aKn/ExThXWd6AMR6k0rvwERUvEDM2DpbLa3Oqbpuw4zg1+TGT4/Onna7YYwut29HDiQEXOlSCEpFPz/eEmC6araE+XBcxFdnZEcl5BcQqDFFpOcHHvnohukLcQ0VSsTULIt/k+Sw2UzwlKyogP6JTMiAcjXk/gSyfB+d68GAAXjctZpz29Xim2PsYE3rVnf184kVGFK+zxP0JtA75Ws4HRdlf1GdQD9Mpr7L0q9cxPl6KXcFCyKPCMxvmirQQ7Xvq7f4sEoD+Psn0uuOVCIV0Bwa7o9byf70/JLkO0wCtvFqBltA2Nnd7p1bDU3J2GXMUo7JSAc3pyJqw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:JH0PR06MB6849.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(376002)(346002)(396003)(366004)(39850400004)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(26005)(107886003)(1076003)(83380400001)(86362001)(38350700005)(38100700002)(36756003)(4326008)(5660300002)(4744005)(2616005)(6666004)(52116002)(6506007)(6512007)(8936002)(8676002)(66946007)(316002)(66476007)(66556008)(2906002)(41300700001)(478600001)(6486002)(14143004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiS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p3nGHtMsZd81TlwBNEpoFKnebgeKDXZ5LocWhpMBG/xc?= =?utf-8?q?6biLxN8nK8ykNUPbeJw84TUCihbahBVYMVKcZJi1M/LXjCzZlGofW+5dgzusIwMPN?= =?utf-8?q?6F7E/Eyj5llXZeCdjjbslkT5g/A9w2KA9vr64L7Og9FfVsL0UKLxJBIYPydEUSorq?= =?utf-8?q?hyeNS3+HAJ6BAh7tJJRz+CjtJgm0HU1WqACoW3bNAMjW80Q5oZ4SNl+9djUPxWEkR?= =?utf-8?q?8cgpaO11B+nU65D6lG0wfOrVvBmVbQsXTv/o7kQEKgIwMYNKgtL1Ct8gErLL/f/8C?= =?utf-8?q?Wf+TU3t/eAsn4s7wbU3Mqg/M+5+0xpBeH0Jiau8RP4X2wJvhw656wsAAEX8pl88zl?= =?utf-8?q?LEypObOi7SypfBe3VX+ihl4kk1sDcCM4QrKxy8vzhrPH9DmzlH8zXwXb+ytIxgkqQ?= =?utf-8?q?SMBLYKpMcg9XOdVxZT6WUeg0RA2KN+8n4WnBMXDfmDV7ZZMeXnDMuQb3a/Er2OUyr?= =?utf-8?q?yTGpByelTW15sNc0qZnxNUQuStwe6bWWXpFIBy9ZmO+lVFNhrRImGvHjFspMDpwzL?= =?utf-8?q?N/T4IuEIi3IM1bCgoH+TihO+TSvqaPsqpcN/ezXjlKP/IDOByDNWc2Vat6r2965DT?= =?utf-8?q?nqTLthPngpFKDgJBhOx5pcXRfXGXPeYOCwx02XSALhLRQUePj2xJ/OzhWZiDv4p4X?= =?utf-8?q?L06oe966tWPL?= X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 781873c2-4b1a-4080-2dcf-08dc0b30ead0 X-MS-Exchange-CrossTenant-AuthSource: JH0PR06MB6849.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jan 2024 01:19:51.4469 (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: tIvc6O1J3Ed4rOWDS8WhMHK1FviKkGFyAIHxDewtQlgkhzbT1WLt+E0ffimW5w6XaIGcVuj1qMXIB9D9h3m14A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: JH0PR06MB6583 X-Rspamd-Queue-Id: 6FE0DC0005 X-Rspam-User: X-Stat-Signature: os73yhs4dzdy5mfiof111gy86fqhi4ap X-Rspamd-Server: rspam01 X-HE-Tag: 1704158397-660515 X-HE-Meta: U2FsdGVkX1/LzpB1ocxh6te9u1hCAkU2fYpf6jo72Kz7TrtjxjHtRyGXBSFGsTrpizohzJ0o9Bl3ZJFCs/EdaUmunPG5LGixWeLN9YBJfDVZbXccP7TYUn1lh6k3cXr2ggJmJoOIS/XTJnIyu56LSLTcDAdHfA2UsmDFFj9Njive6YkLXMQcS/35hx2qTJd/lY5Wx2j4dvNaafO3CFZ1EMkJ4XNp036+7pkd0Z4GqwJh7TE0MJbMn0ueqzQrUB6OzrH8JJQfEGiOb5CE1wcA4tgQWGEOaJoPXk3iN+yu79bD7S6n2jamV6ACwl1Dtupd/DiQtlgyf4Mq0cEwK4sO3bIwbo3voY4RMiuX709/Gn/QR700/0ZyhekF6Y31GIuiQNf0GWfE2dGgR0GwM04RNCwcdyQmbq58fbYC3rbCgixad6c3ZvrnhEMgfEAqyiJMHFnkzD6LDtYPxDi5PqBH/6x8K+J6evOMjvnCkhAdbT1BYcHMSfYc3MkhkeG2fiXc8+mmI+N7DbRPtyje7aMf5DQTcoHU6RdPHwwoqrBxakvwHaRwVGZZi3Bi+vOBBeXUTyOMWljePwsiB5LWL6cbQfJuKNquTF1CYmHFoJb+kE6+h+8s2HbJ+RtfFKCQtGE0XgwABpkSEsfMNZqkLNdJfEQFXIHzU5Mcy3o6n90twOBlkkMbyKoUxBywG+3cr5OWaTKLa0BEgtJcwlSJULJeLha3LeOQ7nedY5kMWXYPPQ+153FM1i89d0O1v6ZeMmlWsv6eq5BrfJ081p7WiyDtAKRBM/4E1H/7vh/855o3GPgCdvGqjkqkeQ9E2poQlAjjDKN9RyBrP/qtXjYhBG9ENot+DeJRaK8YzYsdVKeWvZD5uICfk88P1bowIpbsWdeOxB51/sZxO4HtyvDvgrhVTUeNpDvT7YhRZ9R5pj83uLUv9I+yCly3oaMEO3Qi9L64oru2F1C4q+ogNA4+dEi 5Kv35D0J wEP6R4CKcNYv5T/IONyXv3ghsxUpB5XSAa/jDoW6Xzm5jX9S4dDrKCKLi9yeLHt7XkLnRMX30RNC+eKbHaCEB5OYo5xP4em5sC2mYBQ/qV1Af0XGez2WePqPkDOlcvVsDGv5Y+AIhrPYEN2HI+AG0/stQdz+Jr9dLq4RPX4uDXII2Ub0hhNSiWQtq0Qx3fxsRsb6ZhGmiFuE82GCmYYsEmYRWtfU0O2owPhfshvXQ8xnr3dFqV6T50zaR3BmW3QoQZ2Y/7IcSTK6vmPUpvYXLhPf0bnnflwDQiOBwt20E3XY+OLfiiLFqUgeidrLOc+g6Xnr2ZYQ3UqyQ9FSoAwHvx6LM7fnbi+AZ/Qd3/JxkndWyUMsYx2hCNhEydVZSXSqgwsN+ZQHb3Eut3BR8KM5yuPsvjJnukNnwzfUBpOy++AfptwDRo5Slu+1E//W2GTdxfJjEaAIa6pA7Qf0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.006924, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: It is needed to ensure sc->nr.unqueued_dirty > 0, which can avoid to set PGDAT_DIRTY flag when sc->nr.unqueued_dirty and sc->nr.file_taken are both zero at the same time. Signed-off-by: Zhiguo Jiang --- Changelogļ¼š v1->v2: Update based on the latest version. mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 mm/vmscan.c diff --git a/mm/vmscan.c b/mm/vmscan.c index b4ca3563bcf4..c00418e34dc3 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5914,7 +5914,7 @@ static void shrink_node(pg_data_t *pgdat, struct scan_control *sc) set_bit(PGDAT_WRITEBACK, &pgdat->flags); /* Allow kswapd to start writing pages during reclaim.*/ - if (sc->nr.unqueued_dirty == sc->nr.file_taken) + if (sc->nr.unqueued_dirty && sc->nr.unqueued_dirty == sc->nr.file_taken) set_bit(PGDAT_DIRTY, &pgdat->flags); /*