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: Zhiguo Jiang X-Patchwork-Id: 184188 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4218261dyb; Mon, 1 Jan 2024 17:20:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHhmb5SHsLkKNHx3zzu0idnysXGQhmBDhW93rD8tB9YihjcxoPgwsBdPK+visOo9C+B2YID X-Received: by 2002:a17:906:ce5b:b0:a28:3418:8d27 with SMTP id se27-20020a170906ce5b00b00a2834188d27mr364124ejb.114.1704158413054; Mon, 01 Jan 2024 17:20:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704158413; cv=pass; d=google.com; s=arc-20160816; b=IofjUIhK1z5eM6UaH5JWrWMLr6kV7JFd4JYMNl/+RUc/74HXAOoEFrZJW+oDyQ3U2t 50u0j0Zi/4HdtHD2jz57Tp7M6EwlKMVNbQG3alEL5hQJR6nliPTv8EXVlbDrXkuu7dlJ VrlF5Vn3iboggmjlJjH3/PehB8e5oCNrv3LcLb3sfmlZgak5iwrEDAEs9bhFRta7qNbO Be1ZbKs8mV1q6qcfZMv+xA8b0QOewoWZdfuHxVhGSuIWvl0uVRQrg/6IDGWYd7fT3huh Af6hqXAQJ7PqL6SbvEbMuFdpF7U1Jvi0I/A7SheS5EYlyEjxmhMEQOn3E+hfRqwQco13 l+Tg== 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 :content-transfer-encoding:message-id:date:subject:cc:to:from :dkim-signature; bh=nFvgQOvtF96Ehy9KgKAzMVqul/6o5kdBRKcfu/b63+A=; fh=c2eYxmN/YNr2ouhP31X3BrePKjLzNfOQt6lh5667ppQ=; b=qVS8bjFGPml+ecVPYPNiOv33ws7/5lQrUf/dRK0hHQ/pIRdwAXE5JMJ5FhmCx7DHz0 KfPkx1QnCt4lLjBxe4aF5Sj3SsjOElWlXHORyK3jfpIkqVCbiLNUNUVx7/2mo99rEupl WDSCCnDL2LsszKnr6LikiteDZM8FCKAR+9qTf4Lg0whfRmZ0ykkePmfcwkwlIAqrEabn WEgRnHE5RRMm77+uU+8emKnlX/QgkeJaVvZIec6BE785Swm92v8GX+4bGvtbSRPxUGp7 DEdv1CpS1qlb6qaspmLkrzg2rTBkppznWTehwdjeLCjDNB1BUa6DW74RJdk8+L62OBGn 8GEA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=WwBL9CO3; 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-13967-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13967-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 an14-20020a17090656ce00b00a27aa152f29si2583573ejc.416.2024.01.01.17.20.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 17:20:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13967-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=WwBL9CO3; 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-13967-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13967-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 7FE301F21734 for ; Tue, 2 Jan 2024 01:20:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20A8E15D5; Tue, 2 Jan 2024 01:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="WwBL9CO3" X-Original-To: linux-kernel@vger.kernel.org Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2110.outbound.protection.outlook.com [40.107.117.110]) (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 BDA9210F3 for ; Tue, 2 Jan 2024 01:19:54 +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=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== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; 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) 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: 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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6ANgONqm0XSxmkYTk/70p3nGHtMsZd81TlwBNEpoFKnebgeKDXZ5LocWhpMBG/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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786939612214607630 X-GMAIL-MSGID: 1786939612214607630 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); /*