Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp662156ybg; Thu, 19 Mar 2020 06:36:11 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvKVYlnrfQjQY0PDsEDbE8dE6eDHjjBOzXt7uC6aYKrdlzge/mh/zwdEvsbutrctQv/c3vz X-Received: by 2002:a05:6830:11cc:: with SMTP id v12mr2384818otq.131.1584624971460; Thu, 19 Mar 2020 06:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584624971; cv=none; d=google.com; s=arc-20160816; b=gpnwuO0Q5tyKukzhdYLTRIN1XD/JsdVOFGLW7lDBqI0EIs0xXF3/Xqvh1TlWbwT7lc Jfx7d9s9/kaYfazW5jDb5DcrX29u6oOeMToMoN0PnYqY14sS2tI33I9Fr6lwJyxlw3WV LllOgxdv4cBTEzrrKNR1orF9XpnC614JVMCF1wKse74wmiVa/HZhjJnq69Z81wQJ7zgD zFBtVZK6FuXSn8oTMf+RL4HMQlSpyASPjw8RefO7XH50qsZbghYWpCOXCFV6zKBwijn4 Qp5DBt8jjm/MXiFj4yt358iF3DyXDJ+1jS2xFdQK2mUvQdl6fzOuoswghvknS1/yLetM CeEg== 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=rx1LvEZgAQgfY3xwuj9jjkM3L7Bytnt/zhNrUnrYFaE=; b=vXou8vtjyZlt9npeOCu2HPQ5/ALM3pKJMDlBsnfTnA6Tu5jyAEZuaI4fPVrfVDs3wA cf24IXcdqy+hvOHNVagGtBcAjA0zPUpBRH6VScMj93LoMR0sg3lmxylvtyOaB5Wu+ujO AKdbWfDWJlI2AyXWn8gVbiZZDLu7W3vC0HcvR10TmIOSqwnj4knar0L+r3Tx06DmY8Ri E/d7n6hgbvQ4/oMlMumhkS0yqREZ+tjFsvXLTTprVyqOX+Qp1yC00mNSfdCvf8EgyiM2 KnyJZKGdMCnAXMgO1n16SWDrOGr33Mz7kTusI9KnMVJJfGqWJl0+e4JH51RT3FuBOW94 gkEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XyOcn8LT; 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 97si1155475oth.209.2020.03.19.06.35.59; Thu, 19 Mar 2020 06:36:11 -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=XyOcn8LT; 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 S1728446AbgCSNep (ORCPT + 99 others); Thu, 19 Mar 2020 09:34:45 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:44462 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728964AbgCSNMk (ORCPT ); Thu, 19 Mar 2020 09:12:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584623559; 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=rx1LvEZgAQgfY3xwuj9jjkM3L7Bytnt/zhNrUnrYFaE=; b=XyOcn8LTy5JO/M4XH1AFBWfIcFJZyj9hQeXmmpryScyPYfHUFMnDkMEpOqYCYF0Ot3JmRp wbn9VpPsaMpKr/GAmRKNTjd8eq5rMPgItB3hStEepQmsG8WvBscSzs+paepBhx/+qvubG5 6zGOWJsijAe2dfJ0hws4QmgtMveM3W8= 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-369-SKMNXm6IOPioc_5ZFsWhFQ-1; Thu, 19 Mar 2020 09:12:35 -0400 X-MC-Unique: SKMNXm6IOPioc_5ZFsWhFQ-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 36C50800D53; Thu, 19 Mar 2020 13:12:33 +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 9D50E60BF7; Thu, 19 Mar 2020 13:12:30 +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 v3 1/8] drivers/base/memory: rename MMOP_ONLINE_KEEP to MMOP_ONLINE Date: Thu, 19 Mar 2020 14:12:14 +0100 Message-Id: <20200319131221.14044-2-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 The name is misleading and it's not really clear what is "kept". Let's ju= st name it like the online_type name we expose to user space ("online"). Add some documentation to the types. 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 | 9 +++++---- include/linux/memory_hotplug.h | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 6448c9ece2cb..8c5ce42c0fc3 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -216,7 +216,7 @@ static int memory_subsys_online(struct device *dev) * attribute and need to set the online_type. */ if (mem->online_type < 0) - mem->online_type =3D MMOP_ONLINE_KEEP; + mem->online_type =3D MMOP_ONLINE; =20 ret =3D memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); =20 @@ -251,7 +251,7 @@ static ssize_t state_store(struct device *dev, struct= device_attribute *attr, else if (sysfs_streq(buf, "online_movable")) online_type =3D MMOP_ONLINE_MOVABLE; else if (sysfs_streq(buf, "online")) - online_type =3D MMOP_ONLINE_KEEP; + online_type =3D MMOP_ONLINE; else if (sysfs_streq(buf, "offline")) online_type =3D MMOP_OFFLINE; else { @@ -262,7 +262,7 @@ static ssize_t state_store(struct device *dev, struct= device_attribute *attr, switch (online_type) { case MMOP_ONLINE_KERNEL: case MMOP_ONLINE_MOVABLE: - case MMOP_ONLINE_KEEP: + case MMOP_ONLINE: /* mem->online_type is protected by device_hotplug_lock */ mem->online_type =3D online_type; ret =3D device_online(&mem->dev); @@ -342,7 +342,8 @@ static ssize_t valid_zones_show(struct device *dev, } =20 nid =3D mem->nid; - default_zone =3D zone_for_pfn_range(MMOP_ONLINE_KEEP, nid, start_pfn, n= r_pages); + default_zone =3D zone_for_pfn_range(MMOP_ONLINE, nid, start_pfn, + nr_pages); strcat(buf, default_zone->name); =20 print_allowed_zone(buf, nid, start_pfn, nr_pages, MMOP_ONLINE_KERNEL, diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplu= g.h index 3195d11876ea..3aaf00db224c 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -47,9 +47,13 @@ enum { =20 /* Types for control the zone type of onlined and offlined memory */ enum { + /* Offline the memory. */ MMOP_OFFLINE =3D -1, - MMOP_ONLINE_KEEP, + /* Online the memory. Zone depends, see default_zone_for_pfn(). */ + MMOP_ONLINE, + /* Online the memory to ZONE_NORMAL. */ MMOP_ONLINE_KERNEL, + /* Online the memory to ZONE_MOVABLE. */ MMOP_ONLINE_MOVABLE, }; =20 --=20 2.24.1