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,URIBL_BLOCKED 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 5738CC4332B for ; Thu, 19 Mar 2020 13:34:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2BDE320409 for ; Thu, 19 Mar 2020 13:34:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Yvl+m/Rt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727996AbgCSNeN (ORCPT ); Thu, 19 Mar 2020 09:34:13 -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 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.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 09C95C4332D for ; Thu, 19 Mar 2020 13:56:26 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6553620663 for ; Thu, 19 Mar 2020 13:56:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BOPIqRMI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6553620663 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 48jpNQ0PWczDr8N for ; Fri, 20 Mar 2020 00:56:22 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=216.205.24.74; helo=us-smtp-delivery-74.mimecast.com; envelope-from=david@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=BOPIqRMI; dkim-atps=neutral Received: from us-smtp-delivery-74.mimecast.com (us-smtp-delivery-74.mimecast.com [216.205.24.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 48jnQX3HfZzDrMQ for ; Fri, 20 Mar 2020 00:13:08 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584623585; 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=BOPIqRMIB0X+P+bb6rgck9mn14hZT1f17xnkV7Qc8ll/q2ycOu23KTdfXLtO8zGGG9neTy Qb43kEqtQtz9JGWcY31Mo3LKb3WZFlEV1cA6pqbl4/vnd3yGemO5SDp676E6tzC4NoP03Z WyTp7vB/AHyNnDPBQIswnqs5GFgZBd0= 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 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 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-hyperv@vger.kernel.org, Michal Hocko , Baoquan He , David Hildenbrand , Greg Kroah-Hartman , "Rafael J. Wysocki" , Wei Yang , linux-mm@kvack.org, Andrew Morton , Michal Hocko , linuxppc-dev@lists.ozlabs.org, Oscar Salvador Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" ... 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