userfaultfd: call handle_userfault() for userfaultfd_missing() faults
[pandora-kernel.git] / mm / memory_hotplug.c
index 6da82bc..8fd97da 100644 (file)
@@ -1248,6 +1248,14 @@ int __ref add_memory(int nid, u64 start, u64 size)
 
        mem_hotplug_begin();
 
+       /*
+        * Add new range to memblock so that when hotadd_new_pgdat() is called
+        * to allocate new pgdat, get_pfn_range_for_nid() will be able to find
+        * this new range and calculate total pages correctly.  The range will
+        * be removed at hot-remove time.
+        */
+       memblock_add_node(start, size, nid);
+
        new_node = !node_online(nid);
        if (new_node) {
                pgdat = hotadd_new_pgdat(nid, start);
@@ -1277,7 +1285,6 @@ int __ref add_memory(int nid, u64 start, u64 size)
 
        /* create new memmap entry */
        firmware_map_add_hotplug(start, start + size, "System RAM");
-       memblock_add_node(start, size, nid);
 
        goto out;
 
@@ -1286,6 +1293,7 @@ error:
        if (new_pgdat)
                rollback_node_hotadd(nid, pgdat);
        release_memory_resource(res);
+       memblock_remove(start, size);
 
 out:
        mem_hotplug_done();