Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1206689 > unrolled thread
| Started by | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| First post | 2015-08-13 12:30 +0200 |
| Last post | 2015-08-16 13:50 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [Xen-devel] [PATCHv3 01/10] mm: memory hotplug with an existing resource David Vrabel <david.vrabel@citrix.com> - 2015-08-13 12:30 +0200
Re: [Xen-devel] [PATCHv3 01/10] mm: memory hotplug with an existing resource Andrew Morton <akpm@linux-foundation.org> - 2015-08-13 22:50 +0200
Re: [Xen-devel] [PATCHv3 01/10] mm: memory hotplug with an existing resource Tang Chen <tangchen@cn.fujitsu.com> - 2015-08-16 13:50 +0200
| From | David Vrabel <david.vrabel@citrix.com> |
|---|---|
| Date | 2015-08-13 12:30 +0200 |
| Subject | Re: [Xen-devel] [PATCHv3 01/10] mm: memory hotplug with an existing resource |
| Message-ID | <pWXVN-uO-37@gated-at.bofh.it> |
On 30/07/15 18:03, David Vrabel wrote:
> Add add_memory_resource() to add memory using an existing "System RAM"
> resource. This is useful if the memory region is being located by
> finding a free resource slot with allocate_resource().
>
> Xen guests will make use of this in their balloon driver to hotplug
> arbitrary amounts of memory in response to toolstack requests.
Ping? This enables a useful feature for Xen guests.
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
> include/linux/memory_hotplug.h | 2 ++
> mm/memory_hotplug.c | 28 +++++++++++++++++++++-------
> 2 files changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index 6ffa0ac..c76d371 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -11,6 +11,7 @@ struct zone;
> struct pglist_data;
> struct mem_section;
> struct memory_block;
> +struct resource;
>
> #ifdef CONFIG_MEMORY_HOTPLUG
>
> @@ -266,6 +267,7 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}
> extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
> void *arg, int (*func)(struct memory_block *, void *));
> extern int add_memory(int nid, u64 start, u64 size);
> +extern int add_memory_resource(int nid, struct resource *resource);
> extern int zone_for_memory(int nid, u64 start, u64 size, int zone_default);
> extern int arch_add_memory(int nid, u64 start, u64 size);
> extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 003dbe4..169770a 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1224,23 +1224,21 @@ int zone_for_memory(int nid, u64 start, u64 size, int zone_default)
> }
>
> /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
> -int __ref add_memory(int nid, u64 start, u64 size)
> +int __ref add_memory_resource(int nid, struct resource *res)
> {
> + u64 start, size;
> pg_data_t *pgdat = NULL;
> bool new_pgdat;
> bool new_node;
> - struct resource *res;
> int ret;
>
> + start = res->start;
> + size = resource_size(res);
> +
> ret = check_hotplug_memory_range(start, size);
> if (ret)
> return ret;
>
> - res = register_memory_resource(start, size);
> - ret = -EEXIST;
> - if (!res)
> - return ret;
> -
> { /* Stupid hack to suppress address-never-null warning */
> void *p = NODE_DATA(nid);
> new_pgdat = !p;
> @@ -1290,6 +1288,22 @@ out:
> mem_hotplug_done();
> return ret;
> }
> +EXPORT_SYMBOL_GPL(add_memory_resource);
> +
> +int __ref add_memory(int nid, u64 start, u64 size)
> +{
> + struct resource *res;
> + int ret;
> +
> + res = register_memory_resource(start, size);
> + if (!res)
> + return -EEXIST;
> +
> + ret = add_memory_resource(nid, res);
> + if (ret < 0)
> + release_memory_resource(res);
> + return ret;
> +}
> EXPORT_SYMBOL_GPL(add_memory);
>
> #ifdef CONFIG_MEMORY_HOTREMOVE
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2015-08-13 22:50 +0200 |
| Message-ID | <pX7BL-62s-5@gated-at.bofh.it> |
| In reply to | #1206689 |
On Thu, 13 Aug 2015 11:21:43 +0100 David Vrabel <david.vrabel@citrix.com> wrote:
> On 30/07/15 18:03, David Vrabel wrote:
> > Add add_memory_resource() to add memory using an existing "System RAM"
> > resource. This is useful if the memory region is being located by
> > finding a free resource slot with allocate_resource().
> >
> > Xen guests will make use of this in their balloon driver to hotplug
> > arbitrary amounts of memory in response to toolstack requests.
>
> Ping? This enables a useful feature for Xen guests.
>
Looks OK to me. I've cc'ed some memory_hotplug.c developers. If
they're OK with it, please add the patch to the (Xen?) tree which uses
it.
Add add_memory_resource() to add memory using an existing "System RAM"
resource. This is useful if the memory region is being located by
finding a free resource slot with allocate_resource().
Xen guests will make use of this in their balloon driver to hotplug
arbitrary amounts of memory in response to toolstack requests.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/memory_hotplug.h | 2 ++
mm/memory_hotplug.c | 28 +++++++++++++++++++++-------
2 files changed, 23 insertions(+), 7 deletions(-)
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 6ffa0ac..c76d371 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -11,6 +11,7 @@ struct zone;
struct pglist_data;
struct mem_section;
struct memory_block;
+struct resource;
#ifdef CONFIG_MEMORY_HOTPLUG
@@ -266,6 +267,7 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}
extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
void *arg, int (*func)(struct memory_block *, void *));
extern int add_memory(int nid, u64 start, u64 size);
+extern int add_memory_resource(int nid, struct resource *resource);
extern int zone_for_memory(int nid, u64 start, u64 size, int zone_default);
extern int arch_add_memory(int nid, u64 start, u64 size);
extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 003dbe4..169770a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1224,23 +1224,21 @@ int zone_for_memory(int nid, u64 start, u64 size, int zone_default)
}
/* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
-int __ref add_memory(int nid, u64 start, u64 size)
+int __ref add_memory_resource(int nid, struct resource *res)
{
+ u64 start, size;
pg_data_t *pgdat = NULL;
bool new_pgdat;
bool new_node;
- struct resource *res;
int ret;
+ start = res->start;
+ size = resource_size(res);
+
ret = check_hotplug_memory_range(start, size);
if (ret)
return ret;
- res = register_memory_resource(start, size);
- ret = -EEXIST;
- if (!res)
- return ret;
-
{ /* Stupid hack to suppress address-never-null warning */
void *p = NODE_DATA(nid);
new_pgdat = !p;
@@ -1290,6 +1288,22 @@ out:
mem_hotplug_done();
return ret;
}
+EXPORT_SYMBOL_GPL(add_memory_resource);
+
+int __ref add_memory(int nid, u64 start, u64 size)
+{
+ struct resource *res;
+ int ret;
+
+ res = register_memory_resource(start, size);
+ if (!res)
+ return -EEXIST;
+
+ ret = add_memory_resource(nid, res);
+ if (ret < 0)
+ release_memory_resource(res);
+ return ret;
+}
EXPORT_SYMBOL_GPL(add_memory);
#ifdef CONFIG_MEMORY_HOTREMOVE
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Tang Chen <tangchen@cn.fujitsu.com> |
|---|---|
| Date | 2015-08-16 13:50 +0200 |
| Message-ID | <pY4BQ-7sn-19@gated-at.bofh.it> |
| In reply to | #1207154 |
On 08/14/2015 04:40 AM, Andrew Morton wrote:
> On Thu, 13 Aug 2015 11:21:43 +0100 David Vrabel <david.vrabel@citrix.com> wrote:
>
>> On 30/07/15 18:03, David Vrabel wrote:
>>> Add add_memory_resource() to add memory using an existing "System RAM"
>>> resource. This is useful if the memory region is being located by
>>> finding a free resource slot with allocate_resource().
>>>
>>> Xen guests will make use of this in their balloon driver to hotplug
>>> arbitrary amounts of memory in response to toolstack requests.
>> Ping? This enables a useful feature for Xen guests.
>>
> Looks OK to me. I've cc'ed some memory_hotplug.c developers. If
> they're OK with it, please add the patch to the (Xen?) tree which uses
> it.
>
>
>
>
> Add add_memory_resource() to add memory using an existing "System RAM"
> resource. This is useful if the memory region is being located by
> finding a free resource slot with allocate_resource().
>
> Xen guests will make use of this in their balloon driver to hotplug
> arbitrary amounts of memory in response to toolstack requests.
>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> ---
> include/linux/memory_hotplug.h | 2 ++
> mm/memory_hotplug.c | 28 +++++++++++++++++++++-------
> 2 files changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index 6ffa0ac..c76d371 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -11,6 +11,7 @@ struct zone;
> struct pglist_data;
> struct mem_section;
> struct memory_block;
> +struct resource;
>
> #ifdef CONFIG_MEMORY_HOTPLUG
>
> @@ -266,6 +267,7 @@ static inline void remove_memory(int nid, u64 start, u64 size) {}
> extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn,
> void *arg, int (*func)(struct memory_block *, void *));
> extern int add_memory(int nid, u64 start, u64 size);
> +extern int add_memory_resource(int nid, struct resource *resource);
> extern int zone_for_memory(int nid, u64 start, u64 size, int zone_default);
> extern int arch_add_memory(int nid, u64 start, u64 size);
> extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 003dbe4..169770a 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1224,23 +1224,21 @@ int zone_for_memory(int nid, u64 start, u64 size, int zone_default)
> }
>
> /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
> -int __ref add_memory(int nid, u64 start, u64 size)
> +int __ref add_memory_resource(int nid, struct resource *res)
> {
> + u64 start, size;
> pg_data_t *pgdat = NULL;
> bool new_pgdat;
> bool new_node;
> - struct resource *res;
> int ret;
>
> + start = res->start;
> + size = resource_size(res);
> +
> ret = check_hotplug_memory_range(start, size);
> if (ret)
> return ret;
>
> - res = register_memory_resource(start, size);
> - ret = -EEXIST;
> - if (!res)
> - return ret;
> -
> { /* Stupid hack to suppress address-never-null warning */
> void *p = NODE_DATA(nid);
> new_pgdat = !p;
> @@ -1290,6 +1288,22 @@ out:
> mem_hotplug_done();
> return ret;
> }
> +EXPORT_SYMBOL_GPL(add_memory_resource);
> +
> +int __ref add_memory(int nid, u64 start, u64 size)
> +{
> + struct resource *res;
> + int ret;
> +
> + res = register_memory_resource(start, size);
> + if (!res)
> + return -EEXIST;
> +
> + ret = add_memory_resource(nid, res);
> + if (ret < 0)
Not a big deal, but I think "if (ret)" is enough.
The code looks good.
Reviewed-by: Tang Chen <tangchen@cn.fujitsu.com>
Thanks.
> + release_memory_resource(res);
> + return ret;
> +}
> EXPORT_SYMBOL_GPL(add_memory);
>
> #ifdef CONFIG_MEMORY_HOTREMOVE
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web