Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3088893pxb; Fri, 4 Feb 2022 00:37:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzf1gRThYHj2uhqIn9TyBU7F8nIMHp+TZE/JUhSG84+4Ax9yw4V3th15tbAvl/EVArAKtTd X-Received: by 2002:a63:5760:: with SMTP id h32mr1519271pgm.127.1643963874644; Fri, 04 Feb 2022 00:37:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1643963874; cv=pass; d=google.com; s=arc-20160816; b=KCpkGHxb6ctCgZIpPy5HXiiNvzpawYgaf/UyUpFkruPLIpqvR9+h09NW7Z9w7C9RXH nCaRv6Db9Tpw/lg8Ud8YtSnWg0GcOkIAXfiUzk3MdCNl009XLg2UGs2RydAkC167g78D wBYvm4+bJmOdeDO7yAwDJnIccF5aQFmO+Sno+havivE4S9SQLytBVDgqmK6Lb8OUU0P2 8AoFEKiNYZHKLVyt1E1zBTDHBf9kqYor9q96nqIYSbUIBZ/ox86Fq/W5gMKdXHwwa5YB TIN+zIQ0oFkM5T+I03o3Mpyfe4mISIRHC4NW6UuSlcg0hIwwTWfxkM/+7+Aiyxmfnirm Ppqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=oOFANyY7rEc+TDIcsKTdvLjfLK3nYfKRWVxY+I3ztNU=; b=UiuZampFVaAb8o+6AbHTx5215mW8u78+AxfP5+dDEHOYGRNghmEIJgXCImgeSrC3B2 szv8Jt3juFr7WkyV5E/SoJDq6llIdGjd8Az8FanX+pfFIj5DxfY3Oe9bdnyiZ0iZ793O P4vnZYC1D2x9dbP8qYHHSAjeHm+GoWBf7GxnYpi22A1/q0UfX1T1hCbA4SEnhXA+d0ts 8O1G7eNjpIlF0gZra4OAvBD2cn8bHqwrb+KDUTW9C90c/Z5Gf4JRkDx5IcvN7wWYajyj dBCmEc1e4eiGoZeEnv/k+0k6ZcmrSBighB4hIN2yc12hCdb5yXb5W6SxNicAiOQlSvrV QF2w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=e5OIL9lc; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b1si1316721plh.225.2022.02.04.00.37.43; Fri, 04 Feb 2022 00:37:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=e5OIL9lc; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237453AbiBBQZk (ORCPT + 99 others); Wed, 2 Feb 2022 11:25:40 -0500 Received: from mail-mw2nam12on2054.outbound.protection.outlook.com ([40.107.244.54]:52064 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229437AbiBBQZj (ORCPT ); Wed, 2 Feb 2022 11:25:39 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WRlilx5qEmQVjFiz4Z12Xg3Mfloey4NVLQ3x1vDxTb+ALJqmtnYjLRst7R72biBzZNjtR7K8ovCa/yDpp7rjyVsPYReltOoUeecMvdcWz3STdr40eJ+TlqRcA3HPHHXUU83JU0HzbZjzX45LxrUFazYgUdKGjRK0mZzkFKdCws8tTi3zSJIyFh150rg9EG/ON/ka2AMMIgEUzlXET6W+H0W/rWhQwqiHhku2im2jREkDmQOD9tkSXBaYBK2yS6B+ef5StPDzu9RdMzpMsdNZrV5uy+vMJvlhtWsuWjieB40AmWrpvxhtmxBL3VLkIFupi9wGM7oVlHB1Ub/9kwCKdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oOFANyY7rEc+TDIcsKTdvLjfLK3nYfKRWVxY+I3ztNU=; b=WpDSf18RGfPL/+eigJW4/mCnVaggDxq+/uq3AzJvrGXqMZ77B21qrTGf9FnSTVEHrboaoyDookVTNKPWcN9nFlqq++DAjR8LmyBIiw8JXeDFcdGFhyZHskBRv/EkhBwdsRNlx9s6SUPzWXTAMc1KIgqwko0bkk7HkKZMepo27tKaL99bGqgNeZmcJNDezF/MD17m31wsxZ51A+RtHE0CwIE24d9sof1eDFqUkmpsZa6DsRxKo7gIGXX13yNVSOt+S+ePqlOnFbhd1R+ZS/3aT8NPx0ycDFBGyAWQV3ZmNCSVENxzRPUwJQqhphmHf0DrOv0Z0l3dZ9IfvYOAJ9n+gQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=oOFANyY7rEc+TDIcsKTdvLjfLK3nYfKRWVxY+I3ztNU=; b=e5OIL9lcG0nD/XLtqAWR/JVfhInJgrwT4mHoEDeBqQmkjIOcdq4rCBGU8rLTgrn4fWZfyVwmsHh7qcPek/zIJVRU7i4odH82bMpZ50AribPQmhf9dkteCAvFs2/4ULmPfjQOmqBJZf737KpYWNpVEadV9lT0hco5pz6jcQ0s61+pOgFtc06oDKfoEiCaBCybhGWC59OqBZCe5tmyOwSUhEXrkJr6keAPAzVMODS2tjakKnMY0Yw+LzzSiBehxutIpQYll2uRWN/ZX1eNIk3pn1dNcAZnSu+8X5Fsq7fskNVnq+oclJxyUAAdVHgx6cYJ0oje6z4KM0fahzs20xCbeA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB3823.namprd12.prod.outlook.com (2603:10b6:208:168::26) by BL0PR12MB4914.namprd12.prod.outlook.com (2603:10b6:208:1c4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.11; Wed, 2 Feb 2022 16:25:37 +0000 Received: from MN2PR12MB3823.namprd12.prod.outlook.com ([fe80::a9db:9c46:183e:c213]) by MN2PR12MB3823.namprd12.prod.outlook.com ([fe80::a9db:9c46:183e:c213%3]) with mapi id 15.20.4930.022; Wed, 2 Feb 2022 16:25:37 +0000 From: Zi Yan To: David Hildenbrand Cc: Oscar Salvador , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michael Ellerman , Christoph Hellwig , Marek Szyprowski , Robin Murphy , linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux-foundation.org, iommu@lists.linux-foundation.org, Vlastimil Babka , Mel Gorman , Eric Ren Subject: Re: [PATCH v4 3/7] mm: page_isolation: check specified range for unmovable pages Date: Wed, 02 Feb 2022 11:25:35 -0500 X-Mailer: MailMate (1.14r5864) Message-ID: In-Reply-To: <21c196f8-18ca-d720-4241-00c9461854d3@redhat.com> References: <20220119190623.1029355-1-zi.yan@sent.com> <20220119190623.1029355-4-zi.yan@sent.com> <21c196f8-18ca-d720-4241-00c9461854d3@redhat.com> Content-Type: multipart/signed; boundary="=_MailMate_DDA32845-4AED-435A-8D84-6088D52B516B_="; micalg=pgp-sha512; protocol="application/pgp-signature" X-ClientProxiedBy: MN2PR15CA0041.namprd15.prod.outlook.com (2603:10b6:208:237::10) To MN2PR12MB3823.namprd12.prod.outlook.com (2603:10b6:208:168::26) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 78537ba2-54e7-4818-6a68-08d9e668a541 X-MS-TrafficTypeDiagnostic: BL0PR12MB4914:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J3QKMF8fgNEMm9Z6Sd6GCrLaxFJDsOZ5IgqUTNy0n4yRtn8Jb4B+AAF/NPHxYeu9eYzA5cC0FRqon+xrL1BYUMBCBylLNSXDs29TBGoOB+A98swr1k6hZ3r5YySc2ytd1yJpKBapMdoyvOE0iFZCU4m4GrzTo4BI3tB66ziPfEuhcgVExoAb8iEml8a/8qT3KDg2GLVXBb6k09H9W5HAazCPp/oYVog8q1X44ox+jWnqVjHjmzNZIoiMOC0ZNmNlbrKW+cFZXpkVjdy8OXiPSzCmDBhe8Vz91k1RRbeO1i9f0ZHFlyZax99MMxtk8xd2asX4RhvXq9XQ3DyS84B5wvDvA94JrgLyQ9FgQaUj9j1DNkyszNb2VRopXAGy0x6pDcv/Xmp0zvzJwimS4yIuZGONDy5io7WRAwPxhumowk5mAmbgSeZE9qONqwfXcz4H2YSpD3Wd5HrW1C5Kr+ewWuBDr5A7aYH2RCnG+liCh6JsH0dahCsbfBQSQLwTj8Uqf0cpwoqEJTki8Rw3Xz+dYrpTnOT/ggxYxDVYbDAPlNwHlHI77u6HMqcoo7ZLIV655T0ZIgi3pmfTuM/vYnxiJI8zI6IGKwJegzBDoFGEpKibTWMjh6X/buqc/dgpUt4N7AuOwbc1uiLcqsdZsOctNk29RLyB5o0Pcsl/SmKECGbk8CO0+E8N1g68fq0Ae/swHraV5QkStrSczyhhWmuNf/53PjOxkVB3BYbct2R6558= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3823.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(66946007)(508600001)(26005)(53546011)(86362001)(6486002)(8676002)(7416002)(4326008)(2906002)(2616005)(83380400001)(5660300002)(8936002)(235185007)(66476007)(36756003)(66556008)(186003)(54906003)(6916009)(38100700002)(33656002)(21480400003)(6506007)(6512007)(316002)(72826004)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?Nc/UpiSYzA9tXGcSRJ5pKL4+CLDPGG48cNOyVkVQgVUjHm+9XOvbUJCt5MEI?= =?us-ascii?Q?gJDVVKErBc6Lx3H/psIP19R8+zkU6t2yC1qbogkRb4x78CDJziTL4DCQZ7ko?= =?us-ascii?Q?nLN+ouAoMbrZjlG1gY3p0pEZ9hE/2+au07DcxUiYESH6ixhVU9/lLkQKhCSZ?= =?us-ascii?Q?pZATk/KQd8UmRSaucwJVnQhvEVYF4J9WEC6A0TkwDm/OfC4t4Rrd1ODCstzh?= =?us-ascii?Q?FgJhGYfR2el86eSlaaOk48IugbWe8u1lcS7ItRHb6+ElU/V918J/vByks8gf?= =?us-ascii?Q?hgk9yjh7En40vnlJN4LPPc9KT3NsUClgKXcsezI4HtSl1ivrKzCc4/FQHXKe?= =?us-ascii?Q?88gmufCYWyKHkfkp5ubUHWUoYCl8GW/I1XD7cwLll1CVqiAkQceH8ZIUUoLG?= =?us-ascii?Q?fSoOCk9jh0wITduPmwvc6blwYY7JY3mLndN6NBKWO77O9Z+pwEk60jVcQGSB?= =?us-ascii?Q?9hIpOeipZiKBSiM2aki6guhMPcV+w/9uXofbI7i1P1f+zJkAEzIDkJg3Jv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ivj6ClNelS1BBrH6RFPY6H06K2nXuw?= =?us-ascii?Q?HIKBD1q1Tm7l2XnSj80kVOafbtQWJRnaqZKulNBQXkzzyH7Mf0HaKqRavesw?= =?us-ascii?Q?v7HjKGMLleX4+XelRvNv2iZvQJMjI7oMnUmx7JJNvrCcgHP/ep81TGK8R++M?= =?us-ascii?Q?vWT7S19E9P36MEqCJjI=3D?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 78537ba2-54e7-4818-6a68-08d9e668a541 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3823.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2022 16:25:37.5338 (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: i8ULqr6yukvOOwJX4KOc4zUSUrldSWKPkAWc6f8tgrXMIwxbRvM0MvQmGUaVyNdQ X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB4914 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=_MailMate_DDA32845-4AED-435A-8D84-6088D52B516B_= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 2 Feb 2022, at 7:25, David Hildenbrand wrote: > On 02.02.22 13:18, Oscar Salvador wrote: >> On Wed, Jan 19, 2022 at 02:06:19PM -0500, Zi Yan wrote: >>> From: Zi Yan >>> >>> Enable set_migratetype_isolate() to check specified sub-range for >>> unmovable pages during isolation. Page isolation is done >>> at max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages) granularity, but not a= ll >>> pages within that granularity are intended to be isolated. For exampl= e, >>> alloc_contig_range(), which uses page isolation, allows ranges withou= t >>> alignment. This commit makes unmovable page check only look for >>> interesting pages, so that page isolation can succeed for any >>> non-overlapping ranges. >> >> Another thing that came to my mind. >> Prior to this patch, has_unmovable_pages() was checking on pageblock >> granularity, starting at pfn#0 of the pageblock. >> With this patch, you no longer check on pageblock granularity, which >> means you might isolate a pageblock, but some pages that sneaked in >> might actually be unmovable. >> >> E.g: >> >> Let's say you have a pageblock that spans (pfn#512,pfn#1024), >> and you pass alloc_contig_range() (pfn#514,pfn#1024). >> has_unmovable_pages() will start checking the pageblock at pfn#514, >> and so it will mis pfn#512 and pfn#513. Isn't that a problem, if those= >> pfn turn out to be actually unmovable? > > That's the whole idea for being able to allocate parts of an unmovable > pageblock that are movable. > > If the first part is unmovable but the second part is movable, nothing > should stop us from trying to allocate the second part. > > Of course, we want to remember the original migratetype of the > pageblock, to restore that after isolation -- otherwise we'll end up > converting all such pageblocks to MIGRATE_MOVABLE. The next patch does > that IIRC. Yes. A desirable optimization is to make MIGRATE_ISOLATE a standalone bit= , so isolating a pageblock will not remove its original migratetype. It is on my todo list. > > However, devil is in the detail, and I still have to review those parts= > of this series. Thanks. You can wait for my next version. I am planning to make start_isolate_page_range() accept any address range and move migratetype save and restore into it, so that the caller do not need to worry about alignment. Basically, start_isolate_page_range() will need to migrate compound pages= at the beginning and/or the end of the given range [start_pfn, end_pfn) i= f start_pfn and/or end_pfn-1 is in the middle of a compound page. If start_pfn and/or end_pfn-1 is in the middle of a free page, the free page will need to be split and put into separate migratetype lists. > > > Note that there are no current users of alloc_contig_range() that > allocate < MAX_ORDER - 1 -- except CMA, but for CMA we immediately exit= > has_unmovable_pages() either way. > > -- = > Thanks, > > David / dhildenb -- Best Regards, Yan, Zi --=_MailMate_DDA32845-4AED-435A-8D84-6088D52B516B_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEEh7yFAW3gwjwQ4C9anbJR82th+ooFAmH6sH8PHHppeUBudmlk aWEuY29tAAoJEJ2yUfNrYfqKJmYP/iXmUcS1xeOlSjoCiof9XQMxBvznUPT2Ut/h uhbd8ZZGGShbY2c+6Eko0/00RwXCfuJx0zmSpBaxHv6dHiJ3dTCg0EAbV0EIjXm4 AcWVsKx4aIeF+PT+DOih1jjku9+Iypq7knEcnmT5uCmqcgbTK4cCNV4agPKU5H9J oi2OqpmbJ8A6fe78sVZgQx94VKXfQ8EZSNkJpMqZOrdv0nsqLlTgnBq5JsEbi/t8 PMBWYHuqAla+S050tqmK0leiHjbfxxXYb9xq6nYM1f58JV+QnTz+b5wkTj7B7Muh sqTLrfRXI0CW0uh0shKfJbTDnqIYcD3Dand+iZDXfwo4kIDrihn7Yvyi+z4Kc7TY X8u6xLXDqUH3c4c+a/uRcDwt/3hnVKVntQUBX10ksuE8bXeQOFEWSV0rFDuSgHPB 1Luw6YOSPBO+WuIayG6YeQ4KaCzg0UjMbWKnrbyqpEIKxBCW7/Ugy2Rjk/97yI7w ZNo2lK22QETIeDUjRtQ5BYQ4xDAJF8Y+q4Lyh0ETQyfgsGn1WNiWc+AJvCz9yJgL UkKkjfmwdFyEa3tdQntJIE+1g3C6EA+HxqK3L1LuwysYJRinYDAWYKkNyX/kLScC dkZt/CenurWv0uMeu0bdhKFdRu7z0w8YQ+1ZhEIkxaNAQ7uLqafmGsdWaQnIrGlM 8XIMpAeK =CvVD -----END PGP SIGNATURE----- --=_MailMate_DDA32845-4AED-435A-8D84-6088D52B516B_=--