]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/hotplug: correctly add new zone to all other nodes' zone lists
authorJiang Liu <jiang.liu@huawei.com>
Wed, 19 Dec 2012 08:02:03 +0000 (00:02 -0800)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Wed, 19 Dec 2012 13:36:28 +0000 (05:36 -0800)
commit860268c68ee9b692bf82a6a4f139b8313ee2e1c0
tree750fc1f622e90daf08f2c03d732d850f53472525
parent8fa55d03bd7bd0d0afc7c09b2d052ec6f957b2e0
mm/hotplug: correctly add new zone to all other nodes' zone lists

Bug-db: 14798
(mainline commit 08dff7b7d629807dbb1f398c68dd9cd58dd657a1)
CVE: CVE-2012-5517

BugLink: http://bugs.launchpad.net/bugs/1079860
    When online_pages() is called to add new memory to an empty zone, it
    rebuilds all zone lists by calling build_all_zonelists().  But there's a
    bug which prevents the new zone to be added to other nodes' zone lists.

    online_pages() {
        build_all_zonelists()
        .....
        node_set_state(zone_to_nid(zone), N_HIGH_MEMORY)
    }

    Here the node of the zone is put into N_HIGH_MEMORY state after calling
    build_all_zonelists(), but build_all_zonelists() only adds zones from
    nodes in N_HIGH_MEMORY state to the fallback zone lists.
    build_all_zonelists()

        ->__build_all_zonelists()
        ->build_zonelists()
            ->find_next_best_node()
                ->for_each_node_state(n, N_HIGH_MEMORY)

    So memory in the new zone will never be used by other nodes, and it may
    cause strange behavor when system is under memory pressure.  So put node
    into N_HIGH_MEMORY state before calling build_all_zonelists().

Signed-off-by: Jianguo Wu <wujianguo@huawei.com>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Keping Chen <chenkeping@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    (back ported from commit 08dff7b7d629807dbb1f398c68dd9cd58dd657a1)
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Orabug: 16020976
Signed-off-by: Chuck Anderson <chuck.anderson@oracle.com>
Reviewed-by: Guangyu Sun <guangyu.sun@oracle.com>
mm/memory_hotplug.c