mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Hansen <haveblue@us.ibm.com>
To: linux-kernel@vger.kernel.org
Subject: [RFC][PATCH 11/12] memory hotplug: i386 addition functions
Date: Fri, 12 Aug 2005 07:47:32 -0700	[thread overview]
Message-ID: <20050812144732.7B306EB1@kernel.beaverton.ibm.com> (raw)
In-Reply-To: <20050812144714.805F4B48@kernel.beaverton.ibm.com>


Adds the necessary for non-NUMA hot-add of highmem
to an existing zone on i386.

Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

 memhotplug-dave/arch/i386/mm/discontig.c |    4 +-
 memhotplug-dave/arch/i386/mm/init.c      |   61 ++++++++++++++++++++++++++++---
 mm/highmem.c                             |    0 
 3 files changed, 58 insertions(+), 7 deletions(-)

diff -puN arch/i386/mm/init.c~D1-i386-hotplug-functions arch/i386/mm/init.c
--- memhotplug/arch/i386/mm/init.c~D1-i386-hotplug-functions	2005-08-12 07:43:50.000000000 -0700
+++ memhotplug-dave/arch/i386/mm/init.c	2005-08-12 07:43:50.000000000 -0700
@@ -27,6 +27,7 @@
 #include <linux/slab.h>
 #include <linux/proc_fs.h>
 #include <linux/efi.h>
+#include <linux/memory_hotplug.h>
 
 #include <asm/processor.h>
 #include <asm/system.h>
@@ -265,17 +266,45 @@ static void __init permanent_kmaps_init(
 	pkmap_page_table = pte;	
 }
 
-void __init one_highpage_init(struct page *page, int pfn, int bad_ppro)
+void __devinit free_new_highpage(struct page *page)
+{
+	set_page_count(page, 1);
+	__free_page(page);
+	totalhigh_pages++;
+}
+
+void __init add_one_highpage_init(struct page *page, int pfn, int bad_ppro)
 {
 	if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) {
 		ClearPageReserved(page);
-		set_page_count(page, 1);
-		__free_page(page);
-		totalhigh_pages++;
 	} else
 		SetPageReserved(page);
 }
 
+int add_one_highpage_hotplug(struct page *page, int pfn)
+{
+	free_new_highpage(page);
+	totalram_pages++;
+#ifdef CONFIG_FLATMEM
+	max_mapnr = max(pfn, max_mapnr);
+#endif
+	num_physpages++;
+	return 0;
+}
+
+/*
+ * Not currently handling the NUMA case.
+ * Assuming single node and all memory that
+ * has been added dynamically that would be
+ * onlined here is in HIGHMEM
+ */
+void online_page(struct page *page)
+{
+	ClearPageReserved(page);
+	add_one_highpage_hotplug(page, page_to_pfn(page));
+}
+
+
 #ifdef CONFIG_NUMA
 extern void set_highmem_pages_init(int);
 #else
@@ -283,7 +312,7 @@ static void __init set_highmem_pages_ini
 {
 	int pfn;
 	for (pfn = highstart_pfn; pfn < highend_pfn; pfn++)
-		one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro);
+		add_one_highpage_init(pfn_to_page(pfn), pfn, bad_ppro);
 	totalram_pages += totalhigh_pages;
 }
 #endif /* CONFIG_FLATMEM */
@@ -614,6 +643,28 @@ void __init mem_init(void)
 #endif
 }
 
+/*
+ * this is for the non-NUMA, single node SMP system case.
+ * Specifically, in the case of x86, we will always add
+ * memory to the highmem for now.
+ */
+#ifndef CONFIG_NEED_MULTIPLE_NODES
+int add_memory(u64 start, u64 size)
+{
+	struct pglist_data *pgdata = &contig_page_data;
+	struct zone *zone = pgdata->node_zones + MAX_NR_ZONES-1;
+	unsigned long start_pfn = start >> PAGE_SHIFT;
+	unsigned long nr_pages = size >> PAGE_SHIFT;
+
+	return __add_pages(zone, start_pfn, nr_pages);
+}
+
+int remove_memory(u64 start, u64 size)
+{
+	return -EINVAL;
+}
+#endif
+
 kmem_cache_t *pgd_cache;
 kmem_cache_t *pmd_cache;
 
diff -puN arch/i386/Kconfig~D1-i386-hotplug-functions arch/i386/Kconfig
diff -puN arch/i386/mm/discontig.c~D1-i386-hotplug-functions arch/i386/mm/discontig.c
--- memhotplug/arch/i386/mm/discontig.c~D1-i386-hotplug-functions	2005-08-12 07:43:50.000000000 -0700
+++ memhotplug-dave/arch/i386/mm/discontig.c	2005-08-12 07:43:50.000000000 -0700
@@ -98,7 +98,7 @@ unsigned long node_memmap_size_bytes(int
 
 extern unsigned long find_max_low_pfn(void);
 extern void find_max_pfn(void);
-extern void one_highpage_init(struct page *, int, int);
+extern void add_one_highpage_init(struct page *, int, int);
 
 extern struct e820map e820;
 extern unsigned long init_pg_tables_end;
@@ -427,7 +427,7 @@ void __init set_highmem_pages_init(int b
 			if (!pfn_valid(node_pfn))
 				continue;
 			page = pfn_to_page(node_pfn);
-			one_highpage_init(page, node_pfn, bad_ppro);
+			add_one_highpage_init(page, node_pfn, bad_ppro);
 		}
 	}
 	totalram_pages += totalhigh_pages;
diff -puN mm/highmem.c~D1-i386-hotplug-functions mm/highmem.c
_

  parent reply	other threads:[~2005-08-12 14:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-12 14:47 [RFC][PATCH 01/12] memory hotplug prep: kill local_mapnr Dave Hansen
2005-08-12 14:47 ` [RFC][PATCH 02/12] memory hotplug prep: break out zone initialization Dave Hansen
2005-08-12 14:47 ` [RFC][PATCH 03/12] memory hotplug prep: zone wait table at runtime Dave Hansen
2005-08-12 14:47 ` [RFC][PATCH 04/12] memory hotplug prep: __section_nr helper Dave Hansen
2005-08-12 14:47 ` [RFC][PATCH 05/12] memory hotplug prep: fixup bad_range() Dave Hansen
2005-08-12 14:47 ` [RFC][PATCH 06/12] memory hotplug locking: node_size_lock Dave Hansen
2005-08-12 14:47 ` [RFC][PATCH 07/12] memory hotplug locking: zone span seqlock Dave Hansen
2005-08-12 14:47 ` [RFC][PATCH 08/12] memory hotplug: sysfs and add/remove functions Dave Hansen
2005-08-12 14:47 ` [RFC][PATCH 09/12] memory hotplug: move section_mem_map alloc to sparse.c Dave Hansen
2005-08-12 14:47 ` [RFC][PATCH 10/12] memory hotplug: call setup_per_zone_pages_min after hotplug Dave Hansen
2005-08-12 14:47 ` Dave Hansen [this message]
2005-08-12 14:47 ` [RFC][PATCH 12/12] memory hotplug: ppc64 specific hot-add functions Dave Hansen

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=20050812144732.7B306EB1@kernel.beaverton.ibm.com \
    --to=haveblue@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome