linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
To: linux-mm@kvack.org
Subject: [PATCH] remove zone ifdefs under mm/ [2/2]
Date: Tue, 20 Feb 2007 14:34:11 +0900	[thread overview]
Message-ID: <20070220143411.ecc56e24.kamezawa.hiroyu@jp.fujitsu.com> (raw)
In-Reply-To: <20070220143010.6caf8cd9.kamezawa.hiroyu@jp.fujitsu.com>

remove #ifdefs of CONFIG_HIGHMEM/DMA32.(as an example)

Signed-Off-By: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Index: linux-2.6.20-devel/mm/page_alloc.c
===================================================================
--- linux-2.6.20-devel.orig/mm/page_alloc.c
+++ linux-2.6.20-devel/mm/page_alloc.c
@@ -72,28 +72,11 @@ static void __free_pages_ok(struct page 
  * TBD: should special case ZONE_DMA32 machines here - in those we normally
  * don't need any ZONE_NORMAL reservation
  */
-int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
-	 256,
-#ifdef CONFIG_ZONE_DMA32
-	 256,
-#endif
-#ifdef CONFIG_HIGHMEM
-	 32
-#endif
-};
+int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
 
 EXPORT_SYMBOL(totalram_pages);
 
-static char * const zone_names[MAX_NR_ZONES] = {
-	 "DMA",
-#ifdef CONFIG_ZONE_DMA32
-	 "DMA32",
-#endif
-	 "Normal",
-#ifdef CONFIG_HIGHMEM
-	 "HighMem"
-#endif
-};
+static char * zone_names[ALL_POSSIBLE_ZONES];
 
 int min_free_kbytes = 1024;
 
@@ -132,6 +115,29 @@ static unsigned long __initdata dma_rese
 #endif /* CONFIG_MEMORY_HOTPLUG_RESERVE */
 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
 
+static char dma_string[] = "DMA";
+static char normal_string[] = "Normal";
+static char dma32_string[] = "DMA32";
+static char highmem_string[] = "Highmem";
+
+static void __meminit init_zone_variables(void)
+{
+	if (zone_names[ZONE_DMA] == dma_string)
+		return;
+	zone_names[ZONE_DMA] =  dma_string;
+	zone_names[ZONE_DMA32] =  dma32_string;
+	zone_names[ZONE_NORMAL] =  normal_string;
+	zone_names[ZONE_HIGHMEM] = highmem_string;
+	sysctl_lowmem_reserve_ratio[ZONE_NORMAL] = 256;
+	if (is_configured_zone(ZONE_DMA32))
+		sysctl_lowmem_reserve_ratio[ZONE_DMA32] = 256;
+	if (is_configured_zone(ZONE_HIGHMEM))
+		sysctl_lowmem_reserve_ratio[ZONE_HIGHMEM] = 16;
+
+}
+
+
+
 #ifdef CONFIG_DEBUG_VM
 static int page_outside_zone_boundaries(struct zone *zone, struct page *page)
 {
@@ -1530,13 +1536,13 @@ void si_meminfo_node(struct sysinfo *val
 
 	val->totalram = pgdat->node_present_pages;
 	val->freeram = nr_free_pages_pgdat(pgdat);
-#ifdef CONFIG_HIGHMEM
-	val->totalhigh = pgdat->node_zones[ZONE_HIGHMEM].present_pages;
-	val->freehigh = pgdat->node_zones[ZONE_HIGHMEM].free_pages;
-#else
-	val->totalhigh = 0;
-	val->freehigh = 0;
-#endif
+	if (is_configured_zone(ZONE_HIGHMEM)) {
+		val->totalhigh = pgdat->node_zones[ZONE_HIGHMEM].present_pages;
+		val->freehigh = pgdat->node_zones[ZONE_HIGHMEM].free_pages;
+	} else {
+		val->totalhigh = 0;
+		val->freehigh = 0;
+	}
 	val->mem_unit = PAGE_SIZE;
 }
 #endif
@@ -2621,6 +2627,7 @@ static void __meminit free_area_init_cor
 	unsigned long zone_start_pfn = pgdat->node_start_pfn;
 	int ret;
 
+	init_zone_variables();
 	pgdat_resize_init(pgdat);
 	pgdat->nr_zones = 0;
 	init_waitqueue_head(&pgdat->kswapd_wait);
Index: linux-2.6.20-devel/mm/page-writeback.c
===================================================================
--- linux-2.6.20-devel.orig/mm/page-writeback.c
+++ linux-2.6.20-devel/mm/page-writeback.c
@@ -131,12 +131,11 @@ get_dirty_limits(long *pbackground, long
 	unsigned long available_memory = vm_total_pages;
 	struct task_struct *tsk;
 
-#ifdef CONFIG_HIGHMEM
 	/*
 	 * We always exclude high memory from our count.
 	 */
-	available_memory -= totalhigh_pages;
-#endif
+	if (is_configured_zone(ZONE_HIGHMEM))
+		available_memory -= totalhigh_pages;
 
 
 	unmapped_ratio = 100 - ((global_page_state(NR_FILE_MAPPED) +

--
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>

      reply	other threads:[~2007-02-20  5:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20  5:30 [PATCH] zone configration check function [1/2] KAMEZAWA Hiroyuki
2007-02-20  5:34 ` KAMEZAWA Hiroyuki [this message]

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=20070220143411.ecc56e24.kamezawa.hiroyu@jp.fujitsu.com \
    --to=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.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