Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp879823ybg; Thu, 19 Mar 2020 10:20:36 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs3pa/mAbtKpd9ZxYT4ndBvQSceGrb4q6bJSq34dmgJiGmt0aNNuYcLHol2WG5N/Da+iBaK X-Received: by 2002:aca:61c1:: with SMTP id v184mr3028940oib.123.1584638436128; Thu, 19 Mar 2020 10:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584638436; cv=none; d=google.com; s=arc-20160816; b=w0pxaKasmPD9OICp1V3Zh1qBSjnGGr9ZxNYu0WqP0xK8IacGkfcctjno0X+V5IGvfZ GsgZUWXIl4y6YCi/yJmdQczZqboFnUEbMvP5f+KOvYznfyNMOa6T4zquL5BC9rYXXcHd g8LbZvPzCYJAyT16VRdCsoygWp663eUf5yih+H+UA/7jTEM9kE5Y39Tw2jMHmMqhDFnH jOxA7aQwb+vJa4jOi64Dy65uNvQLhWrgRQvSUh7WywGhEClkmJOq9WyyWxyqMNgULdOr wn97KrYRbAfm1YyrIQ+b4dOWFzLkHehOYuWATpXlDdYqnaFbYuhcDn6OpmJhNSAZe5mX Qy3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=REUrjEbM9E8U0Xs3ZYSD9f/6CBam6/RPzkS7LqotySY=; b=R+rT54PcAzT8MWATH8qs/76bgM4Ui13I2z7gEd0pbXoZSd18CFj9hpUuFTB662v1ZF k3RIwKtruS8HORK59hFu3CDsHY6OBAn571SoAakZAeRs92L5bzws4YtKmcvhudLs/90B 4W0dE7yO3buoQpTKd7RYyKfIi4sPBxbyL/4huODXh6z82fhRs9U2ktrJKI8syiE357p5 tJzZ5xF3RjLNaYbuyZ+jkLbZgSoO6jZbM7Xl8POepUadCJAfiGsAV3lcb0YA0Wf1PzW8 lowCJrzHduBZntn/0EmSknaC0MmRV5L56ALw5f70uP3zDmieMFQflsFFcHTS4GPalRpG hWqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BM0AGY3u; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n9si1372832ota.103.2020.03.19.10.20.22; Thu, 19 Mar 2020 10:20:36 -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=@gmail.com header.s=20161025 header.b=BM0AGY3u; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727816AbgCSRTs (ORCPT + 99 others); Thu, 19 Mar 2020 13:19:48 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:46272 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbgCSRTs (ORCPT ); Thu, 19 Mar 2020 13:19:48 -0400 Received: by mail-wr1-f66.google.com with SMTP id j17so682429wru.13; Thu, 19 Mar 2020 10:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=REUrjEbM9E8U0Xs3ZYSD9f/6CBam6/RPzkS7LqotySY=; b=BM0AGY3urbibzhW1gohveGfBaMwlf1jLS7cxM3Vfon/hOn4zTW073R3eyT9eOcUhKY 1EUT6cd63hcggxA627cjejHKeGXbdUjQtC8xqJv6f4jLr2haccGtNev9syzT4f5LWANF tA0pUu2GRDS7/jWWJEwWZzOcmSuyMlIthrCT2arIGb4KWhX+IGBdcxSubifbUCr27E8b DAU2G3/VxwINBRs8n3NDbrwxG2TToq0uyZQ5TznKJd1cnXz/pKfBgoM3v4zdDj5wLW3+ vHg+hTD8s1ZY94S23UEy4yWxht3QcGogmEwIVrO9DqCmf3jVslGl/YH6YwOQlrceSbiJ sVAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=REUrjEbM9E8U0Xs3ZYSD9f/6CBam6/RPzkS7LqotySY=; b=WGnAIOBNoAkRtZnPz7YkQqv8oU24m3IBs4fixVHq72mpo+69kz0EbUiKfuCVKnR7vK tyvzK6EtUsmal/KrjC3ljb7G0Z/YE+xy2z6vq3U+zwQDhr3qnX4Q2q0/R0aCRS8tPcYA ZtwW05+LJ6TQ5Oswy8u5cSM3+yPOLCGNGSgsr6LU4o/So1oCjRdJd04/4YEQyIiPPW9e j05euwUtLZEJlE+FKbsoEcLUCzjlW1oWTYXZnpNgRiKnhUbAiGCnKtQht0wnq+7siVKf S19JdHZVuiTpVy9rUVhYpP9M0EVrONc19lM9M/cyaFeLf5xfFVgXTS/2mf2VCe49Dsco 1WvQ== X-Gm-Message-State: ANhLgQ1fhRZVDkr1bENht0UxXDHORiLgQkqp2TBHfC2KsKy6I9/wrYEp r/MBrhKed5h3RwsDCIwx659p0ZKeTKAZEsl9Xs0= X-Received: by 2002:a5d:6146:: with SMTP id y6mr5562155wrt.107.1584638384613; Thu, 19 Mar 2020 10:19:44 -0700 (PDT) MIME-Version: 1.0 References: <20200319131221.14044-1-david@redhat.com> <20200319131221.14044-8-david@redhat.com> In-Reply-To: <20200319131221.14044-8-david@redhat.com> From: Pankaj Gupta Date: Thu, 19 Mar 2020 18:19:33 +0100 Message-ID: Subject: Re: [PATCH v3 7/8] mm/memory_hotplug: convert memhp_auto_online to store an online_type To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org, Wei Yang , Michal Hocko , Greg Kroah-Hartman , Andrew Morton , Michal Hocko , Oscar Salvador , "Rafael J. Wysocki" , Baoquan He Content-Type: text/plain; charset="UTF-8" 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]); > } > > 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 = true; > + memhp_default_online_type = MMOP_ONLINE; > else if (sysfs_streq(buf, "offline")) > - memhp_auto_online = false; > + memhp_default_online_type = MMOP_OFFLINE; > else > return -EINVAL; > > diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.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 size, > struct mhp_params *params); > extern u64 max_mem_size; > > -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 = false; > > #ifndef CONFIG_MEMORY_HOTPLUG_DEFAULT_ONLINE > -bool memhp_auto_online; > +int memhp_default_online_type = MMOP_OFFLINE; > #else > -bool memhp_auto_online = true; > +int memhp_default_online_type = MMOP_ONLINE; > #endif > > static int __init setup_memhp_default_state(char *str) > { > if (!strcmp(str, "online")) > - memhp_auto_online = true; > + memhp_default_online_type = MMOP_ONLINE; > else if (!strcmp(str, "offline")) > - memhp_auto_online = false; > + memhp_default_online_type = MMOP_OFFLINE; > > return 1; > } > @@ -993,6 +993,7 @@ static int check_hotplug_memory_range(u64 start, u64 size) > > static int online_memory_block(struct memory_block *mem, void *arg) > { > + mem->online_type = memhp_default_online_type; > return device_online(&mem->dev); > } > > @@ -1065,7 +1066,7 @@ int __ref add_memory_resource(int nid, struct resource *res) > mem_hotplug_done(); > > /* online pages if requested */ > - if (memhp_auto_online) > + if (memhp_default_online_type != MMOP_OFFLINE) > walk_memory_blocks(start, size, NULL, online_memory_block); > > return ret; > -- Acked-by: Pankaj Gupta > 2.24.1 > >