All of lore.kernel.org
 help / color / mirror / Atom feed
* + mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly.patch added to -mm tree
@ 2015-09-15 21:49 akpm
       [not found] ` <20150915145232.fb74148815fa79bfeaad88bc@linux-foundation.org>
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2015-09-15 21:49 UTC (permalink / raw)
  To: liuchangcheng, dave.hansen, fandd, guz.fnst, hutao,
	isimatu.yasuaki, laijs, qiuxishi, tangchen, toshi.kani, wangnan0,
	yanxiaofeng, yinghai, zhangyanfei, mm-commits


The patch titled
     Subject: mm: memory hot-add: memory can not be added to movable zone by default
has been added to the -mm tree.  Its filename is
     mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Changsheng Liu <liuchangcheng@inspur.com>
Subject: mm: memory hot-add: memory can not be added to movable zone by default

After the user config CONFIG_MOVABLE_NODE and movable_node kernel option,
when the memory is hot added, should_add_memory_movable() returns 0
because all zones including movable zone are empty.  So the memory that
was hot added will be added to the normal zone and the normal zone will be
created first.  But we want the whole node to be added to movable zone by
default.

So we change should_add_memory_movable(): if the user config
CONFIG_MOVABLE_NODE and movable_node kernel option it will always return 1
and all zones are empty at the same time, so that the movable zone will be
created first and then the whole node will be added to movable zone by
default.  If we want the node to be added to normal zone, we can do it as
follows: "echo online_kernel > /sys/devices/system/memory/memoryXXX/state"

Signed-off-by: Xiaofeng Yan <yanxiaofeng@inspur.com>
Signed-off-by: Changsheng Liu <liuchangcheng@inspur.com>
Tested-by: Dongdong Fan <fandd@inspur.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Hu Tao <hutao@cn.fujitsu.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: Xishi Qiu <qiuxishi@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/memory_hotplug.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff -puN mm/memory_hotplug.c~mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly mm/memory_hotplug.c
--- a/mm/memory_hotplug.c~mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly
+++ a/mm/memory_hotplug.c
@@ -1201,6 +1201,9 @@ static int check_hotplug_memory_range(u6
 /*
  * If movable zone has already been setup, newly added memory should be check.
  * If its address is higher than movable zone, it should be added as movable.
+ * And if system boots up with movable_node and config CONFIG_MOVABLE_NOD and
+ * added memory does not overlap the zone before MOVABLE_ZONE,
+ * the memory is added as movable
  * Without this check, movable zone may overlap with other zone.
  */
 static int should_add_memory_movable(int nid, u64 start, u64 size)
@@ -1208,6 +1211,11 @@ static int should_add_memory_movable(int
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	pg_data_t *pgdat = NODE_DATA(nid);
 	struct zone *movable_zone = pgdat->node_zones + ZONE_MOVABLE;
+	struct zone *pre_zone = pgdat->node_zones + (ZONE_MOVABLE - 1);
+
+	if (movable_node_is_enabled()
+	&& zone_end_pfn(pre_zone) <= start_pfn)
+		return 1;
 
 	if (zone_is_empty(movable_zone))
 		return 0;
_

Patches currently in -mm which might be from liuchangcheng@inspur.com are

mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: + mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly.patch added to -mm tree
       [not found] ` <20150915145232.fb74148815fa79bfeaad88bc@linux-foundation.org>
@ 2015-09-15 23:06   ` Dave Hansen
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Hansen @ 2015-09-15 23:06 UTC (permalink / raw)
  To: Andrew Morton, liuchangcheng, fandd, guz.fnst, hutao,
	isimatu.yasuaki, laijs, qiuxishi, tangchen, toshi.kani, wangnan0,
	yanxiaofeng, yinghai, zhangyanfei, Linux-MM

On 09/15/2015 02:52 PM, Andrew Morton wrote:
>>  /*
>>   * If movable zone has already been setup, newly added memory should be check.
>>   * If its address is higher than movable zone, it should be added as movable.
>> + * And if system boots up with movable_node and config CONFIG_MOVABLE_NOD and
>> + * added memory does not overlap the zone before MOVABLE_ZONE,
>> + * the memory is added as movable
>>   * Without this check, movable zone may overlap with other zone.
>>   */
>>  static int should_add_memory_movable(int nid, u64 start, u64 size)
>> @@ -1208,6 +1211,11 @@ static int should_add_memory_movable(int
>>  	unsigned long start_pfn = start >> PAGE_SHIFT;
>>  	pg_data_t *pgdat = NODE_DATA(nid);
>>  	struct zone *movable_zone = pgdat->node_zones + ZONE_MOVABLE;
>> +	struct zone *pre_zone = pgdat->node_zones + (ZONE_MOVABLE - 1);
>> +
>> +	if (movable_node_is_enabled()
>> +	&& zone_end_pfn(pre_zone) <= start_pfn)
>> +		return 1;

This check seems goofy to me.  According to the description, we're
looking at a node here which has all of its zones empty.  So it
definitely has zone->spanned_pages=0.  zone_end_pfn() is looking at
zone->zone_start_pfn too, which is also 0, presumably.

So why is it bothering to look at the pfns if they're potentially
"garbage"?  It seems like we really want something like this:

	if (all_node_zones_empty(pgdat)) {
		/*
		 * We usually want a ZONE_NORMAL before we add a
		 * ZONE_MOVABLE since ZONE_MOVABLE is mildly crippled.
		 * We only want ZONE_MOVABLE first when 'movable_node'
		 * mode is on.
		 */
		return movable_node_is_enabled();
	}

Either way, this is a behavior change.  It's one that is triggered by a
config option plus a boot option, but it might surprise some users.  Is
this new behavior documented?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-15 23:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 21:49 + mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly.patch added to -mm tree akpm
     [not found] ` <20150915145232.fb74148815fa79bfeaad88bc@linux-foundation.org>
2015-09-15 23:06   ` Dave Hansen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.