public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Adrian Bunk <bunk@fs.tum.de>
Cc: Pavel Machek <pavel@ucw.cz>,
	Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Linux v2.5.41
Date: Tue, 8 Oct 2002 06:41:07 -0700	[thread overview]
Message-ID: <20021008134107.GH12432@holomorphy.com> (raw)
In-Reply-To: <Pine.NEB.4.44.0210081359280.8340-100000@mimas.fachschaften.tu-muenchen.de>

On Mon, 7 Oct 2002, Linus Torvalds wrote:
>> Pavel Machek <pavel@ucw.cz>:
>>   o Swsusp updates, do not thrash ide disk on suspend

On Tue, Oct 08, 2002 at 02:02:50PM +0200, Adrian Bunk wrote:
> This change causes the following compile error with CONFIG_DISCONTIGMEM
> enabled:
> kernel/suspend.c: In function `count_and_copy_data_pages':
> kernel/suspend.c:479: `max_mapnr' undeclared (first use in this function)
> kernel/suspend.c:479: (Each undeclared identifier is reported only once
> kernel/suspend.c:479: for each function it appears in.)
> make[1]: *** [kernel/suspend.o] Error 1
> make: *** [kernel] Error 2

max_mapnr must die. It's mostly buggy largely because it's not what
people think it is. Most of the time people want max_pfn, and the rest
they don't want it at all.

Pavel, you might also want to make config options conflict instead of
panicking.

It's mostly an expression of opinion, but here's a patch.
Totally untested, ignoring all but x86's arch code, vs. 2.5.41:


diff -urN linux-2.5.41/arch/i386/config.in swsusp-2.5.41/arch/i386/config.in
--- linux-2.5.41/arch/i386/config.in	2002-10-07 11:24:02.000000000 -0700
+++ swsusp-2.5.41/arch/i386/config.in	2002-10-08 06:17:11.000000000 -0700
@@ -441,7 +441,7 @@
 
 mainmenu_option next_comment
 comment 'Kernel hacking'
-if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
+if [ "$CONFIG_EXPERIMENTAL" = "y" -a "$CONFIG_DISCONTIGMEM" != "y" ]; then
    dep_bool 'Software Suspend (EXPERIMENTAL)' CONFIG_SOFTWARE_SUSPEND $CONFIG_PM
 fi
 
diff -urN linux-2.5.41/arch/i386/mm/discontig.c swsusp-2.5.41/arch/i386/mm/discontig.c
--- linux-2.5.41/arch/i386/mm/discontig.c	2002-10-07 11:24:39.000000000 -0700
+++ swsusp-2.5.41/arch/i386/mm/discontig.c	2002-10-08 06:18:19.000000000 -0700
@@ -271,13 +271,3 @@
 	totalram_pages += totalhigh_pages;
 #endif
 }
-
-void __init set_max_mapnr_init(void)
-{
-#ifdef CONFIG_HIGHMEM
-	highmem_start_page = NODE_DATA(0)->node_zones[ZONE_HIGHMEM].zone_mem_map;
-	num_physpages = highend_pfn;
-#else
-	num_physpages = max_low_pfn;
-#endif
-}
diff -urN linux-2.5.41/arch/i386/mm/init.c swsusp-2.5.41/arch/i386/mm/init.c
--- linux-2.5.41/arch/i386/mm/init.c	2002-10-07 11:23:35.000000000 -0700
+++ swsusp-2.5.41/arch/i386/mm/init.c	2002-10-08 06:18:07.000000000 -0700
@@ -411,19 +411,9 @@
 }
 
 #ifndef CONFIG_DISCONTIGMEM
-static void __init set_max_mapnr_init(void)
-{
-#ifdef CONFIG_HIGHMEM
-	highmem_start_page = pfn_to_page(highstart_pfn);
-	max_mapnr = num_physpages = highend_pfn;
-#else
-	max_mapnr = num_physpages = max_low_pfn;
-#endif
-}
 #define __free_all_bootmem() free_all_bootmem()
 #else
 #define __free_all_bootmem() free_all_bootmem_node(NODE_DATA(0))
-extern void set_max_mapnr_init(void);
 #endif /* !CONFIG_DISCONTIGMEM */
 
 #ifdef CONFIG_HUGETLB_PAGE
@@ -447,8 +437,6 @@
 	
 	bad_ppro = ppro_with_ram_bug();
 
-	set_max_mapnr_init();
-
 	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
 
 	/* clear the zero-page */
diff -urN linux-2.5.41/include/asm-i386/page.h swsusp-2.5.41/include/asm-i386/page.h
--- linux-2.5.41/include/asm-i386/page.h	2002-10-07 11:23:32.000000000 -0700
+++ swsusp-2.5.41/include/asm-i386/page.h	2002-10-08 06:17:43.000000000 -0700
@@ -145,7 +145,7 @@
 #ifndef CONFIG_DISCONTIGMEM
 #define pfn_to_page(pfn)	(mem_map + (pfn))
 #define page_to_pfn(page)	((unsigned long)((page) - mem_map))
-#define pfn_valid(pfn)		((pfn) < max_mapnr)
+#define pfn_valid(pfn)		((pfn) < max_pfn)
 #endif /* !CONFIG_DISCONTIGMEM */
 #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
 
diff -urN linux-2.5.41/include/linux/mm.h swsusp-2.5.41/include/linux/mm.h
--- linux-2.5.41/include/linux/mm.h	2002-10-07 11:23:22.000000000 -0700
+++ swsusp-2.5.41/include/linux/mm.h	2002-10-08 06:17:31.000000000 -0700
@@ -15,10 +15,6 @@
 #include <linux/rbtree.h>
 #include <linux/fs.h>
 
-#ifndef CONFIG_DISCONTIGMEM          /* Don't use mapnrs, do it properly */
-extern unsigned long max_mapnr;
-#endif
-
 extern unsigned long num_physpages;
 extern void * high_memory;
 extern int page_cluster;
diff -urN linux-2.5.41/kernel/ksyms.c swsusp-2.5.41/kernel/ksyms.c
--- linux-2.5.41/kernel/ksyms.c	2002-10-07 11:22:56.000000000 -0700
+++ swsusp-2.5.41/kernel/ksyms.c	2002-10-08 06:16:37.000000000 -0700
@@ -117,7 +117,6 @@
 #ifndef CONFIG_DISCONTIGMEM
 EXPORT_SYMBOL(contig_page_data);
 EXPORT_SYMBOL(mem_map);
-EXPORT_SYMBOL(max_mapnr);
 #endif
 EXPORT_SYMBOL(high_memory);
 EXPORT_SYMBOL(vmtruncate);
diff -urN linux-2.5.41/kernel/suspend.c swsusp-2.5.41/kernel/suspend.c
--- linux-2.5.41/kernel/suspend.c	2002-10-07 11:23:37.000000000 -0700
+++ swsusp-2.5.41/kernel/suspend.c	2002-10-08 06:16:54.000000000 -0700
@@ -474,9 +474,9 @@
 #ifdef CONFIG_DISCONTIGMEM
 	panic("Discontingmem not supported");
 #else
-	BUG_ON (max_mapnr != num_physpages);
+	BUG_ON (max_pfn != num_physpages);
 #endif
-	for (pfn = 0; pfn < max_mapnr; pfn++) {
+	for (pfn = 0; pfn < max_pfn; pfn++) {
 		page = pfn_to_page(pfn);
 		if (PageHighMem(page))
 			panic("Swsusp not supported on highmem boxes. Send 1GB of RAM to <pavel@ucw.cz> and try again ;-).");
diff -urN linux-2.5.41/mm/memory.c swsusp-2.5.41/mm/memory.c
--- linux-2.5.41/mm/memory.c	2002-10-07 11:24:12.000000000 -0700
+++ swsusp-2.5.41/mm/memory.c	2002-10-08 06:17:18.000000000 -0700
@@ -55,7 +55,6 @@
 
 #ifndef CONFIG_DISCONTIGMEM
 /* use the per-pgdat data instead for discontigmem - mbligh */
-unsigned long max_mapnr;
 struct page *mem_map;
 #endif
 

  reply	other threads:[~2002-10-08 13:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-07 19:02 Linux v2.5.41 Linus Torvalds
2002-10-07 19:22 ` Linus Torvalds
2002-10-07 19:29   ` Robert Love
2002-10-07 20:32 ` Linux v2.5.41 -> don't compil Gregoire Favre
2002-10-07 21:03 ` [PATCH] Fix IPv6 [was Re: Linux v2.5.41] Jasper Spaans
2002-10-08  1:08   ` [PATCH] Fix IPv6 YOSHIFUJI Hideaki / 吉藤英明
2002-10-08  1:26     ` kuznet
2002-10-08 19:51     ` David S. Miller
2002-10-08 12:02 ` Linux v2.5.41 Adrian Bunk
2002-10-08 13:41   ` William Lee Irwin III [this message]
2002-10-08 20:28     ` Pavel Machek
     [not found] <mailman.1034018941.1657.linux-kernel2news@redhat.com>
2002-10-07 20:01 ` Pete Zaitcev
2002-10-07 19:57   ` David S. Miller
2002-10-07 20:03   ` Vojtech Pavlik
2002-10-07 20:01     ` David S. Miller
2002-10-07 20:08       ` Vojtech Pavlik
2002-10-07 20:28     ` Alan Cox

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=20021008134107.GH12432@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=bunk@fs.tum.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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