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(