* [PATCH] modularization of mem_init() for 2.4.19pre7
@ 2002-04-18 18:17 Patricia Gaughen
2002-04-18 18:28 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Patricia Gaughen @ 2002-04-18 18:17 UTC (permalink / raw)
To: marcelo; +Cc: linux-kernel
Please consider this patch for inclusion into the next 2.4 release.
It was accepted into the 2.4.19pre6aa1, with slight modifications
by Andrea that I have incorporated into this version of my patch.
This patch restructures the mem_init() code to make it easier to
include the i386 numa changes (for CONFIG_DISCONTIGMEM) I've been
working on.
I'm also submitting a patch for setup_arch(), the two patches do not
depend on each other, but my discontigmem patches (which I'll be
sending out at the start of next week) do depend on both.
Previous postings regarding this patch are available at:
http://marc.theaimsgroup.com/?l=linux-kernel&m=101562204614563&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=101664599417808&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=101565828617899&w=2
I've booted with the patches on the following systems:
UP system
4 Proc SMP system
8 Proc NUMA system
Thanks,
Pat
--
Patricia Gaughen (gone@us.ibm.com)
IBM Linux Technology Center
http://www.ibm.com/linux/ltc/
--- linux-2.4.19pre7/arch/i386/mm/init.c Tue Apr 16 15:07:03 2002
+++ linux-2.4.19pre7-cleanup/arch/i386/mm/init.c Tue Apr 16 16:31:46 2002
@@ -444,18 +444,57 @@
return 0;
}
-void __init mem_init(void)
+void __init init_one_highpage(struct page *page, int pfn, int bad_ppro)
+{
+ if (!page_is_ram(pfn)) {
+ SetPageReserved(page);
+ return;
+ }
+
+ if (bad_ppro && page_kills_ppro(pfn))
+ {
+ SetPageReserved(page);
+ return;
+ }
+ ClearPageReserved(page);
+ set_bit(PG_highmem, &page->flags);
+ atomic_set(&page->count, 1);
+ __free_page(page);
+ totalhigh_pages++;
+}
+
+static int __init mem_init_free_pages(void)
{
extern int ppro_with_ram_bug(void);
+ int bad_ppro, reservedpages, pfn;
+
+ bad_ppro = ppro_with_ram_bug();
+
+ /* this will put all low memory onto the freelists */
+ totalram_pages += free_all_bootmem();
+
+ reservedpages = 0;
+ for (pfn = 0; pfn < max_low_pfn; pfn++)
+ /*
+ * Only count reserved RAM pages
+ */
+ if (page_is_ram(pfn) && PageReserved(mem_map+pfn))
+ reservedpages++;
+#ifdef CONFIG_HIGHMEM
+ for (pfn = highend_pfn-1; pfn >= highstart_pfn; pfn--)
+ init_one_highpage((struct page *) (mem_map + pfn), pfn, bad_ppro);
+ totalram_pages += totalhigh_pages;
+#endif
+ return reservedpages;
+}
+
+void __init mem_init(void)
+{
int codesize, reservedpages, datasize, initsize;
- int tmp;
- int bad_ppro;
if (!mem_map)
BUG();
- bad_ppro = ppro_with_ram_bug();
-
#ifdef CONFIG_HIGHMEM
highmem_start_page = mem_map + highstart_pfn;
max_mapnr = num_physpages = highend_pfn;
@@ -468,37 +507,8 @@
/* clear the zero-page */
memset(empty_zero_page, 0, PAGE_SIZE);
- /* this will put all low memory onto the freelists */
- totalram_pages += free_all_bootmem();
+ reservedpages = mem_init_free_pages();
- reservedpages = 0;
- for (tmp = 0; tmp < max_low_pfn; tmp++)
- /*
- * Only count reserved RAM pages
- */
- if (page_is_ram(tmp) && PageReserved(mem_map+tmp))
- reservedpages++;
-#ifdef CONFIG_HIGHMEM
- for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
- struct page *page = mem_map + tmp;
-
- if (!page_is_ram(tmp)) {
- SetPageReserved(page);
- continue;
- }
- if (bad_ppro && page_kills_ppro(tmp))
- {
- SetPageReserved(page);
- continue;
- }
- ClearPageReserved(page);
- set_bit(PG_highmem, &page->flags);
- atomic_set(&page->count, 1);
- __free_page(page);
- totalhigh_pages++;
- }
- totalram_pages += totalhigh_pages;
-#endif
codesize = (unsigned long) &_etext - (unsigned long) &_text;
datasize = (unsigned long) &_edata - (unsigned long) &_etext;
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] modularization of mem_init() for 2.4.19pre7
2002-04-18 18:17 [PATCH] modularization of mem_init() for 2.4.19pre7 Patricia Gaughen
@ 2002-04-18 18:28 ` Christoph Hellwig
2002-04-18 18:51 ` Patricia Gaughen
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2002-04-18 18:28 UTC (permalink / raw)
To: Patricia Gaughen; +Cc: marcelo, linux-kernel
On Thu, Apr 18, 2002 at 11:17:22AM -0700, Patricia Gaughen wrote:
> -void __init mem_init(void)
> +void __init init_one_highpage(struct page *page, int pfn, int bad_ppro)
> +{
> + if (!page_is_ram(pfn)) {
> + SetPageReserved(page);
> + return;
> + }
> +
> + if (bad_ppro && page_kills_ppro(pfn))
> + {
> + SetPageReserved(page);
> + return;
> + }
I'd suggest to stay with one coding style. Prefferedly that would be
the one in Documentation/CodingStyle.
> +
> + reservedpages = 0;
> + for (pfn = 0; pfn < max_low_pfn; pfn++)
> + /*
> + * Only count reserved RAM pages
> + */
> + if (page_is_ram(pfn) && PageReserved(mem_map+pfn))
> + reservedpages++;
Adding braces around this hughe loop body would make it a little
more readable..
Besides these minor style nitpicks the pages look good to me.
BTW: Where is the NUMA code that builds ontop of this?
Christoph
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] modularization of mem_init() for 2.4.19pre7
2002-04-18 18:28 ` Christoph Hellwig
@ 2002-04-18 18:51 ` Patricia Gaughen
0 siblings, 0 replies; 3+ messages in thread
From: Patricia Gaughen @ 2002-04-18 18:51 UTC (permalink / raw)
To: Christoph Hellwig, marcelo, linux-kernel
> On Thu, Apr 18, 2002 at 11:17:22AM -0700, Patricia Gaughen wrote:
> > -void __init mem_init(void)
> > +void __init init_one_highpage(struct page *page, int pfn, int bad_ppro)
> > +{
> > + if (!page_is_ram(pfn)) {
> > + SetPageReserved(page);
> > + return;
> > + }
> > +
> > + if (bad_ppro && page_kills_ppro(pfn))
> > + {
> > + SetPageReserved(page);
> > + return;
> > + }
>
> I'd suggest to stay with one coding style. Prefferedly that would be
> the one in Documentation/CodingStyle.
whoops! thanks for catching that.
>
> > +
> > + reservedpages = 0;
> > + for (pfn = 0; pfn < max_low_pfn; pfn++)
> > + /*
> > + * Only count reserved RAM pages
> > + */
> > + if (page_is_ram(pfn) && PageReserved(mem_map+pfn))
> > + reservedpages++;
>
> Adding braces around this hughe loop body would make it a little
> more readable..
I agree, new patch attached.
>
> Besides these minor style nitpicks the pages look good to me.
>
> BTW: Where is the NUMA code that builds ontop of this?
an out of date version of my patch is available at:
http://www-124.ibm.com/developer/opensource/linux/patches/?patch_id=320
I will be submitting the new and improved version soon. :-)
Thanks,
Pat
--
Patricia Gaughen (gone@us.ibm.com)
IBM Linux Technology Center
http://www.ibm.com/linux/ltc/
--- linux-2.4.19pre7/arch/i386/mm/init.c Tue Apr 16 15:07:03 2002
+++ linux-2.4.19pre7-cleanup/arch/i386/mm/init.c Thu Apr 18 11:41:10 2002
@@ -444,18 +444,58 @@
return 0;
}
-void __init mem_init(void)
+void __init init_one_highpage(struct page *page, int pfn, int bad_ppro)
+{
+ if (!page_is_ram(pfn)) {
+ SetPageReserved(page);
+ return;
+ }
+
+ if (bad_ppro && page_kills_ppro(pfn)) {
+ SetPageReserved(page);
+ return;
+ }
+
+ ClearPageReserved(page);
+ set_bit(PG_highmem, &page->flags);
+ atomic_set(&page->count, 1);
+ __free_page(page);
+ totalhigh_pages++;
+}
+
+static int __init mem_init_free_pages(void)
{
extern int ppro_with_ram_bug(void);
+ int bad_ppro, reservedpages, pfn;
+
+ bad_ppro = ppro_with_ram_bug();
+
+ /* this will put all low memory onto the freelists */
+ totalram_pages += free_all_bootmem();
+
+ reservedpages = 0;
+ for (pfn = 0; pfn < max_low_pfn; pfn++) {
+ /*
+ * Only count reserved RAM pages
+ */
+ if (page_is_ram(pfn) && PageReserved(mem_map+pfn))
+ reservedpages++;
+ }
+#ifdef CONFIG_HIGHMEM
+ for (pfn = highend_pfn-1; pfn >= highstart_pfn; pfn--)
+ init_one_highpage((struct page *) (mem_map + pfn), pfn, bad_ppro);
+ totalram_pages += totalhigh_pages;
+#endif
+ return reservedpages;
+}
+
+void __init mem_init(void)
+{
int codesize, reservedpages, datasize, initsize;
- int tmp;
- int bad_ppro;
if (!mem_map)
BUG();
- bad_ppro = ppro_with_ram_bug();
-
#ifdef CONFIG_HIGHMEM
highmem_start_page = mem_map + highstart_pfn;
max_mapnr = num_physpages = highend_pfn;
@@ -468,37 +508,8 @@
/* clear the zero-page */
memset(empty_zero_page, 0, PAGE_SIZE);
- /* this will put all low memory onto the freelists */
- totalram_pages += free_all_bootmem();
-
- reservedpages = 0;
- for (tmp = 0; tmp < max_low_pfn; tmp++)
- /*
- * Only count reserved RAM pages
- */
- if (page_is_ram(tmp) && PageReserved(mem_map+tmp))
- reservedpages++;
-#ifdef CONFIG_HIGHMEM
- for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
- struct page *page = mem_map + tmp;
+ reservedpages = mem_init_free_pages();
- if (!page_is_ram(tmp)) {
- SetPageReserved(page);
- continue;
- }
- if (bad_ppro && page_kills_ppro(tmp))
- {
- SetPageReserved(page);
- continue;
- }
- ClearPageReserved(page);
- set_bit(PG_highmem, &page->flags);
- atomic_set(&page->count, 1);
- __free_page(page);
- totalhigh_pages++;
- }
- totalram_pages += totalhigh_pages;
-#endif
codesize = (unsigned long) &_etext - (unsigned long) &_text;
datasize = (unsigned long) &_edata - (unsigned long) &_etext;
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2002-04-18 18:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-18 18:17 [PATCH] modularization of mem_init() for 2.4.19pre7 Patricia Gaughen
2002-04-18 18:28 ` Christoph Hellwig
2002-04-18 18:51 ` Patricia Gaughen
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.