From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Daniel Kiper <dkiper@net-space.pl>
Cc: ian.campbell@citrix.com, akpm@linux-foundation.org,
andi.kleen@intel.com, haicheng.li@linux.intel.com,
fengguang.wu@intel.com, jeremy@goop.org,
dan.magenheimer@oracle.com, v.tolstov@selfip.ru, pasik@iki.fi,
dave@linux.vnet.ibm.com, wdauchy@gmail.com, rientjes@google.com,
xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH R3 1/7] mm: Add add_registered_memory() to memory hotplug API
Date: Tue, 8 Feb 2011 18:25:38 -0500 [thread overview]
Message-ID: <20110208232538.GB9857@dumpdata.com> (raw)
In-Reply-To: <20110203162514.GD1364@router-fw-old.local.net-space.pl>
On Thu, Feb 03, 2011 at 05:25:14PM +0100, Daniel Kiper wrote:
> add_registered_memory() adds memory ealier registered
> as memory resource. It is required by memory hotplug
> for Xen guests, however it could be used also by other
> modules.
>
> Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
> ---
> include/linux/memory_hotplug.h | 1 +
> mm/memory_hotplug.c | 50 ++++++++++++++++++++++++++++++---------
> 2 files changed, 39 insertions(+), 12 deletions(-)
>
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index 8122018..fe63912 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -223,6 +223,7 @@ static inline int is_mem_section_removable(unsigned long pfn,
> #endif /* CONFIG_MEMORY_HOTREMOVE */
>
> extern int mem_online_node(int nid);
> +extern int add_registered_memory(int nid, u64 start, u64 size);
> extern int add_memory(int nid, u64 start, u64 size);
> extern int arch_add_memory(int nid, u64 start, u64 size);
> extern int remove_memory(u64 start, u64 size);
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 321fc74..7947bdf 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -532,20 +532,12 @@ out:
> }
>
> /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
> -int __ref add_memory(int nid, u64 start, u64 size)
> +static int __ref __add_memory(int nid, u64 start, u64 size)
> {
> pg_data_t *pgdat = NULL;
> int new_pgdat = 0;
> - struct resource *res;
> int ret;
>
> - lock_memory_hotplug();
> -
> - res = register_memory_resource(start, size);
> - ret = -EEXIST;
> - if (!res)
> - goto out;
> -
> if (!node_online(nid)) {
> pgdat = hotadd_new_pgdat(nid, start);
> ret = -ENOMEM;
> @@ -579,14 +571,48 @@ int __ref add_memory(int nid, u64 start, u64 size)
> goto out;
>
> error:
> - /* rollback pgdat allocation and others */
> + /* rollback pgdat allocation */
> if (new_pgdat)
> rollback_node_hotadd(nid, pgdat);
> - if (res)
> - release_memory_resource(res);
> +
> +out:
> + return ret;
> +}
> +
> +int add_registered_memory(int nid, u64 start, u64 size)
> +{
> + int ret;
> +
> + lock_memory_hotplug();
> + ret = __add_memory(nid, start, size);
> + unlock_memory_hotplug();
Isn't this a duplicate call to the mutex?
The __add_memory does an unlock_memory_hotplug when it finishes
and then you do another unlock_memory_hotplug here too.
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(add_registered_memory);
> +
> +int add_memory(int nid, u64 start, u64 size)
> +{
> + int ret = -EEXIST;
> + struct resource *res;
> +
> + lock_memory_hotplug();
> +
> + res = register_memory_resource(start, size);
> +
> + if (!res)
> + goto out;
> +
> + ret = __add_memory(nid, start, size);
Ditto here. When __add_memory finishes the unlock_memory_hotplug
has been called, but you end up doing it in the out: label
too?
> +
> + if (!ret)
> + goto out;
> +
> + release_memory_resource(res);
>
> out:
> unlock_memory_hotplug();
> +
> return ret;
> }
> EXPORT_SYMBOL_GPL(add_memory);
> --
> 1.5.6.5
WARNING: multiple messages have this Message-ID (diff)
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Daniel Kiper <dkiper@net-space.pl>
Cc: ian.campbell@citrix.com, akpm@linux-foundation.org,
andi.kleen@intel.com, haicheng.li@linux.intel.com,
fengguang.wu@intel.com, jeremy@goop.org,
dan.magenheimer@oracle.com, v.tolstov@selfip.ru, pasik@iki.fi,
dave@linux.vnet.ibm.com, wdauchy@gmail.com, rientjes@google.com,
xen-devel@lists.xensource.com, linux-kernel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH R3 1/7] mm: Add add_registered_memory() to memory hotplug API
Date: Tue, 8 Feb 2011 18:25:38 -0500 [thread overview]
Message-ID: <20110208232538.GB9857@dumpdata.com> (raw)
In-Reply-To: <20110203162514.GD1364@router-fw-old.local.net-space.pl>
On Thu, Feb 03, 2011 at 05:25:14PM +0100, Daniel Kiper wrote:
> add_registered_memory() adds memory ealier registered
> as memory resource. It is required by memory hotplug
> for Xen guests, however it could be used also by other
> modules.
>
> Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
> ---
> include/linux/memory_hotplug.h | 1 +
> mm/memory_hotplug.c | 50 ++++++++++++++++++++++++++++++---------
> 2 files changed, 39 insertions(+), 12 deletions(-)
>
> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index 8122018..fe63912 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -223,6 +223,7 @@ static inline int is_mem_section_removable(unsigned long pfn,
> #endif /* CONFIG_MEMORY_HOTREMOVE */
>
> extern int mem_online_node(int nid);
> +extern int add_registered_memory(int nid, u64 start, u64 size);
> extern int add_memory(int nid, u64 start, u64 size);
> extern int arch_add_memory(int nid, u64 start, u64 size);
> extern int remove_memory(u64 start, u64 size);
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 321fc74..7947bdf 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -532,20 +532,12 @@ out:
> }
>
> /* we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */
> -int __ref add_memory(int nid, u64 start, u64 size)
> +static int __ref __add_memory(int nid, u64 start, u64 size)
> {
> pg_data_t *pgdat = NULL;
> int new_pgdat = 0;
> - struct resource *res;
> int ret;
>
> - lock_memory_hotplug();
> -
> - res = register_memory_resource(start, size);
> - ret = -EEXIST;
> - if (!res)
> - goto out;
> -
> if (!node_online(nid)) {
> pgdat = hotadd_new_pgdat(nid, start);
> ret = -ENOMEM;
> @@ -579,14 +571,48 @@ int __ref add_memory(int nid, u64 start, u64 size)
> goto out;
>
> error:
> - /* rollback pgdat allocation and others */
> + /* rollback pgdat allocation */
> if (new_pgdat)
> rollback_node_hotadd(nid, pgdat);
> - if (res)
> - release_memory_resource(res);
> +
> +out:
> + return ret;
> +}
> +
> +int add_registered_memory(int nid, u64 start, u64 size)
> +{
> + int ret;
> +
> + lock_memory_hotplug();
> + ret = __add_memory(nid, start, size);
> + unlock_memory_hotplug();
Isn't this a duplicate call to the mutex?
The __add_memory does an unlock_memory_hotplug when it finishes
and then you do another unlock_memory_hotplug here too.
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(add_registered_memory);
> +
> +int add_memory(int nid, u64 start, u64 size)
> +{
> + int ret = -EEXIST;
> + struct resource *res;
> +
> + lock_memory_hotplug();
> +
> + res = register_memory_resource(start, size);
> +
> + if (!res)
> + goto out;
> +
> + ret = __add_memory(nid, start, size);
Ditto here. When __add_memory finishes the unlock_memory_hotplug
has been called, but you end up doing it in the out: label
too?
> +
> + if (!ret)
> + goto out;
> +
> + release_memory_resource(res);
>
> out:
> unlock_memory_hotplug();
> +
> return ret;
> }
> EXPORT_SYMBOL_GPL(add_memory);
> --
> 1.5.6.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-02-08 23:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-03 16:25 [PATCH R3 1/7] mm: Add add_registered_memory() to memory hotplug API Daniel Kiper
2011-02-03 16:25 ` Daniel Kiper
2011-02-08 23:25 ` Konrad Rzeszutek Wilk [this message]
2011-02-08 23:25 ` Konrad Rzeszutek Wilk
2011-02-10 10:30 ` Daniel Kiper
2011-02-10 10:30 ` Daniel Kiper
-- strict thread matches above, loose matches on Subject: below --
2011-02-03 16:25 Daniel Kiper
2011-02-03 16:25 Daniel Kiper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110208232538.GB9857@dumpdata.com \
--to=konrad.wilk@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=andi.kleen@intel.com \
--cc=dan.magenheimer@oracle.com \
--cc=dave@linux.vnet.ibm.com \
--cc=dkiper@net-space.pl \
--cc=fengguang.wu@intel.com \
--cc=haicheng.li@linux.intel.com \
--cc=ian.campbell@citrix.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasik@iki.fi \
--cc=rientjes@google.com \
--cc=v.tolstov@selfip.ru \
--cc=wdauchy@gmail.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.