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 B24ABC52D7F for ; Sat, 17 Aug 2024 06:13:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 455B28D00C8; Sat, 17 Aug 2024 02:13:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 405998D00B8; Sat, 17 Aug 2024 02:13:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F41C8D00C8; Sat, 17 Aug 2024 02:13:38 -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 119728D00B8 for ; Sat, 17 Aug 2024 02:13:38 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 889C61C25E0 for ; Sat, 17 Aug 2024 06:13:37 +0000 (UTC) X-FDA: 82460720874.24.B058FD7 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf18.hostedemail.com (Postfix) with ESMTP id 38A281C0027 for ; Sat, 17 Aug 2024 06:13:33 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723875131; 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=ZZ8TCIsdtM1Tw6XmrtqwdgSOcJjxjmcOZTKg8QanzIE=; b=01hoynv4dBE0usF5zNt0oMxaH1qui0fZ2QXLTi4MescWZ6WQK6mBO9TvOL/oPL1017cLx6 uYxqqK2hXkHnV1klVFB2O1X7yRBd7hfe4uS8m/jMfyzg2rYxXM7ggmU22P/5yxZuqcmuv0 cohJxtkIbEK0ga0jrnlRlsWQGjZzMmI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723875131; a=rsa-sha256; cv=none; b=prjIO2FTZGVJiO3lEQobIxtowNHw0o366Lthj0ovsqc2aFr7myPddzG+FPqfarERpkP8nF UCZJGrnBNinLXgK1SGmyrmtNcHFnPmzO4H5aiiQ/UxUzkQ8nKUHBI54TrcSGr/ZH8NycWK XIfJ2lCPkDVuszjNZpVIWEFzaAs84gw= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Wm7j04QPTz20llF; Sat, 17 Aug 2024 14:08:52 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id AAE941A0188; Sat, 17 Aug 2024 14:13:29 +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; Sat, 17 Aug 2024 14:13:29 +0800 Message-ID: Date: Sat, 17 Aug 2024 14:13:28 +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: David Hildenbrand , Andrew Morton , Oscar Salvador , Zi Yan CC: , Matthew Wilcox References: <20240816040625.650053-1-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf100008.china.huawei.com (7.185.36.138) X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 38A281C0027 X-Stat-Signature: p8owakzdepaqcw3spjx5otr83jctzf5i X-Rspam-User: X-HE-Tag: 1723875213-648338 X-HE-Meta: U2FsdGVkX19WZ3evHh2i9K01qagtRmp6y7+LbB9FL8cDr/f48VNm4YG1zZfd0xLDrkuGHpmkUFG7U0LKsy/gXiMUi0ocuYTN4wLzNLe6FazaxjaEScOhEWDDczUcgPR8QZuh20FEz9TXoHuzRFu4Iy6oQ4TDXHdaKK9/RiQHocn98w78Rgw6MdiVYtCb2ER+bNnIBF7jR2lxgcypIxzy+1PfgV7/cGFEkLea8lqyUgVIPvLWEC2CEyaI5O+TsRSDDtZOcckderTJOcR9W4IStg6LoZ3sdNELbVy0fyTzQcncnVRvFuGNj7XYLRuQkHNIPS0TgG2ecLwG5QV6Qhkksk3FpP5fOLjzegM1gF7CCwZ579YIi/kwnzj3cQY1gudQkWe5YCKCnbehENiD5IsMIEoCl6kDngZi3ysmOW6G6uJxnoFXmGdwdRqSNVdf1/7PG+pZGsjTmQXUFeJabHRBES+MPLoTe5fHUAtQN6o4y37P/KdRtgunysLrbPg4dN2yj9ajrBoZJsKo9VjDOxFLTSN4IScquPmjPA/LPmzzwiFcZLRnxfvqcLbQ/0rqMd+SlvzQ8yA7+rwkUM+08VArrWcaUiqM/M90kNQMWed8gay0bxEs9LX6LkSsh1f57JvjeWCVCCpC6Xow4zlQXqUyOfsnbfKHjPtLNAzoFAS6iqVHc8rr2lWEINkzdDMk6h64CkEL9CeON+7uwCD+hHajAqc2nMQLRSA6ksAku/9bsb2rXKeZq9kxURClELlazKO98MMuoXG3SxSgEKbM+DaqzFou4cnl3IDTmEJHeDa/TohgO4xXVBBIYbZn27GfHmmbhxrOsT5gSh6kV+22JhwQaB9O79Jb8uCojkGzMjmEWHLGXIv4ja1tD4ehZOW8l4oTffI19vcNzBHlP+mx9CSsUNESOc1wzcqxcPNrNVBtr7F41j6sXfgroaJhf9IP1hvzORlXK2c6tKuUE6zwH65 O6w/vMPx URb/ZRC57eowAAopP2KQz6enSSNJORVQip8yxnpxDFTvWjVqpG3vg3pZPIxgu/e9QktzMnELMDstcV0l+wVK9s1GmwOzXNBbBHqFZ8TfjuXdL/vtHU0wD7ZI93pALfpXSaqgShSmShUNFLEfCQAa3X0GcTBzBViywCEjRPXCityAYXBz3ZuZ3f8b1dxr3dkQUn0tlNkd5q5nWMlUDsRDkLVlzDrvtADfB1x9zIoLiUwKZq9iNpJsYGU/BOw== 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: 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. > > Let me explore the details in the meantime ... :) >