From patchwork Tue Sep 5 15:32:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zhiguojiang X-Patchwork-Id: 13374524 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 17147C83F3E for ; Tue, 5 Sep 2023 15:32:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 643988D000A; Tue, 5 Sep 2023 11:32:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5F3608D0001; Tue, 5 Sep 2023 11:32:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 494108D000A; Tue, 5 Sep 2023 11:32:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3A6AF8D0001 for ; Tue, 5 Sep 2023 11:32:54 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id F183A40873 for ; Tue, 5 Sep 2023 15:32:53 +0000 (UTC) X-FDA: 81202936626.04.F437712 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2114.outbound.protection.outlook.com [40.107.255.114]) by imf17.hostedemail.com (Postfix) with ESMTP id AC51940026 for ; Tue, 5 Sep 2023 15:32:50 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=nFPPrOiC; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=vivo.com; spf=pass (imf17.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.255.114 as permitted sender) smtp.mailfrom=justinjiang@vivo.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1693927971; a=rsa-sha256; cv=pass; b=iB9EuoKBHDFk6o2++aiE6bkRX/ZmOReN+Ed67VKNo6v/GfZm7/Vhy4nk0/I7JcSjKwPaRU RbPzETNDo1mRm4ybFjRebmHWzGwEciCUGlNVy0aRdNXf3Olex9MazG9c0Oe56AbwqUpjMk Zu58Ls1UCFzI5uNDsBGAcBgca/eVS9U= ARC-Authentication-Results: i=2; imf17.hostedemail.com; dkim=pass header.d=vivo.com header.s=selector2 header.b=nFPPrOiC; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=quarantine) header.from=vivo.com; spf=pass (imf17.hostedemail.com: domain of justinjiang@vivo.com designates 40.107.255.114 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=1693927971; 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=twHlCeM3dnAe+HvNVRTTveVWZyZpck98tJZfZ6eK69w=; b=DiAVJC5FpeXiXTcnsM4qQlHmslBOvtTx9GAHErcjt36TYfPpI6VzF52YkAulGHvGJnMAjL 5RyytYdCLNFCLVxb3uNHfuEDoRqFjsrpAej5EmeQ5xVNuGZEBNYqCjLNFSfhueYaAPS4cp Q8e6l+Pb8NNaSIrCNbD8Ap9UpuTIsTQ= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NdkKX1aOz6+syfWNpBc8W7D0w585otIoCvzN1N1/9+a73waJzDUgztS2MHccuLBsCjUigXnWoRUoy0PRclKI/45D6jS6aZhgjn6NacAcTvN/EsWCS5ZFG78AZIpk7izCexnsVjFg3zyJ3rrVWKb50ghcNDN4QIWTbsJqdFZNhLaSErIdRR4rTL/Guj7b+vJI33PvLY2uhL7ZilgHmxGsO/Wh9Qa5ArPlhNxQ1cpfsP7jxBW/UvRFJaDc45iP2Bze3F8Oc5fjuIXnhg4XO1verV0YBsdN5uFfIk85JNbcR58wJd2EW4ilz8xpnwOLz7FiWK5Aj5D1AUVtTWDnbC/1JQ== 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=twHlCeM3dnAe+HvNVRTTveVWZyZpck98tJZfZ6eK69w=; b=aABajT33ViJ32X/bQCEROm4ih+JEJgQ6lzn5ADpo5FcVIzsEKDbROaEI1dUy0Ddm2M9uDpR3kfzbU6xq8PJaMgOTv29lVtNPUHUN+nnpSMLxcAcgtPuN1FfWDcCgKNpm31ifbZYOkunU10viJFtWsSgsJJfv48snyp3lAjgAPPyZnRwuZ/tJcxS685k9nrMY9FSG+7cq44GJyfhlZRPxUUNc266w//EAVoRzNIeuhN5wog0dDDgmFxVm8fYxrRDtvpIHO6f2yJ7mJsEFMZLZBoo/8vEXawzH5tLNFhvwW5OhbPROFAhXN7MkXg2TNNhHQJ4zl7R3JhfDRLj5xby1Vg== 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=twHlCeM3dnAe+HvNVRTTveVWZyZpck98tJZfZ6eK69w=; b=nFPPrOiC0E/IL3RQC2YkjzhNJ007kTUxAoFtFcY31b6npdG87JqYbf2n2axi9JG4HXMChEQo7S+tCzpsSNBVus+jute1lBF1s6OPfC6YTvPGeIqfGV7U+VMnO1/Ummb4l4mrAN0YWS9nTV0bxHyMCX8I5SARcswB62tW2YTPDvX3sTLscuU4+IVbzo6os9dzf56s/oHICBgWJ22xcr0rvs+NwkdXvGQIJ+8NXlWKuZ71NuvkJBUp3Iwmgbuxo0TRaBApGoJAnncKj6skRmg8aFFoi33rRL2e4NNfYesumtX0oA2W+0fEUEQI52tCFsayXrFN/kFw5uoUyYhSLDr/5g== Received: from JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) by KL1PR0601MB5864.apcprd06.prod.outlook.com (2603:1096:820:9d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.32; Tue, 5 Sep 2023 15:32:41 +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.6745.034; Tue, 5 Sep 2023 15:32:41 +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: page_alloc: remove MIGRATE_HIGHATOMIC order0 page Date: Tue, 5 Sep 2023 23:32:30 +0800 Message-ID: <20230905153230.1291-1-justinjiang@vivo.com> X-Mailer: git-send-email 2.41.0.windows.3 X-ClientProxiedBy: SGAP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b6::20) To JH0PR06MB6849.apcprd06.prod.outlook.com (2603:1096:990:47::12) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: JH0PR06MB6849:EE_|KL1PR0601MB5864:EE_ X-MS-Office365-Filtering-Correlation-Id: ea812e3b-3175-4a7a-ace9-08dbae25576c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OY74F2PnK80M8J5RKwmAqXhKb6rDxnfL7Li4CJLUo8I+SAMvtZrdxXH44p7IiklsN+8FPgjns4qp31K5iTpUzGtqC1PJyjns4ScfdbbbMzP91GNB0RZoCSV8LgZsOUedQL3G4ovl0bsi2gB7ZlY9KyGDNuPKkekScfY0gDS9ARmYHMHJBrmy9Er34ILhmXUZ1jGUxq+oD55tAA+MRyKc2vphzM1ze2GrE98LE9gNXbHtA2lNyzLMTRtALDdmqRJ9ph0mIg4P5leBj29om+GJtykh8DTJEa0vyF0FahPPCwXfUwefy7LGxu+K7KrBITQxXA70p7iStjTrV9oBck1K7poVGomRr70w0hdIrJ1k+bmBZYvmwlsdooIqrwICzeeNXM3PyjJQbJ3vQWk2Wxu3fHPU6YefGzNYv3gLAM7tnbXYLvQB6m7iM3LtljF+raRYa+E1VNb1v+uncrOxL+6i2/25Td6V51zHP4hKqAsCiPNx/ZT6DctMKx+N6QUF4qEnjdTk8kHbAkTgadPu8BBOVGVF+DkxLkxUjZAzEF7JztGAAK9WrDrBTzqvFU/+PQvAGK0IwMRRwC2zFZuOrp0AAuxj7c1siByE+oOYcXvdcoCjd3ExCViwXRz4Kwe4wQkx 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)(376002)(136003)(346002)(39860400002)(396003)(366004)(451199024)(1800799009)(186009)(66476007)(36756003)(66946007)(2906002)(316002)(86362001)(66556008)(5660300002)(8936002)(4326008)(8676002)(41300700001)(1076003)(6512007)(2616005)(83380400001)(26005)(107886003)(38350700002)(38100700002)(478600001)(52116002)(6486002)(6506007)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I5pXT4YjO9okdubAY5o/KMbXMB1uaAtFpiT85WcRW8QCSLTb+7Wue5pwzN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nZ8cPHQmi9oyLChn0IF+bQzlZyT91yGCdP5kIL4hwVL82JMK0NdZdY4L81G40GWkYH0KlSgQP0fUfA3yOdpwfvpUFDzDWfyDB5aY7nCa9zAIAgpglqSX+R2Nsfc9bBwWU+Z+IzsetXItO6W7JHUwHlSabGedwDgqNSGP6GE+tyHyxmGCXXrTAWIJxHIZoW9tCnTo3zb6GGSrtKt6mkcAYI2/32WuwTeghlgLrAlmzySQCm6bIqGc9w/zon2TeGU83SdRLZ1H1V76QT6exXPRKuJa7bl2tOndCVL18xvkM+U1vRBiN4M2uDnh83fWhN8IQA/CTLoqdaSrbBRRBpN2EGe6OVuLZe/27N+Ifn5HP4TBImZAZoq2LaOj+dZwfxoWhXLRaM7WWRRI4el9TNgOaG4YqQs7Wn3fHtCi71JemO9bLXRQUkusAvyuh X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea812e3b-3175-4a7a-ace9-08dbae25576c X-MS-Exchange-CrossTenant-AuthSource: JH0PR06MB6849.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2023 15:32:40.8458 (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: nPxlIZ8c2Cv1uJJrp5QyzKjaCsB7qQrfzXFeGmz7engTPlKFwfc3VdbZ3T2EM2omCuP+GLWbkmOfJNYsDwtBfg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB5864 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: AC51940026 X-Stat-Signature: 9w1s6qizueo89otce8dc76eg41djqfgf X-HE-Tag: 1693927970-124213 X-HE-Meta: U2FsdGVkX1/5AMMaOpMOw2K7/UM3G6SnEEvk8MKjgU/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SuMQojCgDgEVoY/Azv8mmbjri4CqUojO1YlkiSN5zt7AaWONN6bSiD8gCmAxAxSA5a/6zjHrBDNijHD1Ip6o+7xqz4vRPdddwyOG28c/54+v3u8sxAJ9NRNkskebYatz6tUE1LpAMP3Pdd/COh7IMgsOZB8V2ZbyRu7iNOy4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000012, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The MIGRATE_HIGHATOMIC pages are used for order > 0 allocation, so pages in MIGRATE_HIGHATOMIC order0 freelist are invalid. This patch can solve the allocation failure from buddy, due to the reserved MIGRATE_HIGHATOMIC order0 pages. Signed-off-by: Zhiguo Jiang --- mm/page_alloc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 14b51d1ef4c3..10c5b053bedf 100755 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -831,6 +831,9 @@ static inline void __free_one_page(struct page *page, else to_tail = buddy_merge_likely(pfn, buddy_pfn, page, order); + if (unlikely(!order && is_migrate_highatomic(migratetype))) + migratetype = MIGRATE_MOVABLE; + if (to_tail) add_to_free_list_tail(page, zone, order, migratetype); else @@ -1639,9 +1642,13 @@ static int move_freepages(struct zone *zone, VM_BUG_ON_PAGE(page_zone(page) != zone, page); order = buddy_order(page); - move_to_free_list(page, zone, order, migratetype); + if (unlikely(!order && is_migrate_highatomic(migratetype))) + move_to_free_list(page, zone, order, MIGRATE_MOVABLE); + else { + move_to_free_list(page, zone, order, migratetype); + pages_moved += 1 << order; + } pfn += 1 << order; - pages_moved += 1 << order; } return pages_moved;