extern void __online_page_increment_counters(struct page *page);
 extern void __online_page_free(struct page *page);
 
+extern int try_online_node(int nid);
+
 #ifdef CONFIG_MEMORY_HOTREMOVE
 extern bool is_pageblock_removable_nolock(struct page *page);
 extern int arch_remove_memory(u64 start, u64 size);
 {
 }
 
+static inline int try_online_node(int nid)
+{
+       return 0;
+}
+
 static inline void lock_memory_hotplug(void) {}
 static inline void unlock_memory_hotplug(void) {}
 
 
 extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
                void *arg, int (*func)(struct memory_block *, void *));
-extern int mem_online_node(int nid);
 extern int add_memory(int nid, u64 start, u64 size);
 extern int arch_add_memory(int nid, u64 start, u64 size);
 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
 
 {
        int err = 0;
 
-#ifdef CONFIG_MEMORY_HOTPLUG
-       int nid;
-       pg_data_t       *pgdat;
-#endif
-
        if (!cpu_possible(cpu)) {
                printk(KERN_ERR "can't online cpu %d because it is not "
                        "configured as may-hotadd at boot time\n", cpu);
                return -EINVAL;
        }
 
-#ifdef CONFIG_MEMORY_HOTPLUG
-       nid = cpu_to_node(cpu);
-       if (!node_online(nid)) {
-               err = mem_online_node(nid);
-               if (err)
-                       return err;
-       }
-
-       pgdat = NODE_DATA(nid);
-       if (!pgdat) {
-               printk(KERN_ERR
-                       "Can't online cpu %d due to NULL pgdat\n", cpu);
-               return -ENOMEM;
-       }
-
-       if (pgdat->node_zonelists->_zonerefs->zone == NULL) {
-               mutex_lock(&zonelists_mutex);
-               build_all_zonelists(NULL, NULL);
-               mutex_unlock(&zonelists_mutex);
-       }
-#endif
+       err = try_online_node(cpu_to_node(cpu));
+       if (err)
+               return err;
 
        cpu_maps_update_begin();
 
 
 }
 
 
-/*
+/**
+ * try_online_node - online a node if offlined
+ *
  * called by cpu_up() to online a node without onlined memory.
  */
-int mem_online_node(int nid)
+int try_online_node(int nid)
 {
        pg_data_t       *pgdat;
        int     ret;
 
+       if (node_online(nid))
+               return 0;
+
        lock_memory_hotplug();
        pgdat = hotadd_new_pgdat(nid, 0);
        if (!pgdat) {
+               pr_err("Cannot online node %d due to NULL pgdat\n", nid);
                ret = -ENOMEM;
                goto out;
        }
        ret = register_one_node(nid);
        BUG_ON(ret);
 
+       if (pgdat->node_zonelists->_zonerefs->zone == NULL) {
+               mutex_lock(&zonelists_mutex);
+               build_all_zonelists(NULL, NULL);
+               mutex_unlock(&zonelists_mutex);
+       }
+
 out:
        unlock_memory_hotplug();
        return ret;