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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
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@xxxxxxxxxx>
Signed-off-by: Changsheng Liu <liuchangcheng@xxxxxxxxxx>
Tested-by: Dongdong Fan <fandd@xxxxxxxxxx>
Cc: Wang Nan <wangnan0@xxxxxxxxxx>
Cc: Zhang Yanfei <zhangyanfei@xxxxxxxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxx>
Cc: Yinghai Lu <yinghai@xxxxxxxxxx>
Cc: Tang Chen <tangchen@xxxxxxxxxxxxxx>
Cc: Hu Tao <hutao@xxxxxxxxxxxxxx>
Cc: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@xxxxxxxxxxxxxx>
Cc: Gu Zheng <guz.fnst@xxxxxxxxxxxxxx>
Cc: Toshi Kani <toshi.kani@xxxxxx>
Cc: Xishi Qiu <qiuxishi@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 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@xxxxxxxxxx are

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

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux