From mboxrd@z Thu Jan 1 00:00:00 1970 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 74FB8C5321E for ; Mon, 19 Aug 2024 02:42:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0630C6B0082; Sun, 18 Aug 2024 22:42:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F2CC66B0092; Sun, 18 Aug 2024 22:42:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA7296B0093; Sun, 18 Aug 2024 22:42:20 -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 B7B3A6B0082 for ; Sun, 18 Aug 2024 22:42:20 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7333C1C4AB6 for ; Mon, 19 Aug 2024 02:42:20 +0000 (UTC) X-FDA: 82467446040.16.ABB6CE5 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf25.hostedemail.com (Postfix) with ESMTP id 171A1A000C for ; Mon, 19 Aug 2024 02:42:16 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724035235; 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; bh=t0mQvD9pBmGudq/Bvk16FT2LFJO4oYeT9WY3AOysJT0=; b=bownpo9n0njHJe8no4cUGyw3fgvxZpwpRCP+uho/3H/KBE1ZTdkPDpg0I0Ay8iCRIAf66I 1FPe8g7MfV3HUJv8yaHF6UcD7DjlvORBmfX1gLF/8bleh9HLob7E9ylmAAumm1eQ6Dize+ +qLFZl06oyn68wzj5kj4NVDmgs/UUFg= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724035235; a=rsa-sha256; cv=none; b=vyaWgaWV4xSGv+W682wmulREUezs+TQM1A8WEinJCaSYVvYnpWidV0MCcIXJBv8PE+4Omh 3jkmIQu/AfmWF9Pj1rIm+mroo3NtVutVYHk4ShEIEGJGcsy0BNhxMN1vQETp4krhVX1+Mn tUtYFzKGelmwsw4OTMf8N9hkvG4cRbw= Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4WnGxz1XTfz1HGk7; Mon, 19 Aug 2024 10:39:03 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id B07101A0188; Mon, 19 Aug 2024 10:42:12 +0800 (CST) Received: from [10.174.177.243] (10.174.177.243) by dggpemf100008.china.huawei.com (7.185.36.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 19 Aug 2024 10:42:12 +0800 Message-ID: <0674d06c-4a82-499a-85b4-9928ab4ab592@huawei.com> Date: Mon, 19 Aug 2024 10:42:11 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] mm: remove migration for HugePage in isolate_single_pageblock() Content-Language: en-US To: Zi Yan CC: David Hildenbrand , Andrew Morton , Oscar Salvador , , Matthew Wilcox References: <20240816040625.650053-1-wangkefeng.wang@huawei.com> <5D57871E-0360-40F5-A3E3-B3DAD0B2F5BF@nvidia.com> From: Kefeng Wang In-Reply-To: <5D57871E-0360-40F5-A3E3-B3DAD0B2F5BF@nvidia.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemf100008.china.huawei.com (7.185.36.138) X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 171A1A000C X-Stat-Signature: 55wxc1fq5zi1mxdes6yek3nfn7ri3c9w X-Rspam-User: X-HE-Tag: 1724035336-903970 X-HE-Meta: U2FsdGVkX197gpyeIvIivoJETipIqXtF96R5q5l4TFCzuYfoMEJe86l4D8dEzlPyTrLR7qxnKgwsjF97waxerzJTx4hQV+kIDGhR3PCWvo1Rhv9tbEpTJLrPefXczQnsH/rH1nnkyPZhj+3/u+QQX1+EK+TRVWHmpXNQJrGyT1FxO1Pg1a7daFXEgLI13Zj/KPm1+GuN/TkkGYK60o4K5ZgdduSI7mQ1opS0kRkkvCgE4R/RTWs3V6LCcbPxmI6jgH8cKhHfphI1dm8/gmAurXT4yPY2KqA5souuwRw+kLbAcvbfn1RRuHDnVDjcU4p8y5elUdqyeb9RObrx0WSvXlGtc2xApKT4W/euLGdSKCGh09l5p9k6l2wClUmBjJJMeUMpuusNZcNKzypx8ix9rA9Jkhhsr908M8TlgTZvfjXxKHs/x2p2ZP0/MgkVhAfa94FQEIez2S/YqxtghDLGmWgdTdk5C5SB0jyIKTTWx0H47QZ0sycco3WEkoOw72OfHoe/ya8ZKOFgtphZ+1yRgS4EvDVxUK3fDLzP6wZ6pttEQIkgIfDmsyPZs73SiNjBJrf43+aMIrHLyL24mF+yMVXGT+4efyO87MsLOPHk04rnWqTWhDowjcFy2ehgnpB3bvWImfYx3uFmtGy5Z4hUVhVJZcBNZIvxTIvM8jbZYA5v3MmjNN0Gi47M7osTF8P6MkWqbli6+0X/neG/oWVFYs02ISFWCd5ZQPf34ffWyM7leVnI/NJEHdWTENNPTtNpZjFmtFtHpPuTzIxeLQQkDE1g4UuRrbl86hKShMhCbX86kjBtv1qhNxHAjcmBCWP0jH23sZPLvX2qG6XXrPAgtqevgCD1TxPzYn5G0KvstA4/XoqDnWXAOuoZT8lSm7ig8+V+vxgkwKd4LViv7UnDW5tlzStK4WUuF5VYqwubuApuuIX1bDT9K58fyDgfDp15qMk3LcmGuihI8jWjRJS RMYf7JAc zWECD2Mmj48uai6DZP6X9LdRSb+XXe2+VNGsiaZ424+gIWPEM4OLgxLYZBXFiauNN4Jgcn0HxiPr83N2cSLLI8V07QRo2qsuy0dBXp8kt1V4Gt2C/Q5vh5g01FD5jXFh9w5DM5+n+iWYFaNCDiUpc6qrrOFu443n3/GW4n4Gwe3/rNli+7i+xC3Ob0XLpSr1j1EbXvd9f5c/fx2u2gva4JNLGmi7O24UEciOs7w0X7cnLOVA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2024/8/18 7:58, Zi Yan wrote: > On 17 Aug 2024, at 2:13, Kefeng Wang wrote: > >> On 2024/8/17 3:45, David Hildenbrand wrote: >>> On 16.08.24 13:30, Kefeng Wang wrote: >>>> >>>> >>>> On 2024/8/16 18:11, David Hildenbrand wrote: >>>>> On 16.08.24 06:06, Kefeng Wang wrote: >>>>>> The gigantic page size may larger than memory block size, so memory >>>>>> offline always fails in this case after commit b2c9e2fbba32 ("mm: make >>>>>> alloc_contig_range work at pageblock granularity"), >>>>>> >>>>>> offline_pages >>>>>>     start_isolate_page_range >>>>>>       start_isolate_page_range(isolate_before=true) >>>>>>         isolate [isolate_start, isolate_start + pageblock_nr_pages) >>>>>>       start_isolate_page_range(isolate_before=false) >>>>>>         isolate [isolate_end - pageblock_nr_pages, isolate_end) pageblock >>>>>>              __alloc_contig_migrate_range >>>>>>             isolate_migratepages_range >>>>>>               isolate_migratepages_block >>>>>>                 isolate_or_dissolve_huge_page >>>>>>                   if (hstate_is_gigantic(h)) >>>>>>                       return -ENOMEM; >>>>>> >>>>>> In fact, we don't need to migrate page in page range isolation, for >>>>>> memory offline path, there is do_migrate_range() to move the pages. >>>>>> For contig allocation, there is another __alloc_contig_migrate_range() >>>>>> after isolation to migrate the pages. So fix issue by skipping the >>>>>> __alloc_contig_migrate_range() in isolate_single_pageblock(). >> >> ... >> >>> >>> Please distill some of that in the patch description. Right now you only talk about memory offlining and don't cover why alloc_contig_range() is fine as well with this change. >> >> Borrowing some word from Zi, >> >> >> PageHuge(gigantic) can bigger than a pageblock, the gigantic PageHuge is freed as order-0. This means MIGRATE_ISOLATE pageblocks will get to the right free list after __alloc_contig_migrate_range(), the one after >> start_isolate_page_range() for alloc_contig_range(), this is same as in >> memory offline, it has own path to isolate/migrate used page and dissolve the free hugepages, so the migration code in isolate_single_pageblock() is not needed, let's cleanup it and which also fix the above the issue. >> >> Please correct me or help to write better description, thanks. > > How about? > > Gigantic PageHuge is bigger than a pageblock, but since it is freed as order-0 pages, > its pageblocks after being freed will get to the right free list. There is no need > to have special handling code for them in start_isolate_page_range(). For both > alloc_contig_range() and memory offline cases, the migration code after > start_isolate_page_range() will be able to migrate gigantic PageHuge when possible. > Let's clean up start_isolate_page_range() and fix the aforementioned memory offline > failure issue all together. Thanks Zi, it is better, will update. > > > -- > Best Regards, > Yan, Zi