From patchwork Tue Dec 1 11:51:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 11942745 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.7 required=3.0 tests=BAYES_00, 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 9CAFBC64E7A for ; Tue, 1 Dec 2020 11:52:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1A35920770 for ; Tue, 1 Dec 2020 11:52:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1A35920770 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E412C8D0007; Tue, 1 Dec 2020 06:52:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF3668D0005; Tue, 1 Dec 2020 06:52:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CBA238D0008; Tue, 1 Dec 2020 06:52:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id B25078D0005 for ; Tue, 1 Dec 2020 06:52:13 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 7568E362D for ; Tue, 1 Dec 2020 11:52:13 +0000 (UTC) X-FDA: 77544550146.26.basin66_150c5f4273aa Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 535FC1804B668 for ; Tue, 1 Dec 2020 11:52:13 +0000 (UTC) X-HE-Tag: basin66_150c5f4273aa X-Filterd-Recvd-Size: 2623 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf37.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Dec 2020 11:52:12 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E5CDEAD6D; Tue, 1 Dec 2020 11:52:11 +0000 (UTC) From: Oscar Salvador To: david@redhat.com Cc: mhocko@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, vbabka@suse.cz, pasha.tatashin@soleen.com, Oscar Salvador Subject: [RFC PATCH v3 4/4] mm,memory_hotplug: Add mhp_memmap_on_memory boot option Date: Tue, 1 Dec 2020 12:51:58 +0100 Message-Id: <20201201115158.22638-5-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20201201115158.22638-1-osalvador@suse.de> References: <20201201115158.22638-1-osalvador@suse.de> 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: Self stored memmap leads to a sparse memory situation which is unsuitable for workloads that requires large contiguous memory chunks. Make this an opt-in which needs to be explicitly enabled. Signed-off-by: Oscar Salvador --- mm/memory_hotplug.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 4b4708512f82..858d6161e915 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -42,6 +42,8 @@ #include "internal.h" #include "shuffle.h" +static bool memmap_on_memory_enabled __read_mostly = false; + /* * online_page_callback contains pointer to current page onlining function. * Initially it is generic_online_page(). If it is required it could be @@ -1034,7 +1036,7 @@ bool __weak arch_support_memmap_on_memory(void) bool mhp_supports_memmap_on_memory(unsigned long size) { - if (!arch_support_memmap_on_memory() || + if (!memmap_on_memory_enabled || !arch_support_memmap_on_memory() || !IS_ENABLED(CONFIG_SPARSEMEM_VMEMMAP) || size > memory_block_size_bytes()) return false; @@ -1422,6 +1424,13 @@ static int __init cmdline_parse_movable_node(char *p) } early_param("movable_node", cmdline_parse_movable_node); +static int __init cmdline_parse_memmap_on_memory(char *p) +{ + memmap_on_memory_enabled = true; + return 0; +} +early_param("mhp_memmap_on_memory", cmdline_parse_memmap_on_memory); + /* check which state of node_states will be changed when offline memory */ static void node_states_check_changes_offline(unsigned long nr_pages, struct zone *zone, struct memory_notify *arg)