From patchwork Fri Jan 12 01:23:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhiguojiang X-Patchwork-Id: 13517878 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 9D82FC4707B for ; Fri, 12 Jan 2024 01:24:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2F7248D0005; Thu, 11 Jan 2024 20:24:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B0658D0001; Thu, 11 Jan 2024 20:24:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0F8498D0005; Thu, 11 Jan 2024 20:24:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F09E68D0001 for ; Thu, 11 Jan 2024 20:24:10 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C7E5D1C17E6 for ; Fri, 12 Jan 2024 01:24:10 +0000 (UTC) X-FDA: 81668913060.09.C53AE4C Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2126.outbound.protection.outlook.com [40.107.117.126]) by imf27.hostedemail.com (Postfix) with ESMTP id 3FE434000B for ; Fri, 12 Jan 2024 01:24:07 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=XNPHDmfb; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf27.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.117.126 as permitted sender) smtp.mailfrom=justinjiang@vivo.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705022648; 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=Fj5AV5yhLvp46POzyszmbG3Zw2mh0SoZGg7ohwwMVPI=; b=hTwirV2HUE+49As2Mi8qjznKDZgRaHfdyE1dYf5zMHgeKQBXUJ/UhSXBGK+v1ppu8TNpzZ ocXRwqSVtVOpWv1soWdUje/ixmihNNfPB/7EfVDDN9t688lZi3vSty71yC6innA4gjTuNk EK62SGgXl4U9NpONntOL/spaqOl8p7I= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=XNPHDmfb; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf27.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.117.126 as permitted sender) smtp.mailfrom=justinjiang@vivo.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1705022648; a=rsa-sha256; cv=pass; b=V5LD3YOBuGaDaa8ZEBNAl6fV9kEAZ6agz413p8QiQQ2JRjPNs56igql/g5eBNc7wkvfhtu wIQfnZzSEBUuaCZ4wDBy5Wx5aGTQhINlPI7MAs3Q1J92nJZ7vCc4PW3rBg/AWABdg2N7VX RZLwfCR2DJRFRrC90VV4LGeVaUhzsQ0= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DU1Q4XlL39SSi/SzmWPU4Wz8w1jdYdX2zCBhcPJ6FXLv6JexXKYLoImBiAGO5JOzelzlK+JUZRppy/4FcGF/NRthvej7LgIduWQ/Fa3Rm9KUzrIRd0fkaVG3w68uvJ1JSvt+YOBoqA8waEaF2FUOtdhNqh4lp38bhDxkwluVywfsQCA59BIRNFnCxChjwFzgLax8sWLmxdEpvLX1b2Vzeh78BqqPahyQkysjQURCs9bGwHansnd/EFN6OSHVr9aMyuPSa+aoO1X688RZs75FQMkziZYQXQU9HBPRFzkZnnSTYq//rRfu0j4lA9pVlWshToJjBnq8Q+LLCSDOP4Sx0w== 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=Fj5AV5yhLvp46POzyszmbG3Zw2mh0SoZGg7ohwwMVPI=; b=QoAxaUM+hl6aKmxx7taTRpkHKI2Ij4FJEbwj0Ih8e3Gy+PPmzp2NNzdWXTo0YMzqdHL96VpY6GBnV8PU55D4MLKRKedsdlb0+pdTU1SNVIbyLkb9h5NNeLXVlJXfL1A/ORYK03h10Cw2Qpp0evycbtGolOc5VpUFBeSBGnUByiYzDMcLIOnkbwjIGtNVx9hl6toIQ8b5J/LCQi8felJ0wz+ZhJFEwueOcjTKDNwRASz0w8iZWw/g/UnXcmwsT1BFm6Hxks/jrF6qQ6GWYz6tC6hM4jTH5EOpCWQQlYJbt3A51IGM7cuCXu13u1p/iSrTZBzSvwV3HDrsah2ughhycw== 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=Fj5AV5yhLvp46POzyszmbG3Zw2mh0SoZGg7ohwwMVPI=; b=XNPHDmfbMdSY0xZq1KhqTDH/WBkjut5E6rO4ZN2Fb1uDILXYVLmXNKRX+sgpaX8OBJAycMitfUQYNHHnyOg4yNXZGxKRfNR/SkuUclZ4gRyMb/w+eKe6iNjT8V99st2leiCVq7fZCrNvytuTit18NluPfltfd/EvFIRppJIjEYRRkOBez9RhEPfokcPkPHJeSb2nCtutMNeUyxMxaVP2QxpLTTiHXmI7H0hqMv/yhVtyYLcNqAi9hZ37UiGqT2l0gxxEgOxPtDsaK/BrA0VmBcyEw68Th2uGV62Lj+tu4CSjj/vW7RlfY4rn0vaCshIsNcPLD7ckipcPLXBq9XmuGA== Received: from JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) by SEZPR06MB6598.apcprd06.prod.outlook.com (2603:1096:101:187::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.21; Fri, 12 Jan 2024 01:24:01 +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.7181.020; Fri, 12 Jan 2024 01:24:01 +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] mm: fix shrink nr.unqueued_dirty counter issue Date: Fri, 12 Jan 2024 09:23:52 +0800 Message-ID: <20240112012353.1387-1-justinjiang@vivo.com> X-Mailer: git-send-email 2.41.0.windows.3 X-ClientProxiedBy: SG2P153CA0046.APCP153.PROD.OUTLOOK.COM (2603:1096:4:c6::15) To JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: JH0PR06MB6849:EE_|SEZPR06MB6598:EE_ X-MS-Office365-Filtering-Correlation-Id: 95e6ab72-a756-4aca-68a1-08dc130d2872 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zCD65CI4UscfqfeOY9mXgWl/n8ORKX+WapqeAuEiPKFSPV92JeG0kag5K5B4TnpleBq+dugZHGXWH7+BQpewRiC4DFgaxLxjDo8WeyoIP9pWBIiwK5lvUO2cGoSL0cmdhBMKdHuyiAl8auBy7mp8RGMRpa0NQliFLmw64WyhUKU9/vcyWUMzwAOYmMZGgTwwQQ8IMO+hoVXmpRWXIn1iT1e1MrkhbRwTwnHtdhfXNHnphQHngXLu3sQaBbur5Q5vpsBJuQedgfW2cmheMYAyeUDEdJmSv8NdFOkanH2em9JX/QyvYXKsyMEt/b5GtZ71ZWMwsIG0k56sKyCY10jpsa5WpX5+Ge0HlL1JoFEAzGBgZVSvFkUMiyoMPp26gOMTjF361fV8UYS+Y9iUf+uwtBwIS+oMPWaSnb6H00uDzVj/Kfdig/DQZYMnld5VitASPAzERGTsLUkkFyQxrFLsfNqoBwX5nQatO4xX3C3pBOITE3Y34Kn5N0wg/kHUfIa7kX3yw1EugJiX1jxc8KCPLyDxNJTDwmEeQkPObEf+PBxXS12SzUmLAcdY9/euuD/qMW0yAYekO5+1YoYvYYAKRu/2+85rD9wsZdLf+wTxs4p0DTv4PL9bYpa/VzYJZFLSPRJ//Yij4AnX/oJaa32bDQ== 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)(39860400002)(376002)(396003)(346002)(366004)(230922051799003)(1800799012)(64100799003)(186009)(451199024)(6666004)(6512007)(6506007)(107886003)(38350700005)(52116002)(1076003)(2616005)(26005)(38100700002)(86362001)(36756003)(2906002)(8676002)(41300700001)(4326008)(8936002)(4744005)(5660300002)(83380400001)(66556008)(478600001)(66476007)(316002)(6486002)(66946007)(14143004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-Mess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Hud+nrHqysaolAmaqslENo+9RVNDJy5iFvw8RTu7Y6dxMsgDmbMqglVGL/MpiBbYhIMm2FLYdPT2PeLFS/OCxwMdb6wGfRGpJwX5mVeDkctCs73t2RlkZ/vq83k6P6ZPRSzKoMmuvFFi8lN8tmj4djxCey4DFSWQwOiHd/z1TuD/pErViMjKzYGUWzDvOvfb0CFMOI+lF90e0GsnrWdP7cY6i8f2zzIza3fvJuJJNb0j3xowpPTvD64AEaSR+Yh3tjn+w6wcq3b+/S4FtV8PnJhfUUp2OA4VKSarB0Wgk4TX06XmPjFqt07kSl4j41ylvwcFYSC6j6LOOtJNA4FLwTc+4zVZ4Xk8ODelmQHWcTpEW1gMtB0hEbqVAAMVDBl8MuecYQlelCL15kEWtEWgDy0HNDsKW4yMVFm4ao8TxheixfTbRWXTjDkIN/r32Id+AVID/V13+Fue8DeGHGNkfGEOD0+0T+mdREFBAZLYv/vt2OR9L7fWWiYx6hl0M3FP6Xa+knGDevH X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 95e6ab72-a756-4aca-68a1-08dc130d2872 X-MS-Exchange-CrossTenant-AuthSource: JH0PR06MB6849.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2024 01:24:01.5253 (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: XfL0iQRmE4B71HE22yj9SBpBXV6MlH2Dv8HuThwbog+1cPgkS2mPaJK4/J2fzorJlhHjTWXLI4b4Bdv60hD4Jg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6598 X-Rspam-User: X-Stat-Signature: i3uj4a4grnozc5pzjfhq5a1qckr76mmr X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id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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 --- mm/vmscan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) mode change 100644 => 100755 mm/vmscan.c diff --git a/mm/vmscan.c b/mm/vmscan.c index 91e7d334a7ca..7c0cd7ecdfab --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5957,7 +5957,8 @@ 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); /*