linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Simple memory hot-add for ia64.
@ 2006-01-06  2:50 Yasunori Goto
  2006-01-06 19:21 ` Dave Hansen
  0 siblings, 1 reply; 3+ messages in thread
From: Yasunori Goto @ 2006-01-06  2:50 UTC (permalink / raw)
  To: Luck, Tony
  Cc: Linux Hotplug Memory Support, linux-ia64, Linux Kernel ML,
	linux-mm, Bob Picco

Hello Tony-san.

Fortunately, 2.6.15 includes memory hot-add function for i386 and ppc.
So, I made a patch for ia64.
This doesn't make new pgdat. All of new memory will belong to
node 0 by this patch. But this is simplest first step and best start for
future work.

I tested on my Tiger4. Please apply.

(This patch doesn't use ZONE_EASY_RECLAIM yet, because its zone will be useful
 for just hot-remove.)

Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>

Index: new_feature_patch/arch/ia64/mm/init.c
===================================================================
--- new_feature_patch.orig/arch/ia64/mm/init.c	2006-01-05 15:43:10.000000000 +0900
+++ new_feature_patch/arch/ia64/mm/init.c	2006-01-05 20:23:00.000000000 +0900
@@ -635,3 +635,38 @@ mem_init (void)
 	ia32_mem_init();
 #endif
 }
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+void online_page(struct page *page)
+{
+	ClearPageReserved(page);
+	set_page_count(page, 1);
+	__free_page(page);
+	totalram_pages++;
+	num_physpages++;
+}
+
+int add_memory(u64 start, u64 size)
+{
+	pg_data_t *pgdat;
+	struct zone *zone;
+	unsigned long start_pfn = start >> PAGE_SHIFT;
+	unsigned long nr_pages = size >> PAGE_SHIFT;
+	int ret;
+
+	pgdat = NODE_DATA(0);
+
+	zone = pgdat->node_zones + ZONE_NORMAL;
+	ret = __add_pages(zone, start_pfn, nr_pages);
+
+	if (ret)
+		printk("%s: Problem encountered in __add_pages() as ret=%d\n", __func__,  ret);
+
+	return ret;
+}
+
+int remove_memory(u64 start, u64 size)
+{
+	return -EINVAL;
+}
+#endif

-- 
Yasunori Goto 


--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Simple memory hot-add for ia64.
  2006-01-06  2:50 [PATCH] Simple memory hot-add for ia64 Yasunori Goto
@ 2006-01-06 19:21 ` Dave Hansen
  2006-01-07  2:50   ` Yasunori Goto
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Hansen @ 2006-01-06 19:21 UTC (permalink / raw)
  To: Yasunori Goto
  Cc: Luck, Tony, Linux Hotplug Memory Support, linux-ia64,
	Linux Kernel ML, linux-mm, Bob Picco, Mike Kravetz

On Fri, 2006-01-06 at 11:50 +0900, Yasunori Goto wrote:
> Fortunately, 2.6.15 includes memory hot-add function for i386 and ppc.
> So, I made a patch for ia64.
> This doesn't make new pgdat. All of new memory will belong to
> node 0 by this patch. But this is simplest first step and best start for
> future work.

It does look quite simple.  Nice work.

> +#ifdef CONFIG_MEMORY_HOTPLUG
> +void online_page(struct page *page)
> +{
> +	ClearPageReserved(page);
> +	set_page_count(page, 1);
> +	__free_page(page);
> +	totalram_pages++;
> +	num_physpages++;
> +}

You're the first one to get one of these in for an alternate
architecture.  We'll need to keep an eye out so that one of these
doesn't pop up on each of the 64-bit arches with no highmem as we add
support.  But, this should be just fine for now. 

> +int add_memory(u64 start, u64 size)
> +{
> +	pg_data_t *pgdat;
> +	struct zone *zone;
> +	unsigned long start_pfn = start >> PAGE_SHIFT;
> +	unsigned long nr_pages = size >> PAGE_SHIFT;
> +	int ret;
> +
> +	pgdat = NODE_DATA(0);
> +
> +	zone = pgdat->node_zones + ZONE_NORMAL;
> +	ret = __add_pages(zone, start_pfn, nr_pages);
> +
> +	if (ret)
> +		printk("%s: Problem encountered in __add_pages() as ret=%d\n", __func__,  ret);

For some reason, I thought we were officially supposed to use
__FUNCTION__ for stuff like this.  However, I am usually lazy in my
debugging patches and use __func__.  I'm a bad example.

This also looks a bit past 80 columns.

-- Dave

--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Simple memory hot-add for ia64.
  2006-01-06 19:21 ` Dave Hansen
@ 2006-01-07  2:50   ` Yasunori Goto
  0 siblings, 0 replies; 3+ messages in thread
From: Yasunori Goto @ 2006-01-07  2:50 UTC (permalink / raw)
  To: Dave Hansen, Luck, Tony
  Cc: Linux Hotplug Memory Support, linux-ia64, Linux Kernel ML,
	linux-mm, Bob Picco, Mike Kravetz

> On Fri, 2006-01-06 at 11:50 +0900, Yasunori Goto wrote:
> > Fortunately, 2.6.15 includes memory hot-add function for i386 and ppc.
> > So, I made a patch for ia64.
> > This doesn't make new pgdat. All of new memory will belong to
> > node 0 by this patch. But this is simplest first step and best start for
> > future work.
> 
> It does look quite simple.  Nice work.
> 
> > +#ifdef CONFIG_MEMORY_HOTPLUG
> > +void online_page(struct page *page)
> > +{
> > +	ClearPageReserved(page);
> > +	set_page_count(page, 1);
> > +	__free_page(page);
> > +	totalram_pages++;
> > +	num_physpages++;
> > +}
> 
> You're the first one to get one of these in for an alternate
> architecture.  We'll need to keep an eye out so that one of these
> doesn't pop up on each of the 64-bit arches with no highmem as we add
> support.  But, this should be just fine for now. 
> 
> > +int add_memory(u64 start, u64 size)
> > +{
> > +	pg_data_t *pgdat;
> > +	struct zone *zone;
> > +	unsigned long start_pfn = start >> PAGE_SHIFT;
> > +	unsigned long nr_pages = size >> PAGE_SHIFT;
> > +	int ret;
> > +
> > +	pgdat = NODE_DATA(0);
> > +
> > +	zone = pgdat->node_zones + ZONE_NORMAL;
> > +	ret = __add_pages(zone, start_pfn, nr_pages);
> > +
> > +	if (ret)
> > +		printk("%s: Problem encountered in __add_pages() as ret=%d\n", __func__,  ret);
> 
> For some reason, I thought we were officially supposed to use
> __FUNCTION__ for stuff like this.  However, I am usually lazy in my
> debugging patches and use __func__.  I'm a bad example.

I didn't know it. Thanks!

> This also looks a bit past 80 columns.

Ok. This is newer one. :-)

Bye.

------------------

Fortunately, 2.6.15 includes memory hot-add function for i386 and ppc.
So, I made a patch for ia64.
This doesn't make new pgdat. All of new memory will belong to
node 0 by this patch. But this is simplest first step and best start for
future work.

I tested on my Tiger4. Please apply.

(This patch doesn't use ZONE_EASY_RECLAIM yet, because its zone will be useful
 for just hot-remove.)

Signed-off-by: Yasunori Goto <y-goto@jp.fujitsu.com>


Index: new_feature_patch/arch/ia64/mm/init.c
===================================================================
--- new_feature_patch.orig/arch/ia64/mm/init.c	2006-01-07 10:58:27.000000000 +0900
+++ new_feature_patch/arch/ia64/mm/init.c	2006-01-07 10:59:52.000000000 +0900
@@ -635,3 +635,39 @@ mem_init (void)
 	ia32_mem_init();
 #endif
 }
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+void online_page(struct page *page)
+{
+	ClearPageReserved(page);
+	set_page_count(page, 1);
+	__free_page(page);
+	totalram_pages++;
+	num_physpages++;
+}
+
+int add_memory(u64 start, u64 size)
+{
+	pg_data_t *pgdat;
+	struct zone *zone;
+	unsigned long start_pfn = start >> PAGE_SHIFT;
+	unsigned long nr_pages = size >> PAGE_SHIFT;
+	int ret;
+
+	pgdat = NODE_DATA(0);
+
+	zone = pgdat->node_zones + ZONE_NORMAL;
+	ret = __add_pages(zone, start_pfn, nr_pages);
+
+	if (ret)
+		printk("%s: Problem encountered in __add_pages() as ret=%d\n",
+		       __FUNCTION__,  ret);
+
+	return ret;
+}
+
+int remove_memory(u64 start, u64 size)
+{
+	return -EINVAL;
+}
+#endif

-- 
Yasunori Goto 


--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-01-07  2:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-06  2:50 [PATCH] Simple memory hot-add for ia64 Yasunori Goto
2006-01-06 19:21 ` Dave Hansen
2006-01-07  2:50   ` Yasunori Goto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox