mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org, Hugh Dickins <hugh@veritas.com>,
	Christoph Hellwig <hch@infradead.org>,
	Con Kolivas <kernel@kolivas.org>,
	Marcelo Tosatti <marcelo@kvack.org>,
	Arjan van de Ven <arjan@infradead.org>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	Christoph Lameter <clameter@sgi.com>, Andi Kleen <ak@suse.de>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: [PATCH 09/11] Make ZONE_HIGHMEM optional
Date: Fri, 7 Jul 2006 16:18:56 -0700 (PDT)	[thread overview]
Message-ID: <20060707231856.3790.25756.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20060707231810.3790.19313.sendpatchset@schroedinger.engr.sgi.com>

Make ZONE_HIGHMEM optional

- ifdef out code and definitions related to CONFIG_HIGHMEM

- __GFP_HIGHMEM falls back to normal allocations if there is no
  ZONE_HIGHMEM

- GFP_ZONEMASK becomes 0x01 if there is no DMA32 and no HIGHMEM
  zone.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/include/linux/gfp.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/gfp.h	2006-07-07 15:07:48.199517409 -0700
+++ linux-2.6.17-mm6/include/linux/gfp.h	2006-07-07 15:07:51.984440142 -0700
@@ -12,7 +12,13 @@ struct vm_area_struct;
  */
 /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
 #define __GFP_DMA	((__force gfp_t)0x01u)
+
+#ifdef CONFIG_HIGHMEM
 #define __GFP_HIGHMEM	((__force gfp_t)0x02u)
+#else
+#define __GFP_HIGHMEM	((__force gfp_t)0x00)	/* NORMAL is HIGHMEM */
+#endif
+
 #ifndef CONFIG_ZONE_DMA32
 #define __GFP_DMA32	((__force gfp_t)0x01)	/* ZONE_DMA is ZONE_DMA32 */
 #elif BITS_PER_LONG < 64
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-07 15:07:48.160457319 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-07 15:07:51.986393146 -0700
@@ -73,7 +73,9 @@ int sysctl_lowmem_reserve_ratio[MAX_NR_Z
 #ifdef CONFIG_ZONE_DMA32
 	 256,
 #endif
+#ifdef CONFIG_HIGHMEM
 	 32
+#endif
 };
 
 EXPORT_SYMBOL(totalram_pages);
@@ -91,7 +93,9 @@ static char *zone_names[MAX_NR_ZONES] = 
 	 "DMA32",
 #endif
 	 "Normal",
+#ifdef CONFIG_HIGHMEM
 	 "HighMem"
+#endif
 };
 
 int min_free_kbytes = 1024;
@@ -1473,8 +1477,10 @@ static int __meminit build_zonelists_nod
 static inline int highest_zone(int zone_bits)
 {
 	int res = ZONE_NORMAL;
+#ifdef CONFIG_HIGHMEM
 	if (zone_bits & (__force int)__GFP_HIGHMEM)
 		res = ZONE_HIGHMEM;
+#endif
 #ifdef CONFIG_ZONE_DMA32
 	if (zone_bits & (__force int)__GFP_DMA32)
 		res = ZONE_DMA32;
Index: linux-2.6.17-mm6/include/linux/mmzone.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/mmzone.h	2006-07-07 15:07:48.161433821 -0700
+++ linux-2.6.17-mm6/include/linux/mmzone.h	2006-07-07 15:07:51.987369648 -0700
@@ -122,6 +122,7 @@ typedef enum {
 	 * transfers to all addressable memory.
 	 */
 	ZONE_NORMAL,
+#ifdef CONFIG_HIGHMEM
 	/*
 	 * A memory area that is only addressable by the kernel through
 	 * mapping portions into its own address space. This is for example
@@ -131,11 +132,10 @@ typedef enum {
 	 * access.
 	 */
 	ZONE_HIGHMEM,
-
+#endif
 	MAX_NR_ZONES
 } zones_t;
 
-#define	ZONES_SHIFT		2	/* ceil(log2(MAX_NR_ZONES)) */
 
 /*
  * When a memory allocation must conform to specific limitations (such
@@ -166,8 +166,15 @@ typedef enum {
 
 #ifdef CONFIG_ZONE_DMA32
 #define GFP_ZONEMASK		0x07
+#define	ZONES_SHIFT		2	/* ceil(log2(MAX_NR_ZONES)) */
 #else
+#ifdef CONFIG_HIGHMEM
 #define GFP_ZONEMASK		0x03
+#define	ZONES_SHIFT		2
+#else
+#define GFP_ZONEMASK		0x01
+#define ZONES_SHIFT		1
+#endif
 #endif
 
 struct zone {
@@ -414,7 +421,11 @@ static inline int populated_zone(struct 
 
 static inline int is_highmem_idx(zones_t idx)
 {
+#ifdef CONFIG_HIGHMEM
 	return (idx == ZONE_HIGHMEM);
+#else
+	return 0;
+#endif
 }
 
 static inline int is_normal_idx(zones_t idx)
@@ -430,7 +441,11 @@ static inline int is_normal_idx(zones_t 
  */
 static inline int is_highmem(struct zone *zone)
 {
+#ifdef CONFIG_HIGHMEM
 	return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM;
+#else
+	return 0;
+#endif
 }
 
 static inline int is_normal(struct zone *zone)

  parent reply	other threads:[~2006-07-07 23:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
2006-07-07 23:18 ` [PATCH 01/11] swap_prefetch: Remove incorrect use of ZONE_HIGHMEM Christoph Lameter
2006-07-07 23:18 ` [PATCH 02/11] Remove two strange uses of MAX_NR_ZONES Christoph Lameter
2006-07-07 23:18 ` [PATCH 03/11] Fix MAX_NR_ZONES array initializations Christoph Lameter
2006-07-07 23:18 ` [PATCH 04/11] Make display of highmem counters conditional on CONFIG_HIGHMEM Christoph Lameter
2006-07-07 23:18 ` [PATCH 05/11] Move HIGHMEM counters into highmem.c/.h Christoph Lameter
2006-07-07 23:18 ` [PATCH 06/11] Page allocator ZONE_HIGHMEM cleanup Christoph Lameter
2006-07-07 23:18 ` [PATCH 07/11] Use enum to define zones, reformat and comment Christoph Lameter
2006-07-08  0:56   ` Andrew Morton
2006-07-07 23:18 ` [PATCH 08/11] Make ZONE_DMA32 optional Christoph Lameter
2006-07-07 23:18 ` Christoph Lameter [this message]
2006-07-07 23:19 ` [PATCH 10/11] Remove display of counters for unconfigured zones Christoph Lameter
2006-07-07 23:19 ` [PATCH 11/11] Fix i386 SRAT check for MAX_NR_ZONES Christoph Lameter

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=20060707231856.3790.25756.sendpatchset@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=hch@infradead.org \
    --cc=hugh@veritas.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    /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