All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yasunori Goto <y-goto@jp.fujitsu.com>
To: "Tolentino, Matthew E" <matthew.e.tolentino@intel.com>,
	"Brown, Len" <len.brown@intel.com>,
	"Luck, Tony" <tony.luck@intel.com>,
	naveen.b.s@intel.com, Andi Kleen <ak@suse.de>
Cc: Linux Kernel ML <linux-kernel@vger.kernel.org>,
	ACPI-ML <linux-acpi@vger.kernel.org>,
	linux-ia64@vger.kernel.org, x86-64 Discuss <discuss@x86-64.org>
Subject: [RFC:PATCH(003/003)] Memory add to onlined node.(For x86_64)
Date: Mon, 06 Feb 2006 22:37:31 +0900	[thread overview]
Message-ID: <20060206222347.060B.Y-GOTO@jp.fujitsu.com> (raw)

This is for x86_64 to add memory which belongs onlined node.
This patch is just confirmed compile completion.
If there is no objection, I would like to test this.

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

Index: linux-2.6.15/arch/x86_64/mm/init.c
===================================================================
--- linux-2.6.15.orig/arch/x86_64/mm/init.c	2006-02-06 16:47:41.000000000 +0900
+++ linux-2.6.15/arch/x86_64/mm/init.c	2006-02-06 18:31:52.000000000 +0900
@@ -26,6 +26,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/memory_hotplug.h>
+#include <linux/acpi.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
@@ -494,11 +495,20 @@
 
 int add_memory(u64 start, u64 size)
 {
-	struct pglist_data *pgdat = NODE_DATA(0);
-	struct zone *zone = pgdat->node_zones + MAX_NR_ZONES-2;
+	struct pglist_data *pgdat;
+	struct zone *zone;
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
-	int ret;
+	int ret, node;
+
+	node = acpi_paddr_to_node(start, size);
+	if (node >= 0 && node_online(node))
+		pgdat = NODE_DATA(node);
+	else
+		/* New node's memory will be added to Node 0 temporally. */
+		pgdat = NODE_DATA(0);
+
+	zone = pgdat->node_zones + MAX_NR_ZONES - 2;
 
 	ret = __add_pages(zone, start_pfn, nr_pages);
 	if (ret)

-- 
Yasunori Goto 



WARNING: multiple messages have this Message-ID (diff)
From: Yasunori Goto <y-goto@jp.fujitsu.com>
To: "Tolentino, Matthew E" <matthew.e.tolentino@intel.com>,
	"Brown, Len" <len.brown@intel.com>,
	"Luck, Tony" <tony.luck@intel.com>,
	naveen.b.s@intel.com, Andi Kleen <ak@suse.de>
Cc: Linux Kernel ML <linux-kernel@vger.kernel.org>,
	ACPI-ML <linux-acpi@vger.kernel.org>,
	linux-ia64@vger.kernel.org, x86-64 Discuss <discuss@x86-64.org>
Subject: [RFC:PATCH(003/003)] Memory add to onlined node.(For x86_64)
Date: Mon, 06 Feb 2006 13:37:31 +0000	[thread overview]
Message-ID: <20060206222347.060B.Y-GOTO@jp.fujitsu.com> (raw)

This is for x86_64 to add memory which belongs onlined node.
This patch is just confirmed compile completion.
If there is no objection, I would like to test this.

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

Index: linux-2.6.15/arch/x86_64/mm/init.c
=================================--- linux-2.6.15.orig/arch/x86_64/mm/init.c	2006-02-06 16:47:41.000000000 +0900
+++ linux-2.6.15/arch/x86_64/mm/init.c	2006-02-06 18:31:52.000000000 +0900
@@ -26,6 +26,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/memory_hotplug.h>
+#include <linux/acpi.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
@@ -494,11 +495,20 @@
 
 int add_memory(u64 start, u64 size)
 {
-	struct pglist_data *pgdat = NODE_DATA(0);
-	struct zone *zone = pgdat->node_zones + MAX_NR_ZONES-2;
+	struct pglist_data *pgdat;
+	struct zone *zone;
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
-	int ret;
+	int ret, node;
+
+	node = acpi_paddr_to_node(start, size);
+	if (node >= 0 && node_online(node))
+		pgdat = NODE_DATA(node);
+	else
+		/* New node's memory will be added to Node 0 temporally. */
+		pgdat = NODE_DATA(0);
+
+	zone = pgdat->node_zones + MAX_NR_ZONES - 2;
 
 	ret = __add_pages(zone, start_pfn, nr_pages);
 	if (ret)

-- 
Yasunori Goto 



             reply	other threads:[~2006-02-06 13:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-06 13:37 Yasunori Goto [this message]
2006-02-06 13:37 ` [RFC:PATCH(003/003)] Memory add to onlined node.(For x86_64) Yasunori Goto
  -- strict thread matches above, loose matches on Subject: below --
2006-02-09  7:06 [RFC:PATCH(003/003)] Memory add to onlined node. (ver. 2) (For x86_64) Yasunori Goto
2006-02-09  7:06 ` Yasunori Goto
2006-02-09  9:50 ` Yasunori Goto
2006-02-09 10:41   ` [discuss] " Andi Kleen
2006-02-09 10:56     ` Yasunori Goto

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=20060206222347.060B.Y-GOTO@jp.fujitsu.com \
    --to=y-goto@jp.fujitsu.com \
    --cc=ak@suse.de \
    --cc=discuss@x86-64.org \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.e.tolentino@intel.com \
    --cc=naveen.b.s@intel.com \
    --cc=tony.luck@intel.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.