From patchwork Fri Dec 8 11:29:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhiguojiang X-Patchwork-Id: 13485326 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 BA237C4167B for ; Fri, 8 Dec 2023 11:29:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 53CB66B006E; Fri, 8 Dec 2023 06:29:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C5626B007B; Fri, 8 Dec 2023 06:29:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 365B96B007E; Fri, 8 Dec 2023 06:29:54 -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 255CA6B006E for ; Fri, 8 Dec 2023 06:29:54 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id F133D1201AE for ; Fri, 8 Dec 2023 11:29:53 +0000 (UTC) X-FDA: 81543431466.01.D793F3C Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2127.outbound.protection.outlook.com [40.107.117.127]) by imf12.hostedemail.com (Postfix) with ESMTP id DA55C4001A for ; Fri, 8 Dec 2023 11:29:50 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=LGk47gbs; spf=pass (imf12.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.117.127 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=1702034991; a=rsa-sha256; cv=pass; b=MUYndzAAyUeZlawj7KNEivZ7LVXyAO0N5csOmAujkbTh6ezWv5EURNzVEMNq5aVu71NTNQ /6vBSdj4vLgxBYmJt+SDLkjVpmQWzzOwuaGoNwvH5h2UKKjOGZQwXSuUG/0t0ELl4HOV7D oajzykOkHAOyHr4id/b4QsxIKC2kugc= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=LGk47gbs; spf=pass (imf12.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.117.127 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=1702034991; 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=3tfh/duRSEal8+BthvyainR0gBFaLRLugZo+0ba2KD4=; b=BHMUuMK/ZeJf/oUVHK11a1JB6SbBDBxq9mQnilFS7ryH3tn3Vmzb/1lMU33LLnFqs4aqbx 0b7Ho+RV0xkihXHoAzTN/ERJMC9TDf/NhcabhSzCbaTCw4sBFpSr3gu4HgB8d6aqz7Fw5x COfmagJUnn0MHEdnBw8y45Cix/mPd8M= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DtbzbkIT1/droRljVCxM1O76/NTRXt2305pKtMOEZsVWx2BluNw0b7e4mXinHiPQbiGOuIISkIucBLObF41NaL1o2KabU5bwrLvAuPyOkFfih/M22fcyRy9FwkUt4BGHqbUG8j7JM6geW5NSuIaKZp9fLc8gwYGxBpxbYM3NtDFtHf/IX5c1Z4Kewf7+vqFsJ1NuRipwj2UmxEjtTJSQTkU39kI6tNH2UyZtscJMuYMKT8Xt0WssFZI89fiW8yEXY9D7y9mFSLHgFbJ90MYHP+Qe9Ognyp6VLmEvxS4KkDSmTthrq/0eHy0pPpqexnAKuBdFjTV7f5ENgFplQOENfw== 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=3tfh/duRSEal8+BthvyainR0gBFaLRLugZo+0ba2KD4=; b=ZTkYoW8CQ84sJmVAqrqsJNPaFrrESSBsElseDEIgMWiE9BxDEg20i8AV0jKPdFPqUiEZwtP45SEwpvJmr/g+o2bi6G/rSwLZa/6uunSqUv3d6aW4nksuuTGuxMNTg2lJWA6RoIkQYWye4dxH6xBYmx8sGC50ISmKkaSUj58D5elfZ8JlxjX2l8HzgZXL+3ktqFwgWy3WxO4YdkYlxw/z/VtEjgUXU90hdVMD9BDMTFkT7ZfbQZflbRGKYnc/vAO0mPLAlFGWCqDgRSmbVPzhZmJI+RA2XW+qtsIRzZKyootFY4temMwxSCQt9qtYoM1+V4JYufiIXH9X0NZel2aDDA== 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=3tfh/duRSEal8+BthvyainR0gBFaLRLugZo+0ba2KD4=; b=LGk47gbsMnRh4LmdcSTGT7Y/QvAI6gfWOYcjF6D+pB5Z9KV8h+EqRXoPQgsOleZF0NibOQxUQ1WYG2ygJYHjiul02qxfSGBC8oGWuv24/plljL7n/4l6/gTHt5sfl2z4oKaTDENbiVRlh87m5TdsY0tHkAsAsyMWVrNQWrmfatbK4vKElQ3LsfZWTU9ld+VyMNWp90fCCzg9HvJydiZrgYQPIakfCEEDyIzhPtabADn7rxNUb4oL475s0OHAKTEJyUz75uf7IBDvccHEolveoYSssHv3ccpsSuNQVpE/oR0ag3891rRlaqed2SdMCRbLxWoftTjTny70I4r8U/QgXQ== Received: from JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) by PSAPR06MB4376.apcprd06.prod.outlook.com (2603:1096:301:79::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 11:29:43 +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.7068.027; Fri, 8 Dec 2023 11:29:42 +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, 8 Dec 2023 19:29:32 +0800 Message-ID: <20231208112933.1385-1-justinjiang@vivo.com> X-Mailer: git-send-email 2.41.0.windows.3 X-ClientProxiedBy: SG2PR02CA0055.apcprd02.prod.outlook.com (2603:1096:4:54::19) To JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: JH0PR06MB6849:EE_|PSAPR06MB4376:EE_ X-MS-Office365-Filtering-Correlation-Id: b75bb137-b9cc-4863-2117-08dbf7e0f8b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2zX7unz66cSZOFE9xkQhT81AHjmFuDjZlwq8YWK2trXGKTzQ7QUt95gz1aW3EJShM6gSOv57pqpVGaWBbbQ67f+afH74rU6wgmxmJSxp4IBRhSXhKUc3mifgP9h4zKEyxvzHS2zTMdniwshB7/j+b28kJQXKcRv5PODzHrV3OaWtVZQhqu7mkda+HORyvJZ5tm2cqGM5oK5dkyiskt/sHu+Xovzg2SlUa8izYpovCw6p8R+57p+/sURExvyjaEhUKP4mYRyCGknhIefozIivpkC58CKx+FFU3dzz+A5d5AFbsVDXgbEE/7S3R50KfANZoS+iih3QHD3XzmS/O5ZNDAYZIcNiBQc6CQoBafOsHkQ4WxXGSqsVigLvSE0M01PAQ+WrSZgrNCPdWW7QE4xzcwqFj9uj9M9WidaywuMVBZE3GluD2FFgqRh6D4f9fjow5NkNYu4AIy5xtfZc9T1z+f33LUNF6d2LdOV/a/L8yrEYhEi2JRzlv6tK+MsbMz76cQ+jOSMmaldv+XlIqm4B7V4fcUoRJvZRyqnoa0pP+B8eW3TWHsKrCymKC5xgN+iapHU+zuUUpFQDf1yZNu6ZR2sBZ+vbHX4dsM13WqpZU37YRNwpqi6usHveWYvdoJPXRDvO95r/b0qeGKVXr3AsLw== 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)(396003)(366004)(136003)(376002)(346002)(39850400004)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(86362001)(38100700002)(41300700001)(83380400001)(38350700005)(107886003)(8936002)(8676002)(4326008)(478600001)(6666004)(66946007)(66556008)(6486002)(66476007)(316002)(1076003)(26005)(2616005)(5660300002)(52116002)(36756003)(2906002)(4744005)(6512007)(6506007)(14143004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: AiDQ1Cu1wr4ACKuChvrccFwZWXHmiYsTX04YwfbOMxej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LBWfFKjKzUh/WZwtWy8k05TI9F0sZ8GdV53ygRKDZFHZQm/UPa4SbUL7ep3HqPrcmAqvJoHXIzVOJ9lx7Lg2oK0OBWkVCedQP83mF+CgVHtdE0poou7QtODIoZSWeUBAfO2tPtFwwAkZ6jMeLhmky37ltfF8Rtg62hj1IToSlNuefE/thAF+NrMo80AQTjE/Lh6D4jYpLIIPPu4EFN1GLpGhR3++GPz+lOs/QqevlspntPrNq8h9jhBKBnejli+0uAoHHcoA1Z8krIU/2XCbz7AUzuT3V1I5Zoed0AbCUaP4WzPnwgMXIj+kz4e2E9IGPYhCBiXwlAGOapc8doMD+gyJ+IVNoqmJjFL3/r3I9EKC4hHCCYljzbbryH7PkNW4P60Q3OEwBgIz43RU5Y9oINqRxsli0zR5tnyk9m2mA8vYtucxZuOIAHKrrigXQHRMVIj4gbDlqHJhJmuCjjFPzmqoyDF9 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b75bb137-b9cc-4863-2117-08dbf7e0f8b3 X-MS-Exchange-CrossTenant-AuthSource: JH0PR06MB6849.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 11:29:42.7592 (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: rJjJBapu7ytP5H8h90+zviV7F9ekNbYIOhmcwXwavw07t+5+k7kbWBb4DBVxWfg8j5zXPjOKE6NYQYv9klDVmQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR06MB4376 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: DA55C4001A X-Stat-Signature: hfnoft1y6m573qmyyuk5u7n34znxsr8a X-Rspam-User: X-HE-Tag: 1702034990-880400 X-HE-Meta: U2FsdGVk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0qgdLGcZ4hdZCT5vf1UXQ5d6JbjsCbmFc1XaHgSS6JlIr276wcH+xkeoETWcRd2wamU+DMFOK2+9a2JIMlLlU8+r7qKtqjJMJdxflbHmMIMPUIUkqGuBeNShESeOfEsGBCIad+5t4qc1x9An0EXYiZ5HrOZt3ir5z9ZT9Ht66XfwTdyWI0FOMIiha+fLHPR3o9Tthr6jNAZkY3oZsHq1hlD8Hti/zloUu9Rr8b9/Ajz186g= X-Bogosity: Ham, tests=bogofilter, spamicity=0.004391, 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 | 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 4e3b835c6b4a..12680c392bb0 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -5908,7 +5908,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); /*