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); } } /*