From patchwork Fri Sep 22 04:14:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhiguojiang X-Patchwork-Id: 13394907 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 A05D0E7D0C9 for ; Fri, 22 Sep 2023 04:15:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A484A6B0261; Fri, 22 Sep 2023 00:15:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F7DC6B0269; Fri, 22 Sep 2023 00:15:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8982D6B026D; Fri, 22 Sep 2023 00:15:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 776096B0261 for ; Fri, 22 Sep 2023 00:15:20 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 33E0C80994 for ; Fri, 22 Sep 2023 04:15:20 +0000 (UTC) X-FDA: 81262918800.04.3F8A399 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2126.outbound.protection.outlook.com [40.107.117.126]) by imf24.hostedemail.com (Postfix) with ESMTP id 238A918000E for ; Fri, 22 Sep 2023 04:15:15 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=C3DSxKYt; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf24.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=1695356117; 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=2t8UNqZ91plZHBALd149ETXAJYAtNkZTNbL5vXPLBpY=; b=kAstM0k7nO15woHNe/IpJJBEVpFinagOh8uamQtXRR7wpb9baIFInDsPB5MwB/uwG3KEGN XWWb4j2nKMon6ZGfxrRmN6HcJ7/aLkqLGZYBiSyFBV71ykyNSbjYVEdUV2fY+TC5jOsvcT CcMCNHHWMbEug/YvPJI/fNLXWMUsMKA= ARC-Authentication-Results: i=2; imf24.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=C3DSxKYt; dmarc=pass (policy=quarantine) header.from=vivo.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf24.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=1695356117; a=rsa-sha256; cv=pass; b=HFOYg+flHKEIIS66e5UfBW8yJXZd27NJEyAhrprGlh74B90bMoGSIrObnBBtjChWwHFg6p 7RvP/+0uSI9irMsXgFr61SBQn2Nseu4CctpN4rd/44ljTd4PB3IqYc6OSTHgnY1LeGPwQm dAwKz9+DpSxKp8UCH+i6GXxM63oz2XA= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l3ppE/YU9+09pTEUkABxreIZxqtQMZHDiEsGMpHtyeDu4RuXJuCkd5U5h0mmXsIjTywqxqznu/b0FKYj+tRvKfEENL14oz21hfGSuCPQkEkg8MaqoOU6LPcF1etsqB8hWHvb9Nw09Jo5zBeW3G7GecSIdKFwGN6OGWiXYHcbAu82CsvwQeCSie+qXJyPRBBEP+ClXSM3ywsAU007Zgg7pVG3NKL4j0mj4nE8JNwSTMaUMXEVUbaISbpn5wYF2MMHbeHCwgmfjtz/MiFxMucyiTNB+p6S/fI7ohT4kwu0OV1lK8pco4mQ1Pgy5hk8fUMdU1GcgYmjnlqqS4q/Cq6C1A== 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=2t8UNqZ91plZHBALd149ETXAJYAtNkZTNbL5vXPLBpY=; b=YDmX8ztWo9pOh6Ao/pOa/Uht4bcJghh3NT6ZFfdceDic67clg4dfR/KjiuqsDQ6oDm4fEvpXNhYf9vUZH/nt//W1l7dDnlbry7it2X+X2TY3/yy5PSraGPpgqojO7mEfW8111QIe3pjBoxZAqq3Nzf7Ou2389jzQxNSbgkxD3slKvQZzbAa4Ho4rMW1zeD5pxyStHQNP2NCWtFcXTX+JymMUxHbO8zlkm5o+Yt6s82pPJZ628bF2Y0tZl0OsFXw/Q4RDLEgRjucqAHpuk511304/eQZfR/90AFvNcurErez0jmGeJnJIwD/gFWIKVvfRUzAmv4eszS/feK50S2t6AQ== 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=2t8UNqZ91plZHBALd149ETXAJYAtNkZTNbL5vXPLBpY=; b=C3DSxKYtN/30YoWp8iwzRs48065vd7RSIfe8p41hihdkPQt2MjxRGgasck/8idwu0KYYJQLg5eR59ItoTnPgAE/Ye+yXFMtv6FyBh21dXN0qlhFjRIX+qJvqBPvPWm7xSpNl98PooMqO74qgIao3JRLSmcI0mazZH3bfrIGXUuPeFjaxQuv8kcO0FLKidY4sVWo5nmP5RzfDMPpOGlDUsTE/KnalbUfvSd7F8Q/IpnXigwChCDMriDJKrQoj0Pg10YwEDq1lRVthb1dcDUK0if90MMePSt1miL4CVyWpUMqMIGLF0kDyLCpOqV2gZUXfaAl6gdbht3xjaFk2z+0bGQ== Received: from JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) by SEYPR06MB5326.apcprd06.prod.outlook.com (2603:1096:101:6b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.29; Fri, 22 Sep 2023 04:15:09 +0000 Received: from JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::832:19a2:2f83:1cfc]) by JH0PR06MB6849.apcprd06.prod.outlook.com ([fe80::832:19a2:2f83:1cfc%4]) with mapi id 15.20.6813.017; Fri, 22 Sep 2023 04:15:09 +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: vmscan: fix the kcompactd order wakeuped by kswapd Date: Fri, 22 Sep 2023 12:14:58 +0800 Message-ID: <20230922041459.122-1-justinjiang@vivo.com> X-Mailer: git-send-email 2.41.0.windows.3 X-ClientProxiedBy: TYCP286CA0127.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b6::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_|SEYPR06MB5326:EE_ X-MS-Office365-Filtering-Correlation-Id: fc2fdce5-b7a0-41b2-47b8-08dbbb228222 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pl34tSMt4BIZp7eCiq87mC3maYGm6ZMzE99vyhHt1vwBVTASUxNgXt8hSmut5ZkpWLY+HMFsRMnApIfNiR7IUfBMWpPHFa8M77kcrNx/Ihuus7AVDC/azhWio1A1WCNiqHGACI68AaEQA+t4x5w4yra6ONvMIzjT1AoQgoVZko5eJIuKu969noLftIZVhcTU/BYzm3oIv9QZRNEyB/EkcwxJt1If09Xat+nNiTlBF9bZam5vMLN/xSbLqYFCzJUqY7qpVDjMK2uvuGk5Duk0F+8hm4ysQZ6/JKvNEH3tBlJ3OmeIboCEZfhCulSftReqNHQrfYOwnBIsZsUz1YDL52u1gXWqJNpEaTh7aCXOFT1TK83WGj/+fznVTdnS5mkVCSPHF/ldbv2iGt9Uyyxbn+1C5hyoPiYt4FxKQAgKBhKQ09liIHojYXwkfNrs8gSSMS0mLfy6N8MJuEm3bS5/BKaxtpV/JX52XzqNTVK9hJ+HphKWpIihb13ZJ4vj/nZbol3QrHo3FcHe8zi0DOp76zkoBlMgbdcA42UaFit+vwbAGbHAeFB7nyBpJ4eTM8HpBFyOvHdz6V+F9Hz5CD2O3gUO8y/pHtQSLsDlC7+q1sIY5oVUwAeCvkUPf0Pa3I3u 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)(396003)(39860400002)(366004)(376002)(346002)(451199024)(1800799009)(186009)(36756003)(41300700001)(83380400001)(6506007)(6666004)(8676002)(8936002)(4326008)(6486002)(52116002)(1076003)(86362001)(107886003)(26005)(5660300002)(2616005)(6512007)(66946007)(38100700002)(2906002)(38350700002)(478600001)(66476007)(316002)(66556008);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QQYkZJZ9EF6mexnCbXciUz1ip1MYkANJ4t69icxhLknfrJ9bx2mCsJI/gSnfS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njgcmHlMXf2ixFbjrFFjAbq05bf5NKhNStt2sMb3WuLN0jC/1RRMqn5BuQslfeZyVeZWo29fW6B8XzVQRZoCqlGsJBJEjElczyHT+Aia0CE0N2kr8cDoe05wINZKYLv/Y0ZG0+/r7KoyYqSBUYZSOTSwElCRtae9GpnyR3pSMEXrdauqKUYfUn0prQ+6jh68vWf5Vcw5hPh/7BgN/XuYxQKbMBfbZZ6BsH+DmwBZ0RcUr7vgiPXDw5/7hDu0nu/4h42SiyU0pX2GQbbDG32XzKC2a6JB7L0Q2Ofx9kZrPLhc2H1EgyT88epGXp1OdyQPPRMcwQBH+O6HmYx+S8//6D0HCY7ok+0UGLT1qpE7Kn3iHQljC6zDa7ZMBe4xqCBsXe/iMH2VgiBTddZ512cbxA5GRX1FMWQd7yL24I5kQdXyWbCj5x/P+ieDK8UYGqktikrqK5Y9eeAGPSR2 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: fc2fdce5-b7a0-41b2-47b8-08dbbb228222 X-MS-Exchange-CrossTenant-AuthSource: JH0PR06MB6849.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2023 04:15:09.1599 (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: xlPxjtQ9LJ/0uCu+OXlzppKHJwAED8mlmSyVAAJ4x85+IBAVFVzCQ5YmRsbHU1Vyr2DlQQS5q1yHNPheRxzxew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB5326 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 238A918000E X-Stat-Signature: dmrbpcbqnp8uyud35tgy3jzt3e98ehui X-Rspam-User: X-HE-Tag: 1695356115-463502 X-HE-Meta: U2FsdGV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zriiPLWkSd/NFdxp8nc4UIlIjMkJ/W7rpUBetRTgQr+sKEO0AyDYtrpR69h/CKYABgtZ1In+zZxtAafJMyeVtX3c/8hc9sYxk7xZuxrMrFpigRRtBRbUuWVXXVp5N9etywsKMo++mKpwxLNH0DzNoYP/gT+HQSRvrri+1KJmNjkD+ELd9SiEI+eDv3wH+ X-Bogosity: Ham, tests=bogofilter, spamicity=0.001722, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When kswapd enters sleep, the situation of reclaim_order < alloc_order < pgdat->kswapd_order is possible, so the kcompactd order wakeuped by kswapd should take the max value of reclaim_order, alloc_order and pgdat->kswapd_order. Signed-off-by: Zhiguo Jiang --- mm/vmscan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 mm/vmscan.c diff --git a/mm/vmscan.c b/mm/vmscan.c index 48c092cc6088..95883bbe2d29 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6955,6 +6955,7 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_o * succeed. */ if (prepare_kswapd_sleep(pgdat, reclaim_order, highest_zoneidx)) { + int kcompactd_order; /* * Compaction records what page blocks it recently failed to * isolate pages from and skips them in the future scanning. @@ -6967,7 +6968,8 @@ static void kswapd_try_to_sleep(pg_data_t *pgdat, int alloc_order, int reclaim_o * We have freed the memory, now we should compact it to make * allocation of the requested order possible. */ - wakeup_kcompactd(pgdat, alloc_order, highest_zoneidx); + kcompactd_order = max(alloc_order, pgdat->kswapd_order); + wakeup_kcompactd(pgdat, kcompactd_order, highest_zoneidx); remaining = schedule_timeout(HZ/10);