Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp660571ybg; Thu, 19 Mar 2020 06:34:40 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtJ/x2F19Qirvea297icY91YfLP6UmAzPXrh4th5S0M1qOCjrHKRXkcQKDh518jnn/uy0pG X-Received: by 2002:a9d:544:: with SMTP id 62mr456505otw.355.1584624880521; Thu, 19 Mar 2020 06:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584624880; cv=none; d=google.com; s=arc-20160816; b=UHIpeKOvVLlmWgVtAbI/sK17k6JNfM9tVomcbf0syryHz+Mo2QoFhrrThyJ4iumRB4 IacEkAiYzJan2RgmOyomuj3e2YAR2iid0RnCqA5xK4E+xMOvV8/IPFbWl+RJlNfsClHk xjDDy60Crw3XxIOBQ/xbuNPi5ZeC8eZLMQpKETk/HVrtfjTsi1dddDVCgQdEdloOipGP f9AvvnPC0OjxhwSnvLIRE2rE4jMOEhoTNmFe0PxGe5B51h16ITyiHx6aeA7HmJrUy/xa BiZeGYvcpXFGMZ1nR2sX5SLgg9ietxx2Md4cl9yq4oLIH5UJkapr4TCcPmV2Kb/lhw2S pG8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Hug7N4Cth2nyuPVB2cR8bkZ13Z+7sswcZX+QhUXG/m0=; b=DIJEHcOY+MKCFNgNC8JD3VeZknq2rftWe5Vp1FYURMOT595dp5Ml/g4ILnpl8DxbmT eUfH7nYOuLJlBFmiyxW9fNnIkbcJlziy5kucyjl8Prz6uk+aqKhu7F65KTlecZm64vrl m3CQXXgVqgZv8yL8xwx3Pnd9wVk5EsPy8qs7BsM+qUiQ2HqBrATFyKbnREElRjb9P8Qg KHpbmEwMPqP8H6we2Q/ddaVwdjmd2lo9YRYx2ZD4OjDzAtvcbbjqchXUi9lzQRqvr7OX a/AbceurmsK0/q+1P4toGcHZ81oRjBsb9id0jxyfEoTgDfXusMuzzOGITk2AnYIHnya6 sc3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Yvl+m/Rt"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a19si919370oic.227.2020.03.19.06.34.27; Thu, 19 Mar 2020 06:34:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Yvl+m/Rt"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727159AbgCSNeM (ORCPT + 99 others); Thu, 19 Mar 2020 09:34:12 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:28158 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729077AbgCSNNH (ORCPT ); Thu, 19 Mar 2020 09:13:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584623586; 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=Hug7N4Cth2nyuPVB2cR8bkZ13Z+7sswcZX+QhUXG/m0=; b=Yvl+m/Rt7rlR5fCHX3AX0RajDMBYrMQYJjVfQcFliBledpSWYPMYBX8WAfhFXJ0ZvkhA1C +fIxqqrzIaovLDXcYcuym1gr5nOwCn5cF8ZrWoZI1eIuGlWFBrFxbTMLsC9wCdekjdFJ6f /fkQX70poE/j9vQIOgv/+oiS5/4wiq4= 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-125-XvjAh0FOMKWQ3YdjQvC3bA-1; Thu, 19 Mar 2020 09:13:02 -0400 X-MC-Unique: XvjAh0FOMKWQ3YdjQvC3bA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8CF5DDBA3; Thu, 19 Mar 2020 13:13:00 +0000 (UTC) Received: from t480s.redhat.com (ovpn-114-197.ams2.redhat.com [10.36.114.197]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0EA0B60BF7; Thu, 19 Mar 2020 13:12:57 +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 , Michal Hocko , Greg Kroah-Hartman , Andrew Morton , Michal Hocko , Oscar Salvador , "Rafael J. Wysocki" , Baoquan He Subject: [PATCH v3 7/8] mm/memory_hotplug: convert memhp_auto_online to store an online_type Date: Thu, 19 Mar 2020 14:12:20 +0100 Message-Id: <20200319131221.14044-8-david@redhat.com> In-Reply-To: <20200319131221.14044-1-david@redhat.com> References: <20200319131221.14044-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ... and rename it to memhp_default_online_type. This is a preparation for more detailed default online behavior. Reviewed-by: Wei Yang Acked-by: Michal Hocko 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 76f3c617a8ab..6d6f85bb66e9 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -118,7 +118,8 @@ extern int arch_add_memory(int nid, u64 start, u64 si= ze, struct mhp_params *params); 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 e21a7d53ade5..4efcf8cb9ac5 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; } @@ -993,6 +993,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 @@ -1065,7 +1066,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