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=-6.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 2F71CC18E5B for ; Tue, 17 Mar 2020 10:50:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E861420736 for ; Tue, 17 Mar 2020 10:50:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="IK34O8tj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E861420736 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9D8466B000E; Tue, 17 Mar 2020 06:50:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 987E26B0010; Tue, 17 Mar 2020 06:50:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 877C56B0032; Tue, 17 Mar 2020 06:50:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0128.hostedemail.com [216.40.44.128]) by kanga.kvack.org (Postfix) with ESMTP id 6FCD86B000E for ; Tue, 17 Mar 2020 06:50:29 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2B312181AEF0B for ; Tue, 17 Mar 2020 10:50:29 +0000 (UTC) X-FDA: 76604535378.07.cakes50_214e5cfe9964b X-HE-Tag: cakes50_214e5cfe9964b X-Filterd-Recvd-Size: 6131 Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [63.128.21.74]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Tue, 17 Mar 2020 10:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584442228; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AjaeCf81lceD8DlSGIH9NtwuZALCWZfumKtaCdn7xfk=; b=IK34O8tjYcXJ7B3PHlAHaJLJVGnfArJDKyoC7VKud0suV0NvrsOjvwLN+sJSyNI8PH2R76 +53hwngpitmpS/ZrqBb2dk1tfGePP6W1iK0/UgL5Qvc+RKyrlP39T/X1BEHSXxZIKCyCIp vMGw4L8H1T4klO6Xi8Myu7GosDytNyk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-248-z9uSurr5O7GynBXxQ6BMFQ-1; Tue, 17 Mar 2020 06:50:24 -0400 X-MC-Unique: z9uSurr5O7GynBXxQ6BMFQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ED2091902EA0; Tue, 17 Mar 2020 10:50:22 +0000 (UTC) Received: from t480s.redhat.com (ovpn-112-136.ams2.redhat.com [10.36.112.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 927D794940; Tue, 17 Mar 2020 10:50:20 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org, David Hildenbrand , Wei Yang , Greg Kroah-Hartman , Andrew Morton , Michal Hocko , Oscar Salvador , "Rafael J. Wysocki" , Baoquan He Subject: [PATCH v2 7/8] mm/memory_hotplug: convert memhp_auto_online to store an online_type Date: Tue, 17 Mar 2020 11:49:41 +0100 Message-Id: <20200317104942.11178-8-david@redhat.com> In-Reply-To: <20200317104942.11178-1-david@redhat.com> References: <20200317104942.11178-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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: ... and rename it to memhp_default_online_type. This is a preparation for more detailed default online behavior. Reviewed-by: Wei Yang Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: Michal Hocko Cc: Oscar Salvador Cc: "Rafael J. Wysocki" Cc: Baoquan He Cc: Wei Yang Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 10 ++++------ include/linux/memory_hotplug.h | 3 ++- mm/memory_hotplug.c | 11 ++++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 8a7f29c0bf97..8d3e16dab69f 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -386,10 +386,8 @@ static DEVICE_ATTR_RO(block_size_bytes); static ssize_t auto_online_blocks_show(struct device *dev, struct device_attribute *attr, char *buf) { - if (memhp_auto_online) - return sprintf(buf, "online\n"); - else - return sprintf(buf, "offline\n"); + return sprintf(buf, "%s\n", + online_type_to_str[memhp_default_online_type]); } =20 static ssize_t auto_online_blocks_store(struct device *dev, @@ -397,9 +395,9 @@ static ssize_t auto_online_blocks_store(struct device= *dev, const char *buf, size_t count) { if (sysfs_streq(buf, "online")) - memhp_auto_online =3D true; + memhp_default_online_type =3D MMOP_ONLINE; else if (sysfs_streq(buf, "offline")) - memhp_auto_online =3D false; + memhp_default_online_type =3D MMOP_OFFLINE; else return -EINVAL; =20 diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplu= g.h index c2e06ed5e0e9..c6e090b34c4b 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -117,7 +117,8 @@ extern int arch_add_memory(int nid, u64 start, u64 si= ze, struct mhp_restrictions *restrictions); extern u64 max_mem_size; =20 -extern bool memhp_auto_online; +/* Default online_type (MMOP_*) when new memory blocks are added. */ +extern int memhp_default_online_type; /* If movable_node boot option specified */ extern bool movable_node_enabled; static inline bool movable_node_is_enabled(void) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 2d2aae830b92..1975a2b99a2b 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -67,17 +67,17 @@ void put_online_mems(void) bool movable_node_enabled =3D false; =20 #ifndef CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE -bool memhp_auto_online; +int memhp_default_online_type =3D MMOP_OFFLINE; #else -bool memhp_auto_online =3D true; +int memhp_default_online_type =3D MMOP_ONLINE; #endif =20 static int __init setup_memhp_default_state(char *str) { if (!strcmp(str, "online")) - memhp_auto_online =3D true; + memhp_default_online_type =3D MMOP_ONLINE; else if (!strcmp(str, "offline")) - memhp_auto_online =3D false; + memhp_default_online_type =3D MMOP_OFFLINE; =20 return 1; } @@ -990,6 +990,7 @@ static int check_hotplug_memory_range(u64 start, u64 = size) =20 static int online_memory_block(struct memory_block *mem, void *arg) { + mem->online_type =3D memhp_default_online_type; return device_online(&mem->dev); } =20 @@ -1062,7 +1063,7 @@ int __ref add_memory_resource(int nid, struct resou= rce *res) mem_hotplug_done(); =20 /* online pages if requested */ - if (memhp_auto_online) + if (memhp_default_online_type !=3D MMOP_OFFLINE) walk_memory_blocks(start, size, NULL, online_memory_block); =20 return ret; --=20 2.24.1