From patchwork Wed Aug 28 20:22:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13781799 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 2D4F1C71133 for ; Wed, 28 Aug 2024 20:23:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BD9FC6B0088; Wed, 28 Aug 2024 16:23:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B61F06B0089; Wed, 28 Aug 2024 16:23:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98D686B008A; Wed, 28 Aug 2024 16:23:25 -0400 (EDT) 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 7D7686B0088 for ; Wed, 28 Aug 2024 16:23:25 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 2BE1F14072A for ; Wed, 28 Aug 2024 20:23:25 +0000 (UTC) X-FDA: 82502779170.26.FE0BB53 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2041.outbound.protection.outlook.com [40.107.244.41]) by imf20.hostedemail.com (Postfix) with ESMTP id 44A201C0016 for ; Wed, 28 Aug 2024 20:23:22 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="i+V/tbRL"; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf20.hostedemail.com: domain of ziy@nvidia.com designates 40.107.244.41 as permitted sender) smtp.mailfrom=ziy@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724876504; 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:in-reply-to:references:references:dkim-signature; bh=JvlvOKiL1uDrY0SOAsMeAPqpU7SQeBVYP8MOTmwgRbQ=; b=J+EkmxhpHiLqvKk+/WLXHDrwUOMelKKDWpQtoZhrkpGkbZed4ERQx3Iez/SqDx13CZsloa a2Hxq7Yjzr8UmjbTfLmFlgonSBuEOOoYYe0AALh5/GcRflZCvDN+zUv7rvd+VaNoHn7ThM Z8mlRGftSeNkV+db5Lhsiqu2gVo/TK4= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724876504; a=rsa-sha256; cv=pass; b=zWUlmiBT+bjuWlK2U1qNxT4Qk3+nO2t9u1JPuLaFZuyyfcFbiuVdaC2N38AtH4V16RKM7Y nXCtlb2fRPFFLPWnTSj+iXC7eI/aKQxGYmUJM5ReCwCF5iNf/CAu2Xt5Yo9j3YFislQuCp 4ldnLJGr0HXqE1uyGBt0T+jj0o0hKV4= ARC-Authentication-Results: i=2; imf20.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b="i+V/tbRL"; dmarc=pass (policy=reject) header.from=nvidia.com; spf=pass (imf20.hostedemail.com: domain of ziy@nvidia.com designates 40.107.244.41 as permitted sender) smtp.mailfrom=ziy@nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LMZcoTgFOM25p+pb/l6g+O4KzdIRq1CEcWpOeQR+4G/NgzsgoqDKvZFkaogyvJM+z2yHO6qNRBJvbgoEXdlCyDh6TKpfuUiIAyxDUxaAPohqf+9yfQ4kTBJ7/4lYe+M04KSoBeZp8E+RfsiclUs2YkOEhRtYLoYn9/Mx4iRcn90rjIOfGjr5JQP5QJXV0Dm8HhWKxEWwDtAzXezPzMjp8PsdhSP8aaaF/9MSYdFhHM9/+vgLebFkKWj5enJBm4L9IvmrRuin7xc3/Yj8DEBKwiF3bYeHYdoJXoXaG0v5LqocGi6NSBu4fcxilOmKqscLWo63jtBklMi/0EnaaUjDQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=JvlvOKiL1uDrY0SOAsMeAPqpU7SQeBVYP8MOTmwgRbQ=; b=oI781mdNe6mfbpDrqlZAQ3Cic3a6xISaADwq6n0fFMiV8+LUIwpQT1ghMWJ2u1SE0narmeGsYCNyAydqsmcxbdcIut4lKJiiQXAJqrJHoq2kTMKtRwW6Hok7Y/NniCBhia1jAlNa552Y/46QAie/WEgsgXMuIIxctxa19X/sN4cc8aA9pfiljBoSe/2byXK0+twytci5wo1460HNo4FAR/jpDamfzO8Kz71KCG7xiboHF/RGuF+StBEvtDtMYb9wcJjkJpuZTjbtgrEbd7CV/rrOIq1fgaMpiGaCfMrX1tNRzTAuuYjUezhkIRcgIFy3TerCiOpMEMrAXeDdpzE8aw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JvlvOKiL1uDrY0SOAsMeAPqpU7SQeBVYP8MOTmwgRbQ=; b=i+V/tbRL4+mb8d+yVe2p231T0pYFdYGxTN5sJ0DZflCR4UGKcjzswzc7ktp+D0/Y/2awh3ScdgpLMO9VFDjvWAxHnJcGjXu08LOOlRnCrzP9K4iTLy5c8TOjzCvgpxNFNfFMUJGOjgU4f70lSbq24RrJ1R7NJ602bsYxvNBISOE/kVQTvCFsjPoO8WJRNqZnkF2b0HPLrDIcQP2IDfxqThskE2fgj56j3nlYjf7Z8Cp9LWBnKQlqa8c9O5gb5BoRAeuj3GesNqgKSp+3jT1ETiHK0xzhocM1zHSYonJFimJcmdjGmn8oxk5UdxHLIFv/72nAqktkh/VHOcDru/rxCA== Received: from CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) by CH2PR12MB4134.namprd12.prod.outlook.com (2603:10b6:610:a7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.28; Wed, 28 Aug 2024 20:23:18 +0000 Received: from CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f]) by CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f%5]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 20:23:18 +0000 From: Zi Yan To: linux-mm@kvack.org, David Hildenbrand Cc: Oscar Salvador , Vlastimil Babka , Johannes Weiner , Baolin Wang , "Kirill A. Shutemov" , Mel Gorman , linux-kernel@vger.kernel.org, Zi Yan Subject: [RFC PATCH 1/4] mm/page_isolation: make page isolation a standalone bit. Date: Wed, 28 Aug 2024 16:22:37 -0400 Message-ID: <20240828202240.2809740-2-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240828202240.2809740-1-ziy@nvidia.com> References: <20240828202240.2809740-1-ziy@nvidia.com> X-ClientProxiedBy: BN9PR03CA0978.namprd03.prod.outlook.com (2603:10b6:408:109::23) To CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CYXPR12MB9320:EE_|CH2PR12MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a8db155-2a3e-498e-fb1e-08dcc79f40e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: clqcE2F/YBs8zz5EqWsUzj4SFZeoe2ipdycRcgWakJE3ez1w/rPWugw2FZishDFdz7YoZfe/pIF3M6weiW5T7wKArGs+kXetHZsGt84RtVEdcDBqomk/eb9IDoIVrAHuj103mhc+fJlSYf1DreCYiuQ5U6yH9NetFfG8AkyOWmZiZ97BvxPXZvGCIf7/FOmJv93FhU1smSi1XdZ5JBOMUO47btxKUZaRGve8T6d1NnlL8hG2m+NAjq0XZ8z2qMaUL4w8nf/JR85G6c+tF1agqsB0IXTqf6QcDqUApBjmgnzQDqpuVgN364IIfjPlxFce+pP3Qrp8jcYMpYu5990RE7Dw4WFYAefeGpw4GYdNufAX6jvbk3hgYFofLE1uLbRSRbWlC5zHphFdw2jM67KHlhDJ/r6CoRvjLGypPD+9eJD6y2NBwkj/ChYmM2UPA+HiomgtOIbYxMwEUOTCp4V6pZDc5+YQKZM5dCINEFgKwohOzaSfB6ktdkPO4FnH72MRGIenJoXAx12ro5T8J/ET3Lx50ZSTrzrG9tdXTpS+29ymLoC4c1otym3wB5kpp0VtJdBPBNku1g+PR3EGF/E6ok81r6CYwa06s3wnbekb6sbbU215cBwdcBuebsJxMFpEtwhV90HWNRosaK5yCcwZX80aRm8Hz473aYTYBW4qE218FrohanD2j+nLMKk5SSsYPsHa14KVb2FCYQmB9Lp5md7Xb8UkPUhHePUVSE1vUTKU4DeWNoYjOc1nKrxMB0uHLEi20v9QwHO5PVXbDVGtxptA4vuHfQYHIuUqENC9S/4nqnb0hZuG4gFYbItAFEoI0H2AnJ2gGxeCevbKomP0tEDq6n7zEP39PRejKR7Izz2bXVzTtTHP0Xjq/WmKu6ZfJaWryfciHcBvMCvTNpNJ2da1myr7Af8YeGOe4y1h86YcH3w+AImtl0qh1m2sf7DHKjWxC4kRsNwV6QmpdByIrgkOIHVO+wlrjT00/RO3vrbOzozhf8abLb8GTXHkvvZdB02RMLEMJnkojxuywNSzwDGiL1lI2+eh8mkkDifUS884UMcVeyq7jlDH/cXlSWlMJbIWronh91i9npqSFTqwWAm6uEfR4YoXzn2b1cbC5FCePnDMblrwrJqqQEVg4/8HDyT2gsFwuKmakZeY8R88Rm8PDsa6So7IKODAqQd1qRdMhsoKe8MCB3HxQac7tIqjDW/e5xvnlUqVAu0Ohekikwefvnpa6M8d4cPqrwFqv841mxhIupN2+lxj9GclblEk0U9NZM0lxUbt8jX7pAfn/U2zABg6xGiTz1cMHzYl9+P3qgnPq3X5an3PVtOo6Ly/05One4vkdy2G07//4pjoZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CYXPR12MB9320.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6SIQ1oHiNuUr+5BTfbx6SXY/XXp60TUPtf59z/FeBQt6DkpcWOfUVJBX8b7sHegxCw3+dnUe8PbUWGrDuUz8hTCSMiv0Qlrvi6okENpusnC+GcyAVN1mman+BYS3zJ0s8ktw48eYCzyCfNaE8A16N+zgFf9jUubsXuqnTPOT2Q7Ot+4Xv28RRiFcKsQaSwDQExN+2ZMTbRkZpsqooMjBnRKbE05br2nkVKc3UayZiT4TX7lzK2/pPSPA6ayzGpeRiopJRMM9//6nnC4jC+06LhQ2NsysAziQgU3T/B0MDRz8/5Kcm/nIpihK8Rcny2t+GeaIx4xrXy0FOzaSXBH7dHTf4ED5prp+Ew3n8QveOd2Luu5fIqNxh/sUSzfeGv3oiVFJA3oc0BQ9dfpb6F4HHRG3WkPPRlHNrUWHfG63FZXnrRGwIeEqtD17Wp/4MSnk15fNSFxEwB5QnTO0Qr1vf5XVgkPQ5CYCz/EFraYpS0wI7OduScYge+hc5PiufOry7QUOCFgEalColDickF1W9sXxSUAZh8WjrGe4MGSZy+/N1dKqSe3NPLyeKmlrXax3H0fOXl82tIY7BJYeVxATet4WrZn3Nbcp5zlXileYMYcbhyW1RucXffi+JLVyIilXfim9gEkcOC4W5FXf/ChY1yhxHlwzmn9GtmL5V3IS/E0x4oEztI6e224yYCN5iazkH80L8BEcyZzqWLeZ2bYDqGTkuPSev0+k/ZUIfc38m5sygceO1y882wwkXV1+sJ03KPx86oVtwfdWtr2oyIMI7jjDaPxRcXp+KqVP2/cIQF36J3LThKgkJ4k5c9xFBxXCgYeNBiqMJ+j/VzNUCXBi02oaLdKJBToPwmyHhIAncEsYjaqmFDk/Rf0P71A3a3GRB8zXIdDt4QmVEoHppe8Ej/aXDB4vSUs2hUNBLPavY2CfNo0PlmD6pAqcbVWn0k4IBTQ+H/CaBnNLdEbOYO8bdO3yuzH+yUK5wbVwNRJQ1Dqx5Oasxepy+0Elm5IOoab1OBu5tYYvIu8FZUjH6bHb9Ak6llO70W6UJEe/FKyTqV1gN2Q7Pl/hN9TnE0ZcnT1D6ZJJ9d1Wyvrh17QiMejco+UJEbkSjM1eSx4tayUPbnXZBoJto8QIbZRWp+C52swHHh4Uq2b8cTADQf+Asu4BN0IuTbNQ4QoFIaLHqtBZ+zERweb0Gkob/IgyGEKoL1BMIa8c4lJYOOaalxd/2ciNF4yJsx94H82KNEeKlQKjEbimIN3o3UHfQBBGzzt26lX/n7rWWA7OFY7uAdMqlS26hKYd8lXMdd3i03StbZbJRc8HPJm+1JZSoDuo0gpz3oTKTmmVAVTtR+F5bxi3gurFIqtr7rzI3dOo+ChUOlopuNuoJb68Mzw8wGs2Ai4emyJpIOk8neH0m0qc204fCogbs6Nv5MhZ0snlOZ4Ntl08RkGqpCrfJYuIVd1Z3m6VIozyZkpyBSgkx4LijyrjawoMn2JFNc6kihSk9Lwc8yiLOn1MDz0BINMeMd/P6yFF1DnPKZ9zmFcG0rcXbfWhA2/yLdWMFsP4FgzJYeJlgZwcSB80PLdg9BMbP51vOH3atHyD X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a8db155-2a3e-498e-fb1e-08dcc79f40e7 X-MS-Exchange-CrossTenant-AuthSource: CYXPR12MB9320.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 20:23:18.3486 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mhepnQBCMwD1259WBO95DCSZv6Lk3iS0CkMxy9+7K0UKdPp79dCydTysERZbyW7B X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4134 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 44A201C0016 X-Stat-Signature: mbjwz8rytxobhwd31tfp3swjarhan1gr X-Rspam-User: X-HE-Tag: 1724876602-838633 X-HE-Meta: U2FsdGVkX1+TJdtWljcKH9ArVCLhp5tn6VihthAQNnoPwCuG96WQJanyZqUR1RYyqPfsXZUn9zueeOdDDdRBtLicTNPedXR+clw0SZSyIsecb4HAvkaIqWGNRgecQwbHHgy1cu6paZVcVbFtA1zVWuHs3OJ6DWccQE4FYIdW3H7M4NDAe9us9oQcmQLb0Khzjt2nc6l8g/iehQHsrbvfl1lOdaxr0dqtSC1ShweW3gNyXyVAaqqEtin0THaKEwFW09tzNDUolmFd9m3Ta4UTqJKmC5wWPTVODBz4w5/YDd+mW3Ph3JM4U8e0WtSFplwgDa70qlj5ByOOyAV29v6/UKhwgn2BOJ2nOSl+kWWTIwBniictGV/ZLyLPOib84tBKZEAAns5V8Uk9eVVbLfN5EyVUETPo216RMK8+cxQX5cCs4010XNBOch7t1iEY8WsPbum4emOcnyUanfwyOT3Yt8LukqveVFtXABP/EcWWbQfsBLiveERuUtmnyAnzDYd5Lh86la3J4tk3/ekLMgLYtk0+BZMYXisuY12P0zGq/lV0nfN0M4qRbviAowUfqRxSrjaWqpLMYLkETxnL2d+zzn/eOzuoPRrXYvWlK0d/FuNQVeedna9fW6ovCdX66pI4No/tjNKTt4Mj5X+ACEhk70ogBYsAcU44tiSL8ne787I57HXu9TJwy+EqWRpUd6L0BjLj+YKfG6pZmrGyXF8acC9O5SrJyFXwyNSbhjZwK/i5nd4XbqLiFNwfyjLIe9h7T3IHb74DI57Fi7v1Mg9rc507eBNyX5tiHqo16eBCVn07AlT1nzNzT/m4+/QID0K2tCZtfaghcZPrbX801m7HKeuu5C1E0A7y7XvSsgdcLLgM3VznvrXsR+klogesEk7HfSekQ2G5mq5l7D0pD1iO7bL9WuOq8l6QXenQrBEEzB5GloquWhGlY3CMmiEpuDTGIKXA6dWlJCzNmQXT6SS FQu+bSYz zjRzdbwb/P/jrqv62GQErBrVdZrLrT3QopwetCkC9L2l1pphr1wblCmJ9xRO12VmZm/v57/HrljLRanWgKudyCTkIY4Nza7scHEDwivYdfJxOU0mByo3g3uAH4Sd0GeqKzrrB8nSx4lTckZXPKdTeGdLp8pTW+zovxrJsyCv9Um0kUDjNkTeKMRHPZAEHA1YOEla3U7JZCFTCLZNG2aMiuR+pibDes3iov9UGODOFzK2G3shro4POJaTNsNiCVR6pdO+eqzlDeFbKx8Fk7FwF0Oy+w2VfUwoifWUk5gNIKmutdm+0N35dwgdEANPuOmfyZrXLq+gbXF/vnoRkMmACZkOAYQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: During page isolation, the original migratetype is overwritten, since MIGRATE_* are enums. Change MIGRATE_ISOLATE to be a standalone bit like PB_migrate_skip. pageblock bits needs to be word aligned, so expand the number of pageblock bits from 4 to 8 and make migrate isolate bit 7. Signed-off-by: Zi Yan --- include/linux/mmzone.h | 24 ++++++++++++++++++++---- include/linux/page-isolation.h | 2 +- include/linux/pageblock-flags.h | 29 ++++++++++++++++++++++++++++- mm/page_alloc.c | 22 ++++++++++++++++++++-- 4 files changed, 69 insertions(+), 8 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 17506e4a2835..5191a90b94f9 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -108,12 +108,28 @@ extern int page_group_by_mobility_disabled; #define MIGRATETYPE_MASK ((1UL << PB_migratetype_bits) - 1) -#define get_pageblock_migratetype(page) \ - get_pfnblock_flags_mask(page, page_to_pfn(page), MIGRATETYPE_MASK) +#ifdef CONFIG_MEMORY_ISOLATION +#define get_pageblock_migratetype(page) \ + (get_pageblock_isolate(page) ? \ + MIGRATE_ISOLATE : \ + get_pfnblock_flags_mask(page, page_to_pfn(page), \ + MIGRATETYPE_MASK)) + +#define folio_migratetype(folio) \ + (get_pageblock_isolate(&folio->page) ? \ + MIGRATE_ISOLATE : \ + get_pfnblock_flags_mask(&folio->page, folio_pfn(folio), \ + MIGRATETYPE_MASK)) +#else +#define get_pageblock_migratetype(page) \ + get_pfnblock_flags_mask(page, page_to_pfn(page), \ + MIGRATETYPE_MASK) -#define folio_migratetype(folio) \ - get_pfnblock_flags_mask(&folio->page, folio_pfn(folio), \ +#define folio_migratetype(folio) \ + get_pfnblock_flags_mask(&folio->page, folio_pfn(folio), \ MIGRATETYPE_MASK) +#endif + struct free_area { struct list_head free_list[MIGRATE_TYPES]; unsigned long nr_free; diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h index c16db0067090..11b8695115ea 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h @@ -9,7 +9,7 @@ static inline bool has_isolate_pageblock(struct zone *zone) } static inline bool is_migrate_isolate_page(struct page *page) { - return get_pageblock_migratetype(page) == MIGRATE_ISOLATE; + return get_pageblock_isolate(page); } static inline bool is_migrate_isolate(int migratetype) { diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h index fc6b9c87cb0a..a8121cab4b4f 100644 --- a/include/linux/pageblock-flags.h +++ b/include/linux/pageblock-flags.h @@ -20,7 +20,10 @@ enum pageblock_bits { PB_migrate_end = PB_migrate + PB_migratetype_bits - 1, /* 3 bits required for migrate types */ PB_migrate_skip,/* If set the block is skipped by compaction */ - +#ifdef CONFIG_MEMORY_ISOLATION + PB_migrate_isolate = 7, /* If set the block is isolated */ + /* set it to 7 to make pageblock bit word aligned */ +#endif /* * Assume the bits will always align on a word. If this assumption * changes then get/set pageblock needs updating. @@ -99,4 +102,28 @@ static inline void set_pageblock_skip(struct page *page) } #endif /* CONFIG_COMPACTION */ +#ifdef CONFIG_MEMORY_ISOLATION +#define get_pageblock_isolate(page) \ + get_pfnblock_flags_mask(page, page_to_pfn(page), \ + (1 << (PB_migrate_isolate))) +#define clear_pageblock_isolate(page) \ + set_pfnblock_flags_mask(page, 0, page_to_pfn(page), \ + (1 << PB_migrate_isolate)) +#define set_pageblock_isolate(page) \ + set_pfnblock_flags_mask(page, (1 << PB_migrate_isolate), \ + page_to_pfn(page), \ + (1 << PB_migrate_isolate)) +#else +static inline bool get_pageblock_isolate(struct page *page) +{ + return false; +} +static inline void clear_pageblock_isolate(struct page *page) +{ +} +static inline void set_pageblock_isolate(struct page *page) +{ +} +#endif /* CONFIG_MEMORY_ISOLATION */ + #endif /* PAGEBLOCK_FLAGS_H */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index c2ffccf9d213..4ea5cd1a07e2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -380,7 +380,12 @@ unsigned long get_pfnblock_flags_mask(const struct page *page, static __always_inline int get_pfnblock_migratetype(const struct page *page, unsigned long pfn) { - return get_pfnblock_flags_mask(page, pfn, MIGRATETYPE_MASK); + return +#ifdef CONFIG_MEMORY_ISOLATION + get_pageblock_isolate(page) ? + MIGRATE_ISOLATE : +#endif + get_pfnblock_flags_mask(page, pfn, MIGRATETYPE_MASK); } /** @@ -398,7 +403,11 @@ void set_pfnblock_flags_mask(struct page *page, unsigned long flags, unsigned long bitidx, word_bitidx; unsigned long word; +#ifdef CONFIG_MEMORY_ISOLATION + BUILD_BUG_ON(NR_PAGEBLOCK_BITS != 8); +#else BUILD_BUG_ON(NR_PAGEBLOCK_BITS != 4); +#endif BUILD_BUG_ON(MIGRATE_TYPES > (1 << PB_migratetype_bits)); bitmap = get_pageblock_bitmap(page, pfn); @@ -422,8 +431,17 @@ void set_pageblock_migratetype(struct page *page, int migratetype) migratetype < MIGRATE_PCPTYPES)) migratetype = MIGRATE_UNMOVABLE; - set_pfnblock_flags_mask(page, (unsigned long)migratetype, +#ifdef CONFIG_MEMORY_ISOLATION + if (migratetype == MIGRATE_ISOLATE) + set_pageblock_isolate(page); + else +#endif + { + if (get_pageblock_isolate(page)) + clear_pageblock_isolate(page); + set_pfnblock_flags_mask(page, (unsigned long)migratetype, page_to_pfn(page), MIGRATETYPE_MASK); + } } #ifdef CONFIG_DEBUG_VM From patchwork Wed Aug 28 20:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13781802 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 99F34C7112F for ; Wed, 28 Aug 2024 20:25:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 263996B0096; Wed, 28 Aug 2024 16:25:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 213336B0098; Wed, 28 Aug 2024 16:25:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08D866B0099; Wed, 28 Aug 2024 16:25:07 -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 DC1DB6B0096 for ; Wed, 28 Aug 2024 16:25:06 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 86F26A9991 for ; Wed, 28 Aug 2024 20:25:06 +0000 (UTC) X-FDA: 82502783412.04.3B312DF Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2046.outbound.protection.outlook.com [40.107.244.46]) by imf14.hostedemail.com (Postfix) with ESMTP id 99E40100010 for ; Wed, 28 Aug 2024 20:25:03 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=SpXptOvD; spf=pass (imf14.hostedemail.com: domain of ziy@nvidia.com designates 40.107.244.46 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724876659; a=rsa-sha256; cv=pass; b=KOl0chvvjJECi3As7D+F2FZJrvMzXykvMulYxszjchbPCFsKrzs45Ud4sS+m5mWChcqaEU DfovJhyLB5YzWavCmvggmEzxFlSrcp3lt+cV8Kahh/l7fqprhha1aOy6BhydzCB16yPpwG Jo2dcKcokKAC7cwGDwaZjktKcjWDzvM= ARC-Authentication-Results: i=2; imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=SpXptOvD; spf=pass (imf14.hostedemail.com: domain of ziy@nvidia.com designates 40.107.244.46 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724876659; 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:in-reply-to:references:references:dkim-signature; bh=/zpM54XLlKeXzRoO4ZQiZhoxVX7+BY03S5QPKaQfn+4=; b=amq++H5L+TP2Wqxfj+uAbTORGXu0z5pcQEbIU+170uCQaFlQHwf8jvGsiXD7KoxeqfV7dh daeUvSHae98aPanK9Ot16syh1kwC90weecP+aWffmtwzzKacrjP5eLbDc2H6drhnJMUaqA mwScqXKXDBVrakbmG/NzSq8LBgsaBlM= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Zk1Aql1N3bPUiIqCz4DigwAy38KAu2oxrRm7r2CGywrKhtc0DfTGJDAmOK66PMdcFlyXhqL9em9uVAKKIUAvx+BXtafKy4vWVWFMOpWARD8SYq0e8fC+UHVuKbXvqVc8Ki9G61F/k0CNw4c9pkDLRl2uMJFPGY94npTHGw0HEHS7krHzL8zp1wZSOrePkXZLAOlibItAkH0GBYxfV2Tz+Czz0TKV9cpEVu2aX9H2E3aIh4SM0ZGh99xucrwaHxPEyrhiG4+PU8xMueRmCPbml6mnY/hizV55eJzSZLuRSqpReErZPU1yDy49YGxcLWV4cduUHF/pCwmOi5zNpAwizw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=/zpM54XLlKeXzRoO4ZQiZhoxVX7+BY03S5QPKaQfn+4=; b=Lz8xq26Uw6GhSX+xGP8SbGJO/NbLvB0KEEa/nJFzXbYN9Bkiy8S/qdZa1oi/lTpnmdDaS7uFdwxDsSvr/MIGL+GXxozQMIB94Y8MD+vtBDCI0ebwDvojznKKqTbhwwFDSluA94zyV3hANpVxX8AqTwWZuqeLyVYEiXIHiZBBw9DWe1xzBOQyjpuhxxhmey8sWDMNGIsEle51LQWNh6YVIlGfYFYBqMRvnDVk9a5514ZCzwy9MUZGVHjt0K/rCM0vhuAOMd5mD1qdeaDAH3kFkyRoPcmLkd3Gw0/t6RXnr3J+0Xe73Bxk1eq6eTDIIGlWy1uO39YC5gv70Ka5ZAEoJA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/zpM54XLlKeXzRoO4ZQiZhoxVX7+BY03S5QPKaQfn+4=; b=SpXptOvDpsZKMUDHhYJj6V+y6dgDZIoOtjGN0oMbpsEkDw2RaO/GJyy3oL6OKwIA2FzZsuD/plID6IJDixm1cIPt8cKxb4ybFqd6Nel6+et2c0870F1OTfTVcer7i9OD2vUHtP/0NQGqSWl65IqAVPS9RSAd5y85PPIIR2WgCzZzLlIoFDToz41NVc+sCG2G2P47Z2jefuV7m3f4NEGuvMlRoNL6C7gRlXS2zwuwMfs1xbtKKacFnGcU5ALrWdjhZYtNu7q5nimm41ra5Bg1oYmWeMkzkrkV3OS5HCyFaKq+EfnGMZX+exYxngQ3QvfUqc7GF57VHzs6DzCXHDm6uA== Received: from CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) by CH2PR12MB4134.namprd12.prod.outlook.com (2603:10b6:610:a7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.28; Wed, 28 Aug 2024 20:23:20 +0000 Received: from CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f]) by CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f%5]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 20:23:20 +0000 From: Zi Yan To: linux-mm@kvack.org, David Hildenbrand Cc: Oscar Salvador , Vlastimil Babka , Johannes Weiner , Baolin Wang , "Kirill A. Shutemov" , Mel Gorman , linux-kernel@vger.kernel.org, Zi Yan Subject: [RFC PATCH 2/4] mm/page_isolation: remove migratetype from move_freepages_block_isolate() Date: Wed, 28 Aug 2024 16:22:38 -0400 Message-ID: <20240828202240.2809740-3-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240828202240.2809740-1-ziy@nvidia.com> References: <20240828202240.2809740-1-ziy@nvidia.com> X-ClientProxiedBy: BN9PR03CA0979.namprd03.prod.outlook.com (2603:10b6:408:109::24) To CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CYXPR12MB9320:EE_|CH2PR12MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: f54a0698-144e-452f-dd84-08dcc79f421d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: lRPe3xx8kKY1/oS3OsiMZGqR078vvrOXjsqaJu2raeEXyN9Sj5vaqyw3yvBjy4xNGCWKVfzfxxfTNcn7BBwLxG0jne/VMtJIzQiDdpOImnqL7JBUmwlSIa7Az9s7qQt2Yyu2dz0mFUJ81pvx4j9u+PhQQ2xbXAhr0WN7nra8Uhj6zeEG693i66QWJDVycIu0vnQ1NwK77W0+M1uIJ+TGu5VQr2t3yzFako4Xn0aXYCeiLqSy+zDDYRfMGlXn/QplyPuy/mvIS477Egiuo2ceo18jCBHtF76pY47gaXFLkX9zdAe4clJJrTUAFCWgeUUNy8zABDjgfZsyw/MTfhdD0yXvXE0XtPQdo0O4duitaB9JDQUImqJpKN21Xpct8UQxH31rHbsjPWTYDdG5oED3BZ3FoI0HojVV8PsLGE+RaAdpPQg5dRCniO+uIypPODyEZ+ok97VzML+1cYqplA2doJGXxUIuyRXk5939HI7S4LiKF83+eSx/kSQxh5Nvbx4kCzOje35OZ4TWucoQnlRTPLtzHR2v322OcEAcQWPE0mJ9l2g61VYDDZz+XUhhC3BqUi44fNsDBvnmX3RjHV4ozGPFge5NuEQ3bZc21nds0hu58ddYgeo+r+ev0O4zfAuhDWGKjSee+a+fadCu9nP/wl8oX1XP/c5s2ZhSLJ8Es+H2B3aeWx8tehtcCf3ar3n7yu2WZ1DJfK9md31NMPDt/Mk14H3v7kqSmS8JMhtTnb6b/jAj9UYwmmshCu413nnWcFFpPcP/DEqMuZbpQi/md6fRj/IBy0tQOmtwBjQ/yPQ/3DcUTcWTF+p5y7PIgE6UbqkFQI2xvALBXfOwMDRedoHCXr76KctseEx5u8iezwNO16R/1gqAEDblIcoMN65gsKKaJfc14YbAEjFI32x4YYJsouENCdsV+Y+6/IbOlLH6nY2+xPmQtvLZa2tlyjnfDG9lP30AgtmhAsLqh1h4LLinfcBjvzWQCIBgrv2nxb+of4BiIofD8+zNshokcaZdS4aJQnV/vA1mqJUe/K8GFJJhqKGvQB32r1GpxWGRzWVEKrKjtcwBDL5RBEfH6/aVluyRIn7DZ2LU2Z76pHqKqc8zIEtwomFZ1h7t0T51XckdiV8UJH2AJ+QW7a6wJnEw3K2yK3pVClQAgFY/k6FWC88cQi4lwiG3oMPrCyU8YJMEUv/6psZYG5Jd/LrNxuoxLf1rBh9Y1NDzsYXXINjT/KXnovEy2OU1tBBUPkpF8y8ldVu5ChNxgy0cdQwpCMRNcm/sdF18Hl/RtpnZmIAn/XbrfCRoD2ssx1UKcCziwsCZ+UmKQR4A3lqclflXnfbonIdK6BCXbd1wyVi2Sy+w+w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CYXPR12MB9320.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jvBBIKoDL04+bLFO2C9XZt366YgW5iKmablCYOHvi+5zh6+JGhV9+/5wgrDVxbWHd2Y/mLz3nETYkBKOx9wemeuc46rAjbE0ne03nBDBbngE996li4seDJzmZcXM3w1RBF4HhccwZoEGJcfecDsp3ExvPeBoRky7C488/5lNJPehM8QO7cagCDeQnHKz8fHisF3zs4UevFTt8FrFortZzHvsFJc5s8s9xXucgSu8rRKYwhfiAOB5Y80/jmqyOBrKRNjZGk7IhaQBQy8z0x9PQOdAjeNlj2eoRCWQesEUx5029thvCQ6DCNcz+Z3Ls1b1jPYzCGTwelOI/OpXxajE8tUR/fXhKnjrXAr0IOz3aBgRGH4mg06t+STTxErgQlP3xgrNMe45pCbyBImMSb88G2h+FLd7RdDGPgJLUt9COM9lwTImS4T/009upajGfU+fsIwIwMWX7VMQtoddB1FSRBw70Jk+mTNeNCnv/cz+l6AjG3kuDd0xXBWDFWFdPyef6MPC3RtPMzY93g8ydU6OruW6C6kgVTmBpxS8S450Xjo0+VmZ3Rvqko7gD7/CPLdfl/rVE7BWcZqnS6tbV2rCY1f82LJNiMyq+nOBpc38okBM8JZkoQTVIna6oFLUvim9yZ68aOBM99HfPsT7zt1YuXZRbLltyXMNW/CLZcFPDE6bJQulfqc9RN1A8npJfiRYW5JLqMfNRx7ixo57ROI8phRZjnjlmrND2mk8t+0sqkbJqnv/HufosVxDPDoTb5BTcx/19Q0PNweAisDiO3gzsjYYx2/njCqsSzsOaA9SPWaz5/wyTAeRSlvvPUo7lbx1Bua9JJo4xqPgbJxwCmp6SuPIDsqDu2ivRkqLPoBBP4v73G6U4J6sbk7JcvgBpMmAlu0JC1wICn7k01ajK99JV3CeCgZtsGpXJb7TUbjTLdXsSqCyQbmuZjImgYcTarOhlXn1BxrXJu+piqu0Hl1nLW91AlDGpWmd+2oew9XfbeE0Lw3C7i1g23g/KzaEZRZcmtimibOxZFfXFCdauJaC+aNfO5wbCVd+BQkVEApETt6J/F5nruWRYKszXHMEHYzmgJvHB3+iq+X4ywP6hc+JzgoDzbDju+ADS57xwAbZFtFcZr2alPKKed1YRUBaPf8HQhi6s2z2udPXxzYQC5Fe+ckaVJ4IapnYr84u183mHGUvdFq7CW0VVp3yjuyQmaW4JNlgR6brWaSVLClcUwLBdFsMbI9Z1OezZVUNXjIHgajfqcUTkjtoRFLUC+Jj0107VXFinXf7EPWetMm6wBEZxtZlaUiddyPErYhBykN0tKfllqqQGTSdeP/1iqIuq0E1d3sMbiCeLntUt2h6NrMCd22C5P95XYFuzJjDxxMYU3J3VLALAVwHYGctApmweF4eAFS4jaTMw0XWDZTgzniGcPrWV0yOsGcXXj59LvkOEeS1FBYZlxYh/i8lz7jhof+y7Ik4I0pPylie1nRworowas2x9MD1nZRYpXcZZ9DFwv8pLXdgdb8aZCHvzRSVopXIKidoVaTnVr8Kxn4sg0UGt6E13CE35LV3qMdvq3ozY/1KnKz7Ry0OXXCsQStpiMcF X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: f54a0698-144e-452f-dd84-08dcc79f421d X-MS-Exchange-CrossTenant-AuthSource: CYXPR12MB9320.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 20:23:20.3745 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZgVJZGT0Jvi54UQGdEdfmHGiYwIvhjTDQsmwQYz2vefbOL+ZvmCtdWOsYyVa6Q02 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4134 X-Stat-Signature: iyh9zkfxos46kzdgcnry6rgkmcp55msz X-Rspamd-Queue-Id: 99E40100010 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724876703-600964 X-HE-Meta: U2FsdGVkX18Nr1+SQPCZTJdxhCcpCWXA4aE5VZl1wd85DYgHt99+tbiX1XZQlkvuqudfwH1MrDj0UJFt5dfdcH9YidMoPIl/CFygSiBQrs0c4Ij5w8l5hj7/yKgnKQphOvccqQbZOQUbMJp7Ah1BDMaaOANQnY3eJSUUq7yckVyE3Laqdtu8y3KYgAv3ijiHFzRk6wo9bMEdxq5bEzHrMM0arke2W9H6EPr7fYJhzuZm3G+p4aN78d8MmGcnnTbGrS23l2dFpHcY4A59m8tcZFfoJCvlRCitnx0EGLnNmmeqlpso94pTH5JOgcb1sB2bxcTBnVXJV+aqlcFPZxH8eZFlVPT50anKPSVItU3CM8Dy+1ckpYYMHM/TkxTPbra3CsUJOLAnBHxDrVk2PMqMiHn9YrqBuwmDaKK4lrV018OV8TtqjK6FS+NTm1rh3HJwICpPzHF98vNgtlXAoslH+35+RPjUHXXS3p/Cw2msnqNXD9e9FzosezSj+Svu/IQ0aK/8pM3hiifLxSxCj1LKXp/bwSaWX7VgRByrpjP+CFysnNFae63LnXYd15R3IfqJ+xej1Fz8yDjZNqDQP2VAOfy8OLXAi9zvn/YsuR+lJ+l15lb7QF/hLBtzOyt/uu2TPE4bGp2eheRRPvX1NaYC7LgOpyvAzCnfSb/GzAv3dA1ZCGdAS7y0ibBmR7JErt2xoGPsrSwF8N5Pmk0/aCDzjKSLVcnrZzKs7pmHY5/wtNb7lOH3ph4851Uet9VQDV8XBVeZWP5ofzGLRQil+ethFnK5T5FyaAfn1slH0eV3Batc8tAUbCbnsoIquLrUkV8bGoLjPhPhr64zW80sRgCrRUxObmD9Y6DqvNz9HYlV+VkWWFtJST6XsTKeQpu3nIpNM0kFacyandJS4KF61zrRzmWFW5SwROZczvc8ZnrBkZoL4pZi1YpcrG0FXGaq0vq27PmQu94gYU6dIIvwxNj kPj9fYZe VoM6oLxrhh7ltWGTmG5KOudu5jPK3Yk23GO+wyMgioICMqGslt+hbYJEdJwnPZh7GcAWh/QOokAi2OdzDMKbCFpx4ZKkQe3BCODFMTVQ9n8iqgzlJmG4jrhfTqaGR3tR3wu7nvEj/jxqYy5zIKLAGsQW09UnHroQHTj4RGpIGDGmDXvQ4TYprsXgkDi8yWNwMx/L97SU1gS/F6JXsZLqIZyw71Z6HrtW1hyHyA209FvtBJVNFtKgQczoMFVW4qXEK9l4K8drYz+22dA9ugVDbNZuP/syGlIpKnxJgx1wHzIktipSJJELkhlBFPtXAosO5Do77m+eZsXFsuEFVY0dmK7YEbQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Since migratetype is no longer overwritten during pageblock isolation, moving pageblocks to and from MIGRATE_ISOLATE do not need migratetype. Signed-off-by: Zi Yan --- include/linux/page-isolation.h | 3 +-- mm/page_alloc.c | 27 +++++++++++++++++++++------ mm/page_isolation.c | 19 +++++++++---------- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h index 11b8695115ea..6a62401410c3 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h @@ -35,8 +35,7 @@ static inline bool is_migrate_isolate(int migratetype) void set_pageblock_migratetype(struct page *page, int migratetype); -bool move_freepages_block_isolate(struct zone *zone, struct page *page, - int migratetype); +bool move_freepages_block_isolate(struct zone *zone, struct page *page); int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, int migratetype, int flags, gfp_t gfp_flags); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4ea5cd1a07e2..dc7c36461953 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1764,10 +1764,12 @@ static unsigned long find_large_buddy(unsigned long start_pfn) * * Returns %true if pages could be moved, %false otherwise. */ -bool move_freepages_block_isolate(struct zone *zone, struct page *page, - int migratetype) +bool move_freepages_block_isolate(struct zone *zone, struct page *page) { unsigned long start_pfn, pfn; + bool is_block_isolated = get_pageblock_isolate(page); + int from_mt; + int to_mt; if (!prep_move_freepages_block(zone, page, &start_pfn, NULL, NULL)) return false; @@ -1784,7 +1786,10 @@ bool move_freepages_block_isolate(struct zone *zone, struct page *page, del_page_from_free_list(buddy, zone, order, get_pfnblock_migratetype(buddy, pfn)); - set_pageblock_migratetype(page, migratetype); + if (is_block_isolated) + clear_pageblock_isolate(page); + else + set_pageblock_isolate(page); split_large_buddy(zone, buddy, pfn, order, FPI_NONE); return true; } @@ -1795,14 +1800,24 @@ bool move_freepages_block_isolate(struct zone *zone, struct page *page, del_page_from_free_list(page, zone, order, get_pfnblock_migratetype(page, pfn)); - set_pageblock_migratetype(page, migratetype); + if (is_block_isolated) + clear_pageblock_isolate(page); + else + set_pageblock_isolate(page); split_large_buddy(zone, page, pfn, order, FPI_NONE); return true; } move: + if (is_block_isolated) + clear_pageblock_isolate(page); + + from_mt = is_block_isolated ? MIGRATE_ISOLATE : get_pageblock_migratetype(page); + to_mt = is_block_isolated ? get_pageblock_migratetype(page) : MIGRATE_ISOLATE; + + if (!is_block_isolated) + set_pageblock_isolate(page); __move_freepages_block(zone, start_pfn, - get_pfnblock_migratetype(page, start_pfn), - migratetype); + from_mt, to_mt); return true; } #endif /* CONFIG_MEMORY_ISOLATION */ diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 7e04047977cf..3ffdfddbdd50 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -181,7 +181,7 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ unmovable = has_unmovable_pages(check_unmovable_start, check_unmovable_end, migratetype, isol_flags); if (!unmovable) { - if (!move_freepages_block_isolate(zone, page, MIGRATE_ISOLATE)) { + if (!move_freepages_block_isolate(zone, page)) { spin_unlock_irqrestore(&zone->lock, flags); return -EBUSY; } @@ -202,7 +202,7 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ return -EBUSY; } -static void unset_migratetype_isolate(struct page *page, int migratetype) +static void unset_migratetype_isolate(struct page *page) { struct zone *zone; unsigned long flags; @@ -255,10 +255,10 @@ static void unset_migratetype_isolate(struct page *page, int migratetype) * Isolating this block already succeeded, so this * should not fail on zone boundaries. */ - WARN_ON_ONCE(!move_freepages_block_isolate(zone, page, migratetype)); + WARN_ON_ONCE(!move_freepages_block_isolate(zone, page)); } else { - set_pageblock_migratetype(page, migratetype); - __putback_isolated_page(page, order, migratetype); + clear_pageblock_isolate(page); + __putback_isolated_page(page, order, get_pageblock_migratetype(page)); } zone->nr_isolate_pageblock--; out: @@ -428,7 +428,7 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, failed: /* restore the original migratetype */ if (!skip_isolation) - unset_migratetype_isolate(pfn_to_page(isolate_pageblock), migratetype); + unset_migratetype_isolate(pfn_to_page(isolate_pageblock)); return -EBUSY; } @@ -501,7 +501,7 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, ret = isolate_single_pageblock(isolate_end, flags, gfp_flags, true, skip_isolation, migratetype); if (ret) { - unset_migratetype_isolate(pfn_to_page(isolate_start), migratetype); + unset_migratetype_isolate(pfn_to_page(isolate_start)); return ret; } @@ -514,8 +514,7 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, start_pfn, end_pfn)) { undo_isolate_page_range(isolate_start, pfn, migratetype); unset_migratetype_isolate( - pfn_to_page(isolate_end - pageblock_nr_pages), - migratetype); + pfn_to_page(isolate_end - pageblock_nr_pages)); return -EBUSY; } } @@ -545,7 +544,7 @@ void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, page = __first_valid_page(pfn, pageblock_nr_pages); if (!page || !is_migrate_isolate_page(page)) continue; - unset_migratetype_isolate(page, migratetype); + unset_migratetype_isolate(page); } } /* From patchwork Wed Aug 28 20:22:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13781800 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 273E3C71121 for ; Wed, 28 Aug 2024 20:23:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B8A6B6B008C; Wed, 28 Aug 2024 16:23:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B61656B0092; Wed, 28 Aug 2024 16:23:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DBC76B0093; Wed, 28 Aug 2024 16:23:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 803AD6B008C for ; Wed, 28 Aug 2024 16:23:39 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E1C34120857 for ; Wed, 28 Aug 2024 20:23:38 +0000 (UTC) X-FDA: 82502779716.11.982E320 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2046.outbound.protection.outlook.com [40.107.243.46]) by imf02.hostedemail.com (Postfix) with ESMTP id 21F188000B for ; Wed, 28 Aug 2024 20:23:35 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=V09tYkAB; spf=pass (imf02.hostedemail.com: domain of ziy@nvidia.com designates 40.107.243.46 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724876499; 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:in-reply-to:references:references:dkim-signature; bh=p7modIZk/c+cwKVJ1OUQ08Y5sIt5SsC21/jg0tySFpU=; b=iVhIdKZxzE0gZsL2vy38BsnKxSQ1iRxZumw3VcNVAOD1FZKJPnBJw4ti8fHDOubg6oAjZO hYfnn8I/Pj8xOta4Jke48mUdZ6aYckE2njF9MdzE2KO5e9pS9J63XsgnpOS6CZW8D7lNzU oEmyZ4T1BmNCgSM/7DZp4ly01zbKxAQ= ARC-Authentication-Results: i=2; imf02.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=V09tYkAB; spf=pass (imf02.hostedemail.com: domain of ziy@nvidia.com designates 40.107.243.46 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724876499; a=rsa-sha256; cv=pass; b=XMconraeOt99yJobn/6ITsN1f/wqIkVavMhhxBfuh3ryVWsV7QfeVmGtXEUdTbipc2bt7R 547mxL0KyEB1u0kbVGZ3UAEm6B1W63UTAVCZClfXLcwc0Nij90iMf+EVmt5FZLzikxq21+ FyEi7PycXGn2Ldd+yRHHW/4yqXuiz/Y= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CT4QBUko9vbjNxRgczjzPMc9Z15A3iaRYNRU4TeGuaOgXz1mtWzHcDkcGR2tkvprMZApaBN7S9JJvfq2I4mns/SlpZ827hHSguk5VxyEH8xK9g795BSltJFEWxj0Q0T7wWvhGsPdN4iKtwuRaB0F4eeft6vImCFJnNBP4oEbYTGF/5V9jQpg70OtyEOqBUDGYnYetCzWtmXHJFVfzb6M4+kPrQXMq0ZyaHm9XfmhpYFJvLXic46ZK9nTs1NW19Bq9JdKRmvTPyk3hHZKlpIfVTmBiqfqkAbKs1yFHRKdSkH8FIOq59E6kQsV4O+wIAUGY72CN35tZz54DEscYpN5LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=p7modIZk/c+cwKVJ1OUQ08Y5sIt5SsC21/jg0tySFpU=; b=foNnvJ9b81qGgzenOaUJp2bONIZnB+ahNq7SQC0gdykRcH9ElRbQSXunMarsfW2AiJXGi2l5kD6WNebvfzv22ycvGCmSLS0XAi/t0UjzJTBHK9OLRY4XV8q/lDtMaQvjEY9WG87zjYgRWx+e4AnSfw3IyV1Zo64CwgM3mADJ011FGVInH1pvUh6YoBD7uIM9/AhC3TeuRQP7JBIX8AwJhnsYfC2l8vvSpCo+1WjewxYqfF67mMEFjjW40nIbDRGNzoBxlNEqdw2/yeLBw/IkEs2JRx+JOmJHcWAhA1d3qBi5w85HL+rCX+n4+ALm/fUCadA3xD7AZe3drlixUISFsg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p7modIZk/c+cwKVJ1OUQ08Y5sIt5SsC21/jg0tySFpU=; b=V09tYkABBO3gMBeGFvw1iUR/zLtCWyG3oEi/XNj7MvtGoU4Jk9K9pOxaXLc2CKQ9jNwRgdGRooJufFGPebKamfkcjV6yQcBpKYWKWx/labMdlLwUbodeYeaQyfd+JaRImfd1bkv2kfwkRaw7f5Q1QIvV3dV1WWbZXDROrM5GFHdaY2zmSrK9ucuOjuffu3SeK5LsYuUdcojiH/BsnW65bd58fV96YHpJfppBqZl0giQVOxo9acZQwpEqPc3+iMNjQ4Ufb3DFw9dEA2TPB2deq9ZBAqHGHdt5w7g7nF+KA92Yc8aEUBqzMVRuet1/UYH1GjK8BHActY+wM0HpZDGglA== Received: from CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) by CH2PR12MB4134.namprd12.prod.outlook.com (2603:10b6:610:a7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.28; Wed, 28 Aug 2024 20:23:22 +0000 Received: from CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f]) by CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f%5]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 20:23:22 +0000 From: Zi Yan To: linux-mm@kvack.org, David Hildenbrand Cc: Oscar Salvador , Vlastimil Babka , Johannes Weiner , Baolin Wang , "Kirill A. Shutemov" , Mel Gorman , linux-kernel@vger.kernel.org, Zi Yan Subject: [RFC PATCH 3/4] mm/page_isolation: remove migratetype from undo_isolate_page_range() Date: Wed, 28 Aug 2024 16:22:39 -0400 Message-ID: <20240828202240.2809740-4-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240828202240.2809740-1-ziy@nvidia.com> References: <20240828202240.2809740-1-ziy@nvidia.com> X-ClientProxiedBy: MN2PR17CA0023.namprd17.prod.outlook.com (2603:10b6:208:15e::36) To CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CYXPR12MB9320:EE_|CH2PR12MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c184413-bd0d-4c96-be37-08dcc79f4361 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: qXgrcjFlF8eUQlvfFSGqYZuj4p9PHQEg8R+Fg8hFUAXZpiW6opwG0/E8JZKwtf7L589hxc7caEvfvQviG937hxM6tRhdrmBzDn1zZFUW6W/x8vr+A+844AnCUsRShxv5UcbmpAqIh3sClCr2MAnHdv6uYO5wwRFlidSSkne3oUhgz1f6+qXnkeYJncgaCuqbW65ihKHtYHg6PpcPgzxPDwLY98jp3N7w+9VlXeqRRc2Xga5UscEVRJo1ZZdcHsyZndtYTBJTO0yz0HO+o4p2H434auZzZRP+XwM7WYucjJXe8bvRCgq9geXhFNFymPY9cA+t0BjVxHIKw8VKbzr1LMMljCXH6yqww1nbaf7lzNd8RB1QUUSIlNzUV1enrslg6XBC5dpTmJ3d2/7dYNag5MhnZPYHy+GZP1RwDtQ7glPXx01sG+c8xdFuCMO4dYRzABh/G2b+hBmrZzo7I9yksUuvsRpuzqpa8An8TiIoCvBVCkNrUtPn4nwTob3D8nWSCA6Rvfj3guq+rcnJ5O1pkmfiBDqYUAUzbR6hMRssLJE59N5oD8y8/VzmipSoH3e6HOR5TNYD+OTc9T/vEhGNz2Nz2jr+kZ3M8J66Z3Ts5CgqeduCMydIF/lixazu+4i4fFgSGIq9cxXzUchcIIl0IJyHKWt5cQjykRQM6nQcQiXn510UZGd8x9wjKi2V01eGnHSD6MDvMUuT/v084POQwjInWd4oW/tuCWxCb4GfwlsfFnXGoCBGLPzAG/5JsGIcZ0WiaxdyrbywtGMugRL/O13Z/K/ZO5mjrnxpb4JMIN+Hq3lNCPHB5M27ji7JY96xMN7zAbH8p1hRWj3MmptoQnzkcMXd3AoHp3aza3yH93rs+8gYhdjuQJUgEkVQhQWzDy2K+qPmQ8fBE7nvepzB00f48o7krHrGCl1lR6WG4IIheouOHSUwiV5q/8hTCkjpiwdCDD6Q8LaeqD2Y/BsxNbjM1e9pCNdhbKcD3W3P4PRaGVsT0qDvzWoYr0tkLsRDEhTRuLQJYx9/i8Gjw2sgJFjPRZXpUKrbou99hI16oCNS5pzmzbSp9SWL0l/7LTY4UosnzNyHDYdE+IBbZlmT9MMwy8ycb4qB8De7T/joi/Cmym0YRUR5CG/2mQO5LE2uBk+sacDmz0zJ3LTgt6A1Gi02onaQbFLRRfcD63lYUCSg9KPmQBO1fPRkYyfXCMjT894Pliz8x5rtaH4rB85tLQRe6hlZPvGkek89wiSirnob8AiIm48pm0+vq7CNGmlfctp0smVNaH/zfG49FjKOmQrVTf9qOnOPNndnp89IUjdsIjfp+O17zM2LhJmoU1T0qpD+I8HF8JFlHN2PESmhOQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CYXPR12MB9320.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8bb7p364t5AUlyeEHlQL/tLUzXyR8kcZz6kMp675yQh2N2HIDfk4/esmoNjcyJgcHBrx6idA3B+2dw1IqQRVMpQsUrbqHy/LLgBvd9w6PWkmjXE2pU/eEI86hOI06/vDCLyzTDisd29smnJx47TUFsawyfIOw9F2l2oj+w/pcLH+zI5I9k5qAfFgCVURjMrDwwIboxKOFpkLKHm0R+alYD5ZR5orJW+73vvZLE3kUPcZIy/o1rQNSi2es4pL8sYTdScX3s7tgRIjyE5X5CKlxnE5X+QrdUwflvwYDRqltN9BtAZksOVxhFN18YZ+fW3VpOpW/Xhdku0pEFXyijXDZQEktE3BSqDlPjiSqEqHeFd1DIcuBvPVBYox5Mo5tT83SDotG6FkN9EGbc6ylBYLo05pWn6P72ZbXe7S7lf15NbwqM1DU/pm+DeN3e1e4QHzViZJUapjyOl7c2Cjj0gfkFIKRrB4CWvn7FrJXJXVeqahd586Pbj4rsJHTFk8iPWMHG4gU07jNjuCPB39MkiYI6qZ15j6+FOnSunHS+ihER+VnvEFOQfbl6f+vnlBofm2Vcou4H/bvjYwoEcIJcmJfHonn+QnLqW1zXClzseZcl719zrOjswgNWiLJNMwZLdxn6nGQkR/Dpez2Y7z3LHCDU8/TeYSTRVRa+2f75P7f18ylibczjF4Nks+YXUlvgPUCdmPsD7VJle/r6cNxiZmXHpvPjm8NBmU168Vvp6Hx04HnxX5ffQZcSNJ4oPe/YgQAI4i5ABC1P9iijTPN/WmxOTlLSUkMwrLzZOYKeliiuwwoVxHmmDH16/vU0uyRGXrEm+YgMODul7ei1SoN3BH0gduaWxLxvo1RDu4EN/HI40L7f9cH/Wib11kYdmsmt/IYfGcDgSEZQw0CHF4Dc9rjlMNaZt3j1kB998g5Ls79GOgEjNMVtfzs4aSVBoxxcXLWc4kKdzzX5hb4Bn87okaE33sIuIKc7ISoOKy/qk2YhXrCEgAVc32dwZmZ+rYdicPgRRULoLT1uco0F4oFkELD/+kVHjVGfgtn99wOK4itOhotk1c1VX39wSyvWCPRAdhxcp4s+guQVfVMYX7ccPMOJUbNMBXKt8Hkxs+9vAvfMuq5x2HXsFSibK3aVWgl57k5fNza8NlywiSG+JjS4itIKa4usFLtNdgWNpDJ5MIkbgtWymKD96cZqqMoFIoc+dtVOqY+uZ9mjesSZCyowif6ScpDmOrOr5gqiHT6ku6FZaqQocvLPlDEGqoLTEdamSO8K3pQnUd8tIOTkeO7Om0+Ccz4f5KwMkjbl960vS1IIUqpwUCu07Wbn8+OVWI4Z8Xe65c47+abmNCvu14XFWhWgsgneyDfRQQXrLzHEprirLf+FJbB7u0gEOCi3zlFJrxenMyZtZHHkhlzbfjyGFY5otaho5pCztR6XrzVIdGJtJVegLCmcikrGvkuintWpl3wAnJJskFB3Zwfn0/OA4z6JTf1oJ4LLiQRoBxd6aXSf5a9h2euI+A3L7MMpGgGOJf2p0Z73ycilyT2iE7DCp/Yx3fpFWeHREQG9E7c++wdrs= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c184413-bd0d-4c96-be37-08dcc79f4361 X-MS-Exchange-CrossTenant-AuthSource: CYXPR12MB9320.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 20:23:22.6019 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: R80fIZ2dcJntLH8Iq37sRLmGELf1ZKcbOi2v80z3NFm4H2rXpIos/GrFu/L6oMHK X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4134 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 21F188000B X-Stat-Signature: 9qqqdwgpcc8bjqjopdead7gkfe4qne3t X-Rspam-User: X-HE-Tag: 1724876615-829459 X-HE-Meta: U2FsdGVkX1/BNziZTX326GSweuEdSSDBe+GvTqTRWCjvd0wWure+U1BE6c02cILZl40qFlwFn0cIzBg6a6WvEL3JKy0hxELhdO640sjGV/AhuFtKt1g14anUVP8yKihESnXkA7jl2wW3ZOPSfVq83CrWZ+pJdxIgh+0YUutNBZ1if+MTHNTrq/oHeyW2eCOfhon2Fb1mOq9EB4rffqY22offnoXXugyiGKQ50MxfRn/OMRdq7BWETqES4gBPiSbKvtmmmj3fPKbYHaGQfpPMjfkiNWk9P7IcgKwOxwkKp35xdVf+E9ebOtZKG+5KF8FApnAPUZ6dnt3gvfW0Wi/XsSPaV5X4OjMSgLznZKEVMEzWbFhUJhbIBW9r22umxnXKyy6ajxtNxcc9s33wx7jkYe+/uQi5qmqaI2GAa7Dz17R8ZLcXxnELvSvqdEzWaZPb/5972fn5Kjfr/ziMwB5oWj7hTqb7Bin+aUWIWvxjZ4Ps+tDTdTGid2V0sVjJes7yyDAHHlesCE1b1rA0c1JO9ZqWWb1EznfqX3hfVVHQY3vZsoiCYuIFM5RPGgd3YJxCoQTPBjSHxZALU//n1KyS/dZfcgl7GZ1YUNmVJorzFlB0kPrI4jXoFrjl4C80eoFkH1vkAC6pyYWTgFXhq2Qf5eGUXCvrG5YaFfoqdeZkR9Ll7LXQyRawAl8g7bUngJ0cSbOJI9f8M4Lw3tmd9/Fb62UEucRNwqveFAVtPgNEPTCg3zdF5DAXu+bnlXSVgg/nCS4hj6XHmJU0IjmmGb26xWp5ieXnzZr3Rm7K082iVpwxNK1daLnTmOtQJegENgoFflgERabOi9LKXjQKapTzscuuFQ0g0jX6WeO11QrzWn9T/2kvY/Px5e7ZVx7eW4fLjImjavZ24YbW0OEH4skQ3FyK0lysWGwOuqcE0ev48HP3eMcBW1Gto8p5v9ieT3FVkAwJTHOjeutV+U07135 rHJNY2sq Jl9vUvrdSKQpH2r5NdnL1T55AN4Lal1sypa1P3Hfu0f3Lk7T9Qm93xJjXlnpTRRFeJSeNgoK3uojidS2uMCcPZqOmhx/mVzg0LuPGhuVYjFqoXDqW/hX2dxvtjSMKLwAcCS0+m4mE9E/mtx4Et37PNBxdpDhTkMVIWmf/trgyNHeJpVYB/+fszUkSJ+ghGasgPmVMnGAvuTRRG+x9fBEf3UVJx8N+oyvjAWjAXJSL05dreBsP9o1jokt+FeXbq7erH0PT+MlplSffklWcHl/cgPePoAcaruWetx36ayWyRE7hjqQyB77skGMewdJ9vBZ9g1IjrkfiQoPFFetpKQLbuLnsOQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Since migratetype is no longer overwritten during pageblock isolation, undoing pageblock isolation no longer needs which migratetype to restore. Signed-off-by: Zi Yan Acked-by: David Hildenbrand --- include/linux/page-isolation.h | 3 +-- mm/memory_hotplug.c | 4 ++-- mm/page_alloc.c | 2 +- mm/page_isolation.c | 9 +++------ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h index 6a62401410c3..c2a1bd621561 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h @@ -40,8 +40,7 @@ bool move_freepages_block_isolate(struct zone *zone, struct page *page); int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, int migratetype, int flags, gfp_t gfp_flags); -void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, - int migratetype); +void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn); int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, int isol_flags); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 721392906dcb..4265272faf4c 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1202,7 +1202,7 @@ int online_pages(unsigned long pfn, unsigned long nr_pages, build_all_zonelists(NULL); /* Basic onlining is complete, allow allocation of onlined pages. */ - undo_isolate_page_range(pfn, pfn + nr_pages, MIGRATE_MOVABLE); + undo_isolate_page_range(pfn, pfn + nr_pages); /* * Freshly onlined pages aren't shuffled (e.g., all pages are placed to @@ -2104,7 +2104,7 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages, failed_removal_isolated: /* pushback to free area */ - undo_isolate_page_range(start_pfn, end_pfn, MIGRATE_MOVABLE); + undo_isolate_page_range(start_pfn, end_pfn); memory_notify(MEM_CANCEL_OFFLINE, &arg); failed_removal_pcplists_disabled: lru_cache_enable(); diff --git a/mm/page_alloc.c b/mm/page_alloc.c index dc7c36461953..4d06932ba69a 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6679,7 +6679,7 @@ int alloc_contig_range_noprof(unsigned long start, unsigned long end, start, end, outer_start, outer_end); } done: - undo_isolate_page_range(start, end, migratetype); + undo_isolate_page_range(start, end); return ret; } EXPORT_SYMBOL(alloc_contig_range_noprof); diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 3ffdfddbdd50..4c65157d78ef 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -512,7 +512,7 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, page = __first_valid_page(pfn, pageblock_nr_pages); if (page && set_migratetype_isolate(page, migratetype, flags, start_pfn, end_pfn)) { - undo_isolate_page_range(isolate_start, pfn, migratetype); + undo_isolate_page_range(isolate_start, pfn); unset_migratetype_isolate( pfn_to_page(isolate_end - pageblock_nr_pages)); return -EBUSY; @@ -525,13 +525,10 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, * undo_isolate_page_range - undo effects of start_isolate_page_range() * @start_pfn: The first PFN of the isolated range * @end_pfn: The last PFN of the isolated range - * @migratetype: New migrate type to set on the range * - * This finds every MIGRATE_ISOLATE page block in the given range - * and switches it to @migratetype. + * This finds and unsets every MIGRATE_ISOLATE page block in the given range */ -void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, - int migratetype) +void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn) { unsigned long pfn; struct page *page; From patchwork Wed Aug 28 20:22:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 13781801 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 B5C1DC71121 for ; Wed, 28 Aug 2024 20:24:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 522BC6B0093; Wed, 28 Aug 2024 16:24:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D3836B0095; Wed, 28 Aug 2024 16:24:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34D0E6B0096; Wed, 28 Aug 2024 16:24:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 104FE6B0093 for ; Wed, 28 Aug 2024 16:24:53 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 820C91404B6 for ; Wed, 28 Aug 2024 20:24:52 +0000 (UTC) X-FDA: 82502782824.09.2C38C1C Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2040.outbound.protection.outlook.com [40.107.237.40]) by imf08.hostedemail.com (Postfix) with ESMTP id B778C160002 for ; Wed, 28 Aug 2024 20:24:49 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=IkS+S37E; spf=pass (imf08.hostedemail.com: domain of ziy@nvidia.com designates 40.107.237.40 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724876646; 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:in-reply-to:references:references:dkim-signature; bh=ESXEMzvkaY8fCTVrMJZ13dyf3x5+XzARSC5a/TwgfHA=; b=hJ8rSUu1pR078FpLQosGFEvmtJ8RQkgrG4ytzg+goKi/rF35ep+QyJvVZhV6M+D3qthCgt Y7Vw8gk1/ovRHj63cYN3kiVsQRFdAhRG3/HHvCgwa+Neyr7L3pqggpB1REMAeaecmtfBTW fs3jsZRZoyw1XWe72i+rbPwOM56Tszs= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=IkS+S37E; spf=pass (imf08.hostedemail.com: domain of ziy@nvidia.com designates 40.107.237.40 as permitted sender) smtp.mailfrom=ziy@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1724876646; a=rsa-sha256; cv=pass; b=oYZCifX2LkemGMJU0UI2RU4uatfaFf4dAX4iG7JWaFTuZcs/m/puuDV/BjIEOEtjrJ0t3u /93g1lr6l86A8OzdrJZWD4PxuAHqIJyhNMb/TBNtcTdlKR8S3GH7eHruvyIIz3zqtyDkn4 AQi2QD21E/kPhPUuP3QnMMgcyNbkPnA= ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KPSP4HqIVZ5zxk99x1vPZBLijjR20TDWEubGr94yk+lgiQqCu+B6sxfeTWjalHGgKojhCgE2CiBIg6H0Bb+pF7aeZI7cEZVpiksWW1OUl5sHyNHYGm9/hglAc812iDNzxV8CAbZiZD6aKCPqyHf3DlH/fNfT0NSaQ4842a6MSknAXHAWPEHKLzJhUea03aTk8a4wTXd+hWrnDJTbSj1zOpXiGyKN9ou5RAG89WzJf7DZpKzbb4p6buL/l4LJl+PiewqVMCnV6FSzyGoo8cGksOhi59g1mQzi0PCRt1uqD3jg5dsIp4D9/ViL8kEJRwor7NLY7QB4L96F5pF2sk6IgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ESXEMzvkaY8fCTVrMJZ13dyf3x5+XzARSC5a/TwgfHA=; b=Ov1AmCd0k5d3Q4YK2TJDsOdxw8Opsz7Qo5/E4+UA0gGglpYnF+HoCdL/benBkrepAFxcGTkJRC2TwTxNFaDW7hluOFV7k/9V9lcLFe4qBL2dA5Ldii8hewLNE5r3Nne8NHzmMzWqZycd3U20D5EhnYsL1sjo2t3bKffF9Uii0c/IG23u0o+44SXIDbyP02ohq968yTYzkDoKuiMnNdfrewODbjVQgjeBsv1xtmW5p19sfQFMDFeZwIAsIOcs8QkoLHVRHVfDeEXKwm3+KTwUZLRUEAO35yIqjHd3t6TIM6K3wGrxH6e5s08diNcdMYkg5yqJSM5Di91K6WMHXlLcZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ESXEMzvkaY8fCTVrMJZ13dyf3x5+XzARSC5a/TwgfHA=; b=IkS+S37EWG6C0ZQUOnS0yYCrOBnebc39vmt8826HBkV9/j4r1UXs0m0Cw6x/TJGpswT8LHOtAAOg0RbqcVc0XAvMxMeC27V0f7kz+gN78pP4oyIZIyujb8Pw7mVcCd68kvP14RfvW3msTiqyUrcupGamgfH8XzilQ82MGJvw8NQ3Zjkcz3xERnA5N5GSKMDNGA2un3AlGlaIgy8ZI8oCy8Kl5gf2ukijNZxoP192AkawH5U+kch7yz5OEToK9kiwpdjKiZjb2M/Gbd14nqjJlsdZ4gsPGfNz2TmfeexCmChA9RgSIaNJiZf2/ke0F2BbKYQ2O+bbbtlL/xRz0yqf1w== Received: from CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) by CH2PR12MB4134.namprd12.prod.outlook.com (2603:10b6:610:a7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.28; Wed, 28 Aug 2024 20:23:24 +0000 Received: from CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f]) by CYXPR12MB9320.namprd12.prod.outlook.com ([fe80::9347:9720:e1df:bb5f%5]) with mapi id 15.20.7897.027; Wed, 28 Aug 2024 20:23:24 +0000 From: Zi Yan To: linux-mm@kvack.org, David Hildenbrand Cc: Oscar Salvador , Vlastimil Babka , Johannes Weiner , Baolin Wang , "Kirill A. Shutemov" , Mel Gorman , linux-kernel@vger.kernel.org, Zi Yan Subject: [RFC PATCH 4/4] mm/page_isolation: remove migratetype parameter from more functions. Date: Wed, 28 Aug 2024 16:22:40 -0400 Message-ID: <20240828202240.2809740-5-ziy@nvidia.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240828202240.2809740-1-ziy@nvidia.com> References: <20240828202240.2809740-1-ziy@nvidia.com> X-ClientProxiedBy: MN2PR17CA0014.namprd17.prod.outlook.com (2603:10b6:208:15e::27) To CYXPR12MB9320.namprd12.prod.outlook.com (2603:10b6:930:e6::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CYXPR12MB9320:EE_|CH2PR12MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: d0090a3c-2317-42ec-6a2b-08dcc79f444e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|366016; X-Microsoft-Antispam-Message-Info: iHva1wSJ7QXHvi+jUudCWBs53LarsRImlF/OrzO0GOhjgzp7ECVNLBX1omi40IB8zKqqjEtjDNqy0P1D4982/elR203vRjnfEOg9oFbCOMU2wdZAwMtxKw75NwFBeqh++s9g8UTigFBibAZ9AellrKyASGOPAO1Lg5jqJ1/zExnlSt7lN1pK0PuvlpZ0bRXQT4T7mijJ9yijt6ANXDkLzYLN8SGWED0Ceps2Q4KjE9oVB2/THYFVOJIV622Nmi8Pc5HbPAiil83AzzsH4UaE06DYe1Gq43mQxIhgTgJq26MF4OXMzsmyjVSOrFVbzaKvC3j+JE5VxpjHOGTwBzY/Sskem44PA4sHGo4CxIZL5aZYWGXu0mKK808hb0bMbnzVIyFZdqOTbFmrWo5lttfI1QBFTq2cL7SHDogZrRuMqWlFH7BKdsk1/7Ozx2p2H5vVkfKFM+2pJcDK2mfyf0CWQnAkf4RsQhKfvSzAj4LZfFtB9Lb67W241+YUrvJFg1Rup73EDZwEWnRGlOxVep53fhf3Kpk4/Ka0CmZsqgAPc52bJ23Oa10BFY2CYcoI2xuDQgftCzfAnd5bc9kZ/FKiuidw3rJIzz06imcSyTOts+H/BBlxrN/7GbPyC7U1jCoI8mmbmlWsB51rlWzOKC5MBtW0hkQ4nI4gLk2yeEnGSfXNFJx5chRGTSRJ0B8XvQyRPWqySJFobWaBDhZB6gwvS7R1t3PZUF+3wRkdTENLg85SzMcnVxi+O66pdQZG453zFQn82Yy4H8hNkA7XUHTZe0ad6cM+auJ8jaCIFIWm6147c2gVuOOngypkBCuBAbJwgTE5igJur9lYR6bX3f0ZpztNlONoQaakn7I0lo995DY70rIXv090CQPIw55tsqpFrxwQCkBE5VymozGcFgNfraOf5qJDRFJy+5C6v9xsuYQoBNCK9Dg7+PG9PbHQgkY8KxjfxX7e35UpQmfzHsuhlOAis3ku2dFa+ts7Ww+AjLruKkIJ1BBz1Im4uKLUZI0HKU0/CjYk5Qd9xwnPfTYvTOo5I4XQUKAFk6vXLLp+t/0wfWC9UJfJt04tRTOWkYPVpCrjOCLXadWNb7Mt9oUdvmXnR646/3L0B/vhBxgDpigQq+as7QA43YlxZEqjPsoiHP197thpM9qsz6fkfc670Km075CRHtQZTO9qltjGwNR/mmInwHVYyJH/hgPQuB4E30q5kgAgpvYE0PzmFs+kNKnOrTeBuHR/YpxnQ8NwRcz1aaXwwO26CFtxrt0bqlkltIqtHbDveYL201F1V16HqW8yBgi9m9HkCf2UjwvN0FtdSTKOZUHW9yWVJj5VmPiv3XMWT5S1WP4gta/tXEWx+Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CYXPR12MB9320.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(1800799024)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: psCVAFuEP+d1WszesLeFR2a4afTwX0JQda6TDMIWxBZR1zeHePuHElk3nqgGi6CM7B9UAxWLJAQQY9qmV54nM8WQY5PBdOm8c5z6X8z/E/PiGuONdzcF5oWHqDhOqke6xKp1YTzFS3rznb9TpHTXH7GDQ2QdXc2mH1I31gaRmU4d6D+DeZqDIhBrHSWzwEbDIBYV4FWkgxbC8DAPkygW9ml4pXUtZYefdpq3ULJb2Krmeo2jOZ9PlluLrRwo6DRdtBBtRA9zp7PnTsfguVQ9DIBDg2kPZhPKE8YiOZoL+P4v2GMJfmIXuTDh6vG/1eT95gwISGhjsVvlgHN44AfyPo+slcy8H7JJjNfbmgfHTYZG9PgsRg3wA0YqWOKkJ80Ago9ODFnFmb8USR+VcTKHQFONgIw1zaLxFTKl60m/7Go5bPl/Q+mdfC12jOFwDXldOvhKDgXF+bteGpFfl0mcZudBXapP4Tg4fxC/wcYpzrphtYP61ZICBY86wa5aLgfIYQQJWkCwHqWn9fQWhC6FqCv6N2pVrYMhFV82p7yXshmMUrDWqfip1XxV90h2E+LrYCBfNNDpFFSekb6yQEee7TZUPMrGSPg8neX9HrYCmMhAjMlkh53Oth+EFr9UfEym1Vm70Zwapz9WjbsyKDR+10PNloU/ku8wwL6sFt0eHKNL4qFRXRI2FzBRZQhrPgI1hcbbaa6PHkUGqAfU5f+/zE7fUwAUlY3ZFvMCLnnTXaGjyTG/QaG82ndnTySWYD9Rvlvvah3amlQzWYmCKuP9SlI+BIG6dAMmVKTRXAKWyXZNz+ws/bY3nNpd/6GzRvJJeFpC1oaCKET3RwGEU7C3KLpAe2TX9K054Ol5eLpIZljw7DW4JiCnVFe7dt4+m9jTzTmBwWWHCv4VXkZBq/4u/twAX1t9Yrzv21pdmn94lAlMYDH8G3kSqYByosvpgwEz8Hflj7drWzlwxplON9cs+tBj7dcD/PmGnKVS0411iN2ZT59nG+NQ3pmQ5tTdI/fJYzk1h1q8JSH3Vsr6uzdb/y2RyH/sSjxLStB3TcHzKxPwh3euUxHIAISoQmZMlMOypSHrV3F6cQA9OShuSLnhhFjnWzL22TZuZPmATGe+GuU3jWduAusHbW2j/zYfLvfw/wh5P48Vu+nIdNvxZwwWOCHXVXWcbQ5OHkAbiUx9BZspzjpmqZWvJh/C3Fz+flDOlnqsRmlbihKBf9EfDebCYoKpzjdHW+e2egv2Vphl50DcowFjc8RsSvybsp1MQlIy4GG0KKINRW6geOLYgI4vn9oqgOXkqafLihI3UJvPvqbWHhHAUx/T1DDJruZKvEXnYNcHzstyFgEI2FqC+0jnCCmIpor5aPmBjS3xj0/tzDQopPr89X3RhXXykRjIsBp/AMuutzmkC947fRY5euUeeJwBkeusFZBFR8AQzskLNJk4qU7/G6xMekXu6SmsTMpRrk4WqmiyAWmmqyClSR+YNmteCRWJmbAZYANJVL/YdmZ9d0EvVGn7rr7RP6WMqkkoXSuDRqhMw6Q+0Y2U4i0og8jNOpd9qbG8ko/gZaJly4M= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0090a3c-2317-42ec-6a2b-08dcc79f444e X-MS-Exchange-CrossTenant-AuthSource: CYXPR12MB9320.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 20:23:24.0615 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BWyMUE05TSBeYEVVKEo7gzrBtAToFdL4mPsUeD2wOrP+HuYZWaZRHzaJjimdnMDM X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4134 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: B778C160002 X-Stat-Signature: wwq8c3rr3jr517at8njy8bnkcooxrja7 X-HE-Tag: 1724876689-180617 X-HE-Meta: U2FsdGVkX19310OcE/Q953QErl9ZPlA8XdgOK+41zINZTqh+Xfr4wpiCHg0J0Iv6rOTOaDnG6K1uY1gWAuluOTpDwttHQkhGnMoiflMBGHgHwVUQ4f3lCQqhClchHIjtG4QneD+h+lbVA/tD5q8w5kiwhkkA2nPCX7la3XuGJnAfYcS62QhrlMdsov1Xq/ZaiGrvjO1edMEGsRnmqcKvmpVD04MHHRB6yIvdeKS6EI/2CWTq7kYi+6a3KKy2aMxsPE42AQb0xi/CdJzErVgoBVI9HW01BmG1wpXo/ilZM1U7pznu7/XUgMCUpfyxqC9OXSmxlljT8ISd1E+pYeUdz1AISzoHwv0IkkE6U1HZjENFGSfkJK9TBHQ/rB1KUUghBaneKjgXAT67sriVhcX2aPhE64G2Tj/K7DF9Vgb+QS1njcX/aYvPt3Gtt1ADG4mErNtLjU4F44jBwkYDGCpe/TQXY8kfSovOCHptGebOEtTILtHZK7jxtoUqMyfa34tiCK6fmvVpj1OTZiyJnZpI//gkNyLHD+T7gMJko9YVtS5LTNdCdbP+rqwOdHkc1EewqCInmWXbWdwDGcSiiD+rT9CzqNVlYnWj89VKP0I6mkVVWeBYdrrZ6zHSRwqXz83v8yZ3W2sgqUKgO9YxUSfs7FVIgmPkh7yX6H1pKjlN6bRt7fkUc46T3osm31URZgriYIHk/ZAq8NUcJ7DOYYACH5bDqxUWOdnr+AlxaQTLSdsxtGouYrAGR5PkFDNhvqfRg4YuHDhpuAW/npBJPnm9Q1HyrjxTwqdkJZ/9udQrj/Q3aHsErk018UUqPYEDk2Capruk40CErvZCR1ab5OcZAjfzRRbHaRsHFN0gZ/aw7EVzHc/u56PrBHy4z6HbxaSputNSPHVv81Lqi9TMMABajR8NI0e0fYtLjYL6/ilD4tWegJOVgj+QHeYbRFcyU5H57Mmx9ebwaBybszdicIO BUAXVeJP /2foSB+lVk1OKeRziIw/VWtN2JdYQHufUOUeK/FBwg8A1DFL/6B1SwghdFt5YEHY4lMcenGMx7UG13tD/jHKwLE4opYKQd3vM2jXGeeWFuUMWDv/xgU6Ab7Vqw3e2H7NMMncZLhVmXkAUnfkZBJ6DI3oLJ2fXlE+tQLWSvEhkmIBTIX1wXj2D7W/We72TlOOhy9vD3vL/wehJmnreO0iHirxgyYGtadgBbKU/Z5cYDA91L0WpEI9+Xl5pTSfNUt5LZc0nisb/yEYDaY0qunukMtQoZ2bzH8KvTgcqDzfh1A5sneiL2xMiwr7oxo7NgVERzyP49jtSubiro+J2f8ALLD/PIQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: migratetype is no longer overwritten during pageblock isolation, start_isolate_page_range(), has_unmovable_pages(), and set_migratetype_isolate() no longer need which migratetype to restore during isolation failure. For has_unmoable_pages(), it needs to know if the isolation is for CMA allocation, so adding CMA_ALLOCATION to isolation flags to provide the information. Signed-off-by: Zi Yan --- include/linux/page-isolation.h | 3 ++- mm/memory_hotplug.c | 1 - mm/page_alloc.c | 4 +++- mm/page_isolation.c | 27 +++++++++++---------------- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/include/linux/page-isolation.h b/include/linux/page-isolation.h index c2a1bd621561..e94117101b6c 100644 --- a/include/linux/page-isolation.h +++ b/include/linux/page-isolation.h @@ -32,13 +32,14 @@ static inline bool is_migrate_isolate(int migratetype) #define MEMORY_OFFLINE 0x1 #define REPORT_FAILURE 0x2 +#define CMA_ALLOCATION 0x4 void set_pageblock_migratetype(struct page *page, int migratetype); bool move_freepages_block_isolate(struct zone *zone, struct page *page); int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, - int migratetype, int flags, gfp_t gfp_flags); + int flags, gfp_t gfp_flags); void undo_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 4265272faf4c..fe0b71e0f307 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1993,7 +1993,6 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages, /* set above range as isolated */ ret = start_isolate_page_range(start_pfn, end_pfn, - MIGRATE_MOVABLE, MEMORY_OFFLINE | REPORT_FAILURE, GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL); if (ret) { diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 4d06932ba69a..c60bb95d7e65 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -6607,7 +6607,9 @@ int alloc_contig_range_noprof(unsigned long start, unsigned long end, * put back to page allocator so that buddy can use them. */ - ret = start_isolate_page_range(start, end, migratetype, 0, gfp_mask); + ret = start_isolate_page_range(start, end, + migratetype == MIGRATE_CMA ? CMA_ALLOCATION : 0, + gfp_mask); if (ret) goto done; diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 4c65157d78ef..07c58b82db76 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -31,7 +31,7 @@ * */ static struct page *has_unmovable_pages(unsigned long start_pfn, unsigned long end_pfn, - int migratetype, int flags) + int flags) { struct page *page = pfn_to_page(start_pfn); struct zone *zone = page_zone(page); @@ -46,7 +46,7 @@ static struct page *has_unmovable_pages(unsigned long start_pfn, unsigned long e * isolate CMA pageblocks even when they are not movable in fact * so consider them movable here. */ - if (is_migrate_cma(migratetype)) + if (flags & CMA_ALLOCATION) return NULL; return page; @@ -144,7 +144,7 @@ static struct page *has_unmovable_pages(unsigned long start_pfn, unsigned long e * present in [start_pfn, end_pfn). The pageblock must intersect with * [start_pfn, end_pfn). */ -static int set_migratetype_isolate(struct page *page, int migratetype, int isol_flags, +static int set_migratetype_isolate(struct page *page, int isol_flags, unsigned long start_pfn, unsigned long end_pfn) { struct zone *zone = page_zone(page); @@ -179,7 +179,7 @@ static int set_migratetype_isolate(struct page *page, int migratetype, int isol_ end_pfn); unmovable = has_unmovable_pages(check_unmovable_start, check_unmovable_end, - migratetype, isol_flags); + isol_flags); if (!unmovable) { if (!move_freepages_block_isolate(zone, page)) { spin_unlock_irqrestore(&zone->lock, flags); @@ -290,7 +290,6 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages) * @isolate_before: isolate the pageblock before the boundary_pfn * @skip_isolation: the flag to skip the pageblock isolation in second * isolate_single_pageblock() - * @migratetype: migrate type to set in error recovery. * * Free and in-use pages can be as big as MAX_PAGE_ORDER and contain more than one * pageblock. When not all pageblocks within a page are isolated at the same @@ -306,8 +305,7 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages) * the in-use page then splitting the free page. */ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, - gfp_t gfp_flags, bool isolate_before, bool skip_isolation, - int migratetype) + gfp_t gfp_flags, bool isolate_before, bool skip_isolation) { unsigned long start_pfn; unsigned long isolate_pageblock; @@ -333,11 +331,9 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, zone->zone_start_pfn); if (skip_isolation) { - int mt __maybe_unused = get_pageblock_migratetype(pfn_to_page(isolate_pageblock)); - - VM_BUG_ON(!is_migrate_isolate(mt)); + VM_BUG_ON(!get_pageblock_isolate(pfn_to_page(isolate_pageblock))); } else { - ret = set_migratetype_isolate(pfn_to_page(isolate_pageblock), migratetype, + ret = set_migratetype_isolate(pfn_to_page(isolate_pageblock), flags, isolate_pageblock, isolate_pageblock + pageblock_nr_pages); if (ret) @@ -436,7 +432,6 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, * start_isolate_page_range() - mark page range MIGRATE_ISOLATE * @start_pfn: The first PFN of the range to be isolated. * @end_pfn: The last PFN of the range to be isolated. - * @migratetype: Migrate type to set in error recovery. * @flags: The following flags are allowed (they can be combined in * a bit mask) * MEMORY_OFFLINE - isolate to offline (!allocate) memory @@ -478,7 +473,7 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, * Return: 0 on success and -EBUSY if any part of range cannot be isolated. */ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, - int migratetype, int flags, gfp_t gfp_flags) + int flags, gfp_t gfp_flags) { unsigned long pfn; struct page *page; @@ -490,7 +485,7 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, /* isolate [isolate_start, isolate_start + pageblock_nr_pages) pageblock */ ret = isolate_single_pageblock(isolate_start, flags, gfp_flags, false, - skip_isolation, migratetype); + skip_isolation); if (ret) return ret; @@ -499,7 +494,7 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, /* isolate [isolate_end - pageblock_nr_pages, isolate_end) pageblock */ ret = isolate_single_pageblock(isolate_end, flags, gfp_flags, true, - skip_isolation, migratetype); + skip_isolation); if (ret) { unset_migratetype_isolate(pfn_to_page(isolate_start)); return ret; @@ -510,7 +505,7 @@ int start_isolate_page_range(unsigned long start_pfn, unsigned long end_pfn, pfn < isolate_end - pageblock_nr_pages; pfn += pageblock_nr_pages) { page = __first_valid_page(pfn, pageblock_nr_pages); - if (page && set_migratetype_isolate(page, migratetype, flags, + if (page && set_migratetype_isolate(page, flags, start_pfn, end_pfn)) { undo_isolate_page_range(isolate_start, pfn); unset_migratetype_isolate(