Dave Hansen wrote:Sorry, I should have been clearer. add_memory_resource() is a function I added; it's effectively add_memory() with the resource-allocating part factored out: --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -171,7 +171,10 @@ #endif /* ! CONFIG_MEMORY_HOTPLUG */ +struct resource; + extern int add_memory(int nid, u64 start, u64 size); +extern int add_memory_resource(int nid, struct resource *res); extern int arch_add_memory(int nid, u64 start, u64 size); extern int remove_memory(u64 start, u64 size); extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, =================================================================== --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -278,14 +278,28 @@ int add_memory(int nid, u64 start, u64 size) { - pg_data_t *pgdat = NULL; - int new_pgdat = 0; struct resource *res; int ret; res = register_memory_resource(start, size); if (!res) return -EEXIST; + + ret = add_memory_resource(nid, res); + + if (ret) + release_memory_resource(res); + + return ret; +} + +int add_memory_resource(int nid, struct resource *res) +{ + pg_data_t *pgdat = NULL; + int new_pgdat = 0; + int ret; + u64 start = res->start; + u64 size = res->end - res->start + 1; if (!node_online(nid)) { pgdat = hotadd_new_pgdat(nid, start); @@ -320,8 +334,6 @@ /* rollback pgdat allocation and others */ if (new_pgdat) rollback_node_hotadd(nid, pgdat); - if (res) - release_memory_resource(res); return ret; } X86 Xen does it with a combination of hypervisor and userspace. Mostly it comes down to asking the hypervisor to provide a machine page to put under a guest pseudo-physical page. J --
| David Miller | Slow DOWN, please!!! |
| KAMEZAWA Hiroyuki | Re: 2.6.22-rc1-mm1 |
| Steven Rostedt | [RFC PATCH 1/3] Unified trace buffer |
| Steven Rostedt | [RFC PATCH 0/6] Convert all tasklets to workqueues |
git: | |
| Peter Klavins | Re: CRLF problems with Git on Win32 |
| J. Bruce Fields | Re: Git User's Survey 2007 unfinished summary continued |
| Linus Torvalds | Re: VCS comparison table |
| Junichi Uekawa | Re: [ANNOUNCE] GIT 1.5.4 |
| Arjan van de Ven | Re: [GIT]: Networking |
| Rémi | [PATCH 0/6] [RFC] Phonet pipes protocol (v2) |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Jozsef Kadlecsik | Re: TCP connection stalls under 2.6.24.7 |
| Richard Stallman | Real men don't attack straw men |
| Rogier Krieger | Re: bcw(4) is gone |
| Leon Dippenaar | New tcp stack attack |
| Brandon Lee | DELL PERC 5iR slow performance |
| high memory | 5 hours ago | Linux kernel |
| semaphore access speed | 8 hours ago | Applications and Utilities |
| the kernel how to power off the machine | 9 hours ago | Linux kernel |
| Easter Eggs in windows XP | 12 hours ago | Windows |
| Shared swap partition | 13 hours ago | Linux general |
| Root password | 13 hours ago | Linux general |
| Where/when DNOTIFY is used? | 15 hours ago | Linux kernel |
| How to convert Linux Kernel built-in module into a loadable module | 17 hours ago | Linux kernel |
| Linux 2.6.24 and I/O schedulers | 18 hours ago | Linux kernel |
| USB Driver -- Interrupt Polling -- A Little Help Please | 23 hours ago | Linux general |
