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 X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96206C433ED for ; Thu, 15 Apr 2021 08:43:54 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 252AC6124B for ; Thu, 15 Apr 2021 08:43:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 252AC6124B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A29BA6B0070; Thu, 15 Apr 2021 04:43:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D9086B0071; Thu, 15 Apr 2021 04:43:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82C146B0074; Thu, 15 Apr 2021 04:43:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0154.hostedemail.com [216.40.44.154]) by kanga.kvack.org (Postfix) with ESMTP id 681776B0070 for ; Thu, 15 Apr 2021 04:43:53 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 286A7824999B for ; Thu, 15 Apr 2021 08:43:53 +0000 (UTC) X-FDA: 78033963546.11.E2DED4A Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) by imf21.hostedemail.com (Postfix) with ESMTP id 4DF10E000114 for ; Thu, 15 Apr 2021 08:43:49 +0000 (UTC) Received: by mail-pg1-f174.google.com with SMTP id q10so16429095pgj.2 for ; Thu, 15 Apr 2021 01:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x/SRS23vpbVfBLs/lG9SN0UAIXnw7CTzwH43G93PLHw=; b=f6OOfdVMog22KSTujExSY8hMPhka8V31/RlO6bivNiwdYGSLF9MaIJjOnDAilUTf4+ Kf2dZGdhKeeHHQOkOClaeWJt98bNIy7lcHrY6lFVEFAzMGy+dafwVH7lHjT6g4GOkSik iGmqdLT3QKaqZ6jCDhcO3Eg8nEdnD7mQcrvLNXbWDh4MJpTvWiDPm+kKwWOA8llvLyPc +nU4bQz37CmoDyQlAfULJcrKCsUVmcdYGToVJHfOssQLvy2fYPD0imnIsVn5GFWrniH8 xU9smLwN4vOEu4WhHs0ZfQvmxh5ZBEUCReK7w3ZKusEmdafzofFrHbNSj49UXrwIh4sS ByaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x/SRS23vpbVfBLs/lG9SN0UAIXnw7CTzwH43G93PLHw=; b=g3r3bmAaEDj6kIiYheJwR0GrOAu6s0ODIhtb4m8uQMQxKRPrZLj5soXXmhIA0e1jh4 Wcp0BZWyVqcECCu9LOitIMNvSWPYq5A9k4749Mbe/eV/oYRapcuP5MSZqlSzG4n1vGeT e3CTcooBny38prF7iQKRjHi3jyWz/zPbPuWwsvr4W1OJTtSKCYv2D6OXwHLxg6TGlbI9 69//iadhPiAvTOGWErQ811dwz3yidr/8bVIhQqkmkV2kIAJYCOjOwVv7WwpQ0O3dpQf6 hM9mB3gTJWf+eIG1SMSedqYD5utyT+qe5jI5DM1wn6qoKHawG363gRUgs8kQRPs+Gvo5 A0BQ== X-Gm-Message-State: AOAM532rC9YIKlPXEU5oAyYMOexPn8H/txEVHf/KF9tFsjBIgyOZvn82 z7dYtFP6q+lo+BD0tceM1XSQng== X-Google-Smtp-Source: ABdhPJyV31W3NPW5cka6JErz4uX4p2+48ao/MXX/4spK2UbJVujp6YAdcy5vJgNDADqmFhU8NVMZmQ== X-Received: by 2002:a65:4082:: with SMTP id t2mr2515072pgp.396.1618476230299; Thu, 15 Apr 2021 01:43:50 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.234]) by smtp.gmail.com with ESMTPSA id e13sm1392365pgt.91.2021.04.15.01.43.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Apr 2021 01:43:50 -0700 (PDT) From: Muchun Song To: corbet@lwn.net, mike.kravetz@oracle.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, paulmck@kernel.org, pawan.kumar.gupta@linux.intel.com, rdunlap@infradead.org, oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, almasrymina@google.com, rientjes@google.com, willy@infradead.org, osalvador@suse.de, mhocko@suse.com, song.bao.hua@hisilicon.com, david@redhat.com, naoya.horiguchi@nec.com, joao.m.martins@oracle.com Cc: duanxiongchun@bytedance.com, fam.zheng@bytedance.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Muchun Song Subject: [PATCH v20 8/9] mm: memory_hotplug: disable memmap_on_memory when hugetlb_free_vmemmap enabled Date: Thu, 15 Apr 2021 16:40:04 +0800 Message-Id: <20210415084005.25049-9-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210415084005.25049-1-songmuchun@bytedance.com> References: <20210415084005.25049-1-songmuchun@bytedance.com> MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 4DF10E000114 X-Stat-Signature: n77qxwzs6j4j1t1xudna8withyakyb1f Received-SPF: none (bytedance.com>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from=""; helo=mail-pg1-f174.google.com; client-ip=209.85.215.174 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618476229-720258 Content-Transfer-Encoding: quoted-printable 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: The parameter of memory_hotplug.memmap_on_memory is not compatible with hugetlb_free_vmemmap. So disable it when hugetlb_free_vmemmap is enabled. Signed-off-by: Muchun Song --- Documentation/admin-guide/kernel-parameters.txt | 4 ++++ drivers/acpi/acpi_memhotplug.c | 1 + mm/memory_hotplug.c | 18 +++++++++++++----- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentat= ion/admin-guide/kernel-parameters.txt index 9e655f5206ac..1f648b3e6120 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2893,6 +2893,10 @@ Note that even when enabled, there are a few cases where the feature is not effective. =20 + This is not compatible with hugetlb_free_vmemmap. If + both parameters are enabled, hugetlb_free_vmemmap takes + precedence over memory_hotplug.memmap_on_memory. + memtest=3D [KNL,X86,ARM,PPC,RISCV] Enable memtest Format: default : 0 diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplu= g.c index 8cc195c4c861..0d7f595ee441 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -15,6 +15,7 @@ #include #include #include +#include =20 #include "internal.h" =20 diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 68923c19bdea..c45ed6c0cd9f 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -981,6 +981,7 @@ static int online_memory_block(struct memory_block *m= em, void *arg) =20 bool mhp_supports_memmap_on_memory(unsigned long size) { + bool supported; unsigned long nr_vmemmap_pages =3D size / PAGE_SIZE; unsigned long vmemmap_size =3D nr_vmemmap_pages * sizeof(struct page); unsigned long remaining_size =3D size - vmemmap_size; @@ -1011,11 +1012,18 @@ bool mhp_supports_memmap_on_memory(unsigned long = size) * altmap as an alternative source of memory, and we do not exactly * populate a single PMD. */ - return memmap_on_memory && - IS_ENABLED(CONFIG_MHP_MEMMAP_ON_MEMORY) && - size =3D=3D memory_block_size_bytes() && - IS_ALIGNED(vmemmap_size, PMD_SIZE) && - IS_ALIGNED(remaining_size, pageblock_nr_pages << PAGE_SHIFT); + supported =3D memmap_on_memory && + IS_ENABLED(CONFIG_MHP_MEMMAP_ON_MEMORY) && + size =3D=3D memory_block_size_bytes() && + IS_ALIGNED(vmemmap_size, PMD_SIZE) && + IS_ALIGNED(remaining_size, pageblock_nr_pages << PAGE_SHIFT); + + if (supported && is_hugetlb_free_vmemmap_enabled()) { + pr_info("Cannot enable memory_hotplug.memmap_on_memory, it is not comp= atible with hugetlb_free_vmemmap\n"); + supported =3D false; + } + + return supported; } =20 /* --=20 2.11.0