WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [SPAM] Re: [PATCH R2 1/7] mm: Add add_registered_memory() to

To: Daniel Kiper <dkiper@xxxxxxxxxxxx>
Subject: [Xen-devel] [SPAM] Re: [PATCH R2 1/7] mm: Add add_registered_memory() to memory hotplug API
From: David Rientjes <rientjes@xxxxxxxxxx>
Date: Wed, 29 Dec 2010 16:50:25 -0800 (PST)
Cc: jeremy@xxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx, ian.campbell@xxxxxxxxxx, haicheng.li@xxxxxxxxxxxxxxx, konrad.wilk@xxxxxxxxxx, dan.magenheimer@xxxxxxxxxx, v.tolstov@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>, Andi Kleen <andi.kleen@xxxxxxxxx>, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, fengguang.wu@xxxxxxxxx
Delivery-date: Tue, 11 Jan 2011 02:41:17 -0800
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1293670236; bh=3yPeAuO7pmyXj8ZD702yMDdTWDw=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=Gkhg/JZbyfFAm2enYdSEzNHtOIn0ciEVpEj3e6tvqGKO+QCqF7N+bYHsH0D4tOTxc 5ThD+CTDYIji08W4utXSg==
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:received:received:date:from:x-x-sender:to:cc :subject:in-reply-to:message-id:references:user-agent:mime-version :content-type; bh=19tBaHKSOO8os0+Iyom6YHkN5nkW5p1mT8W0AERpklA=; b=Gpp/Y0OiIseAUlB8AuuTE6IvIHJD49x85XmXnnOsvPE5ARo4xOmTrc9S8h2XYQX5Cc y0sCTdhVGhhSuSCeRCaQ==
Domainkey-signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=date:from:x-x-sender:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version:content-type; b=lkLKjo7OPtXYdKpZKTS3I7ubw3p6sGDy56oVE+nujJ6etEvAx8ln+681XrHqkxAiNd /urncwSsIj9S9eMpzbhA==
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
Importance: Low
In-reply-to: <20101229170212.GF2743@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20101229170212.GF2743@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Wed, 29 Dec 2010, Daniel Kiper wrote:

> diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
> index 864035f..2458b2f 100644
> --- a/include/linux/memory_hotplug.h
> +++ b/include/linux/memory_hotplug.h
> @@ -203,6 +203,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 dd186c1..b642f26 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -509,20 +509,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_system_sleep();
> -
> -     res = register_memory_resource(start, size);
> -     ret = -EEXIST;
> -     if (!res)
> -             goto out;
> -
>       if (!node_online(nid)) {
>               pgdat = hotadd_new_pgdat(nid, start);
>               ret = -ENOMEM;

Looks like this patch was based on a kernel before 2.6.37-rc4 since it 
doesn't have 20d6c96b5f (mem-hotplug: introduce {un}lock_memory_hotplug()) 

> @@ -556,14 +548,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_system_sleep();
> +     ret = __add_memory(nid, start, size);
> +     unlock_system_sleep();
> +
> +     return ret;
> +}
> +EXPORT_SYMBOL_GPL(add_registered_memory);
> +
> +int add_memory(int nid, u64 start, u64 size)
> +{
> +     int ret = -EEXIST;
> +     struct resource *res;
> +
> +     lock_system_sleep();
> +
> +     res = register_memory_resource(start, size);
> +
> +     if (!res)
> +             goto out;
> +
> +     ret = __add_memory(nid, start, size);
> +
> +     if (!ret)
> +             goto out;
> +
> +     release_memory_resource(res);
>  
>  out:
>       unlock_system_sleep();
> +
>       return ret;
>  }
>  EXPORT_SYMBOL_GPL(add_memory);

Lots of unnecessary empty lines here, and scripts/checkpatch.pl says there 
are trailing whitespaces as well.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>