From patchwork Fri Aug 16 04:06:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13765415 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 2318FC3DA4A for ; Fri, 16 Aug 2024 04:06:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5644F6B02B5; Fri, 16 Aug 2024 00:06:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 514936B02B6; Fri, 16 Aug 2024 00:06:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3DC286B02B7; Fri, 16 Aug 2024 00:06:37 -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 200B56B02B5 for ; Fri, 16 Aug 2024 00:06:37 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0D38A40CF1 for ; Fri, 16 Aug 2024 04:06:36 +0000 (UTC) X-FDA: 82456771992.01.2EB28BB Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf20.hostedemail.com (Postfix) with ESMTP id 2B4101C000C for ; Fri, 16 Aug 2024 04:06:32 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 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=1723781157; a=rsa-sha256; cv=none; b=Thj8ec1AIQU7D1I8TS4vnYZlfnuZ2miN2X4dAQswElWhCI1T/GFLzSrf/BfUO860sNg5aN 2WbP3VBLfy22xCmKU2nNS17E27fIvl482VxRwORbM3ry0HZkXLTtcDwCNnjB+T8oVnqQ3g 5VcgvnJCVGp9H4lX2iIXOww40tSNHN8= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 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=1723781157; 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: references; bh=jUiXQBeZuaAD5KLajgBHIyHsvJsjd53hkJkjOqQDXnE=; b=G+xQnKz0I6tv7DRtw+fnpLSg7zEwpQrRY9R3+IGP6xjaIfW0efHywqDrImpBTSz2uvp99h E/DO5XcvoUmBA8JK3eEBdHklvycBx99gCAwHJQH/HQA0lrfVYDd0k4DWwaBO5R3JmNuoiw ElcxtQti4xEyPb/vJ85byyZOvWncC5s= Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4WlSww62z6zQpx7; Fri, 16 Aug 2024 12:01:52 +0800 (CST) Received: from dggpemf100008.china.huawei.com (unknown [7.185.36.138]) by mail.maildlp.com (Postfix) with ESMTPS id 27F971401E9; Fri, 16 Aug 2024 12:06:29 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) 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; Fri, 16 Aug 2024 12:06:28 +0800 From: Kefeng Wang To: Andrew Morton , David Hildenbrand , Oscar Salvador , Zi Yan CC: , Matthew Wilcox , Kefeng Wang Subject: [PATCH] mm: remove migration for HugePage in isolate_single_pageblock() Date: Fri, 16 Aug 2024 12:06:25 +0800 Message-ID: <20240816040625.650053-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemf100008.china.huawei.com (7.185.36.138) X-Stat-Signature: yfszmpk8u3m9cou45tuhza3mb34nfo77 X-Rspamd-Queue-Id: 2B4101C000C X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1723781192-828432 X-HE-Meta: U2FsdGVkX19/cBD6Lmz+zMEiTHosqrHyxLOnzn4L4EVVdHAeDIGOIeJiw+4pGbLy7aIATmrF/fDI5JTHiKT25aOHAiGjI3zAdFelvO5Y2cq/G8+PLZYZYhX7wFE7tsXgx4gt2FRCLbElSPhhzM7O5ybDc8pB/krMe9OyVe6FK4d5rvJSTMAeywle1S10AWOSNzqiz4GfPdyEOJRAMc3EM+FX3tgDUEk4xkmd7lFOFmCrvr/7Cbr9fgNb0UWrcFQUcNez9mldk91lqFY5X4MzUzWGqvIuIMoOjMxzqs62eEnuic1ac3iq5WFkH1KiAK9JbjKlUkmEYKTogFOIxLpj6Z4tTkmhdhzmoiFyB3++TiaWnolM1LRXczs+jQoGyryCdX4OIVqGRL5Wp5xvKYfkozvKMMfRmy5ZPYqk/B6/fDjyF8U0RyJFP92aK/I5A4OiXxvHe6mYRW5J177sG2Hik1bdvE+oZbc8si8wZRKRONPWSaQt53jbSejPL8tIeSpgxb3iUgnb0RN8gFrInt2VY9GTtat7Kp5HAIiafaebTIlEoTHq6xezWnyapCUbFRvErYtD4ELWFe8I6sYG35E7mUmHbwb3xUO+bXRA8+wNJ2vkVAC4hzJeCvqIsxK/QVDXfXC2r0VRxPw2/X5aN8E5jGxGYUYAftRx/CJ+ALDQYBXQB2b25kbMZRctrP5zwOh37wl/EXhlK8eWwBOHAa2puraake0CrZEjPj9M960JMEvD3ETG2LWZgAQXB6XrtNCCcKhJk2vg0AHKDhZq2eCOMMl10YkxMsjntuT70X4OqTeOs5M+IjB+9FU/98J/6YDIwRtuLz9ZCIONRqhi6MmF0UHxoQQwUH0WXGOqmyFRm342jpmSCrK14LmC3twXxovKMq802YNdpw/0uwcEq/pfE+xrw3al+X7LepSj/cM/RoTlKXQ87LWsHNOV5t63z5rIwC6nLKjknWZNmQraimv NlSs7W/g Zgl/LHj97wcVYzi/q2GsM5sFanR72qcBpxTstEnVoUNn6Ez4ycCbj5lyiIl/9FGlZX9W5RK6ndme7M8g4vwlPYEIkTQKJzHiEzSfNjKeZj92wSUGT8ZKz2YAsuFM8StgViYFko0nbxCfW0zt0aW8RRXuxuFnBBHm/SnT6fxyI/HLIVqydKyDfFldhqzih0ScZW+Yj 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: 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(). Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity") Signed-off-by: Kefeng Wang Acked-by: Zi Yan --- mm/page_isolation.c | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 39fb8c07aeb7..7e04047977cf 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -403,30 +403,8 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, unsigned long head_pfn = page_to_pfn(head); unsigned long nr_pages = compound_nr(head); - if (head_pfn + nr_pages <= boundary_pfn) { - pfn = head_pfn + nr_pages; - continue; - } - -#if defined CONFIG_COMPACTION || defined CONFIG_CMA - if (PageHuge(page)) { - int page_mt = get_pageblock_migratetype(page); - struct compact_control cc = { - .nr_migratepages = 0, - .order = -1, - .zone = page_zone(pfn_to_page(head_pfn)), - .mode = MIGRATE_SYNC, - .ignore_skip_hint = true, - .no_set_skip_hint = true, - .gfp_mask = gfp_flags, - .alloc_contig = true, - }; - INIT_LIST_HEAD(&cc.migratepages); - - ret = __alloc_contig_migrate_range(&cc, head_pfn, - head_pfn + nr_pages, page_mt); - if (ret) - goto failed; + if (head_pfn + nr_pages <= boundary_pfn || + PageHuge(page)) { pfn = head_pfn + nr_pages; continue; } @@ -440,7 +418,7 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, */ VM_WARN_ON_ONCE_PAGE(PageLRU(page), page); VM_WARN_ON_ONCE_PAGE(__PageMovable(page), page); -#endif + goto failed; }