* [RFC 1/8] Rework mmzone.h: Make DMA32 and HIGHMEM optional
2006-07-03 21:55 [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Lameter
@ 2006-07-03 21:55 ` Christoph Lameter
2006-07-03 22:28 ` Andi Kleen
2006-07-03 21:55 ` [RFC 2/8] Make display of highmem counters conditional on CONFIG_HIGHMEM Christoph Lameter
` (7 subsequent siblings)
8 siblings, 1 reply; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 21:55 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin,
Christoph Lameter, Andi Kleen
Get rid of ZONE_HIGHMEM and ZONE_DMA32 for arches that do not need them.
This patch gets rid of both zones if an arch does not use them. Most 64 bit
arches do not use ZONE_HIGHMEM and only x86_64 uses ZONE_DMA32. So
64 bit arches other than x86_64 will only need 2 zones instead of 4.
With this patch both zones will not be defined. Test operations on the
zones will not do anything but simply return false so that code is not
compiled that first checks if a zone is of this type.
This patch introduces CONFIG_ZONE_DMA32 that must be defined by an
arch to get the ZONE_DMA32 zone defined. The CONFIG_DMA_IS_DMA32 and the
CONFIG_DMA_IS_NORMAL hack used by IA64 to sort out what DMA32 means if
there is no DMA32 zone is removed.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.17-mm6/include/linux/mmzone.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/mmzone.h 2006-07-03 13:47:21.738209377 -0700
+++ linux-2.6.17-mm6/include/linux/mmzone.h 2006-07-03 13:51:27.686865769 -0700
@@ -87,15 +87,57 @@ struct per_cpu_pageset {
#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
#endif
-#define ZONE_DMA 0
-#define ZONE_DMA32 1
-#define ZONE_NORMAL 2
-#define ZONE_HIGHMEM 3
+typedef enum {
+ /*
+ * ZONE_DMA is used when there are devices that are not able
+ * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
+ * carve out the portion of memory that is needed for these devices.
+ * The range is arch specific.
+ *
+ * Some examples
+ *
+ * Architecture Limit
+ * ---------------------------
+ * parisc, ia64, sparc <4G
+ * s390 <2G
+ * arm26 <48M
+ * arm Various
+ * alpha Unlimited or 0-16MB.
+ *
+ * i386, x86_64 and multiple other arches
+ * <16M.
+ */
+ ZONE_DMA,
+#ifdef CONFIG_ZONE_DMA32
+ /*
+ * x86_64 needs two ZONE_DMAs because it supports devices that are
+ * only able to do DMA to the lower 16M but also 32 bit devices that
+ * can only do DMA to the lower 4G.
+ */
+ ZONE_DMA32,
+#endif
+ /*
+ * Normal addressable memory is in ZONE_NORMAL. DMA operations can be
+ * performed on pages in ZONE_NORMAL if the DMA devices support
+ * 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
+ * used by i386 to allow the kernel to address the memory beyond
+ * 4G. The kernel will set up special mappings (page
+ * table entries on i386) for each page that the kernel needs to
+ * access.
+ */
+ ZONE_HIGHMEM,
+#endif
+ MAX_NR_ZONES
+} zones_t;
-#define MAX_NR_ZONES 4 /* Sync this with ZONES_SHIFT */
#define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */
-
/*
* When a memory allocation must conform to specific limitations (such
* as being suitable for DMA) the caller will pass in hints to the
@@ -125,16 +167,6 @@ struct per_cpu_pageset {
/* #define GFP_ZONETYPES (GFP_ZONEMASK + 1) */ /* Non-loner */
#define GFP_ZONETYPES ((GFP_ZONEMASK + 1) / 2 + 1) /* Loner */
-/*
- * On machines where it is needed (eg PCs) we divide physical memory
- * into multiple physical zones. On a 32bit PC we have 4 zones:
- *
- * ZONE_DMA < 16 MB ISA DMA capable memory
- * ZONE_DMA32 0 MB Empty
- * ZONE_NORMAL 16-896 MB direct mapped by the kernel
- * ZONE_HIGHMEM > 896 MB only page cache and user processes
- */
-
struct zone {
/* Fields commonly accessed by the page allocator */
unsigned long free_pages;
@@ -380,7 +412,11 @@ static inline int populated_zone(struct
static inline int is_highmem_idx(int idx)
{
+#ifdef CONFIG_HIGHMEM
return (idx == ZONE_HIGHMEM);
+#else
+ return 0;
+#endif
}
static inline int is_normal_idx(int idx)
@@ -396,7 +432,11 @@ static inline int is_normal_idx(int idx)
*/
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)
@@ -406,7 +446,11 @@ static inline int is_normal(struct zone
static inline int is_dma32(struct zone *zone)
{
+#ifdef CONFIG_ZONE_DMA32
return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
+#else
+ return 0;
+#endif
}
static inline int is_dma(struct zone *zone)
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c 2006-07-03 13:47:22.634638312 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c 2006-07-03 13:51:27.688818773 -0700
@@ -69,7 +69,15 @@ 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, 256, 32 };
+int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
+ 256
+#ifdef CONFIG_ZONE_DMA32
+ , 256
+#endif
+#ifdef CONFIG_HIGHMEM
+ , 32
+#endif
+};
EXPORT_SYMBOL(totalram_pages);
@@ -80,7 +88,17 @@ EXPORT_SYMBOL(totalram_pages);
struct zone *zone_table[1 << ZONETABLE_SHIFT] __read_mostly;
EXPORT_SYMBOL(zone_table);
-static char *zone_names[MAX_NR_ZONES] = { "DMA", "DMA32", "Normal", "HighMem" };
+static char *zone_names[MAX_NR_ZONES] = {
+ "DMA",
+#ifdef CONFIG_ZONE_DMA32
+ "DMA32",
+#endif
+ "Normal",
+#ifdef CONFIG_HIGHMEM
+ "HighMem"
+#endif
+};
+
int min_free_kbytes = 1024;
unsigned long __meminitdata nr_kernel_pages;
@@ -1323,8 +1341,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
val->mem_unit = PAGE_SIZE;
}
#endif
@@ -1453,14 +1476,12 @@ static int __meminit build_zonelists_nod
{
struct zone *zone;
- BUG_ON(zone_type > ZONE_HIGHMEM);
+ BUG_ON(zone_type >= MAX_NR_ZONES);
do {
zone = pgdat->node_zones + zone_type;
if (populated_zone(zone)) {
-#ifndef CONFIG_HIGHMEM
- BUG_ON(zone_type > ZONE_NORMAL);
-#endif
+ BUG_ON(is_highmem_idx(zone_type));
zonelist->zones[nr_zones++] = zone;
check_highest_zone(zone_type);
}
@@ -1472,14 +1493,17 @@ 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;
+ return ZONE_HIGHMEM;
+#endif
+#ifdef CONFIG_ZONE_DMA32
if (zone_bits & (__force int)__GFP_DMA32)
- res = ZONE_DMA32;
- if (zone_bits & (__force int)__GFP_DMA)
- res = ZONE_DMA;
- return res;
+ return ZONE_DMA32;
+#endif
+ if ((zone_bits & (__force int)__GFP_DMA))
+ return ZONE_DMA;
+ return ZONE_NORMAL;
}
#ifdef CONFIG_NUMA
@@ -2091,7 +2115,7 @@ static void __meminit free_area_init_cor
if (zholes_size)
realsize -= zholes_size[j];
- if (j < ZONE_HIGHMEM)
+ if (!is_highmem_idx(j))
nr_kernel_pages += realsize;
nr_all_pages += realsize;
Index: linux-2.6.17-mm6/include/linux/gfp.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/gfp.h 2006-07-03 13:47:21.552673977 -0700
+++ linux-2.6.17-mm6/include/linux/gfp.h 2006-07-03 13:51:39.988839321 -0700
@@ -13,12 +13,13 @@ struct vm_area_struct;
/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
#define __GFP_DMA ((__force gfp_t)0x01u)
#define __GFP_HIGHMEM ((__force gfp_t)0x02u)
-#ifdef CONFIG_DMA_IS_DMA32
-#define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */
+
+#ifdef CONFIG_ZONE_DMA32
+#define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */
#elif BITS_PER_LONG < 64
#define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */
#else
-#define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */
+#define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */
#endif
/*
Index: linux-2.6.17-mm6/arch/x86_64/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/x86_64/Kconfig 2006-07-03 13:47:14.227931665 -0700
+++ linux-2.6.17-mm6/arch/x86_64/Kconfig 2006-07-03 13:51:27.698583794 -0700
@@ -73,6 +73,10 @@ config GENERIC_ISA_DMA
bool
default y
+config ZONE_DMA32
+ bool
+ default y
+
config GENERIC_IOMAP
bool
default y
Index: linux-2.6.17-mm6/arch/ia64/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/ia64/Kconfig 2006-07-03 13:47:12.766108010 -0700
+++ linux-2.6.17-mm6/arch/ia64/Kconfig 2006-07-03 13:55:32.735187140 -0700
@@ -66,15 +66,6 @@ config IA64_UNCACHED_ALLOCATOR
bool
select GENERIC_ALLOCATOR
-config DMA_IS_DMA32
- bool
- default y
-
-config DMA_IS_NORMAL
- bool
- depends on IA64_SGI_SN2
- default y
-
choice
prompt "System type"
default IA64_GENERIC
Index: linux-2.6.17-mm6/include/linux/vmstat.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/vmstat.h 2006-07-03 13:47:22.185447343 -0700
+++ linux-2.6.17-mm6/include/linux/vmstat.h 2006-07-03 13:55:21.076728479 -0700
@@ -124,16 +124,14 @@ static inline unsigned long node_page_st
struct zone *zones = NODE_DATA(node)->node_zones;
return
-#ifndef CONFIG_DMA_IS_NORMAL
-#if !defined(CONFIG_DMA_IS_DMA32) && BITS_PER_LONG >= 64
+ zone_page_state(&zones[ZONE_DMA], item) +
+#ifdef CONFIG_ZONE_DMA32
zone_page_state(&zones[ZONE_DMA32], item) +
#endif
- zone_page_state(&zones[ZONE_NORMAL], item) +
-#endif
#ifdef CONFIG_HIGHMEM
zone_page_state(&zones[ZONE_HIGHMEM], item) +
#endif
- zone_page_state(&zones[ZONE_DMA], item);
+ zone_page_state(&zones[ZONE_NORMAL], item);
}
extern void zone_statistics(struct zonelist *, struct zone *);
^ permalink raw reply [flat|nested] 32+ messages in thread* [RFC 2/8] Make display of highmem counters conditional on CONFIG_HIGHMEM
2006-07-03 21:55 [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Lameter
2006-07-03 21:55 ` [RFC 1/8] Rework mmzone.h: Make DMA32 and HIGHMEM optional Christoph Lameter
@ 2006-07-03 21:55 ` Christoph Lameter
2006-07-03 21:55 ` [RFC 3/8] Move HIGHMEM counter into highmem.c/.h Christoph Lameter
` (6 subsequent siblings)
8 siblings, 0 replies; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 21:55 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin,
Christoph Lameter, Andi Kleen
Change HIGHMEM dependent texts and make display of highmem counters optional
Some texts are depending on CONFIG_HIGHMEM.
Remove those strings and remove the display of zero highmem values if
CONFIG_HIGHMEM is not set.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.17-mm6/drivers/base/node.c
===================================================================
--- linux-2.6.17-mm6.orig/drivers/base/node.c 2006-07-03 13:47:14.847034002 -0700
+++ linux-2.6.17-mm6/drivers/base/node.c 2006-07-03 14:00:54.064935322 -0700
@@ -54,10 +54,12 @@ static ssize_t node_read_meminfo(struct
"Node %d MemUsed: %8lu kB\n"
"Node %d Active: %8lu kB\n"
"Node %d Inactive: %8lu kB\n"
+#ifdef CONFIG_HIGHMEM
"Node %d HighTotal: %8lu kB\n"
"Node %d HighFree: %8lu kB\n"
"Node %d LowTotal: %8lu kB\n"
"Node %d LowFree: %8lu kB\n"
+#endif
"Node %d Dirty: %8lu kB\n"
"Node %d Writeback: %8lu kB\n"
"Node %d FilePages: %8lu kB\n"
@@ -72,10 +74,12 @@ static ssize_t node_read_meminfo(struct
nid, K(i.totalram - i.freeram),
nid, K(active),
nid, K(inactive),
+#ifdef CONFIG_HIGHMEM
nid, K(i.totalhigh),
nid, K(i.freehigh),
nid, K(i.totalram - i.totalhigh),
nid, K(i.freeram - i.freehigh),
+#endif
nid, K(node_page_state(nid, NR_FILE_DIRTY)),
nid, K(node_page_state(nid, NR_WRITEBACK)),
nid, K(node_page_state(nid, NR_FILE_PAGES)),
Index: linux-2.6.17-mm6/fs/proc/proc_misc.c
===================================================================
--- linux-2.6.17-mm6.orig/fs/proc/proc_misc.c 2006-07-03 13:47:19.547915149 -0700
+++ linux-2.6.17-mm6/fs/proc/proc_misc.c 2006-07-03 14:01:28.790330184 -0700
@@ -157,10 +157,12 @@ static int meminfo_read_proc(char *page,
"SwapCached: %8lu kB\n"
"Active: %8lu kB\n"
"Inactive: %8lu kB\n"
+#ifdef CONFIG_HIGHMEM
"HighTotal: %8lu kB\n"
"HighFree: %8lu kB\n"
"LowTotal: %8lu kB\n"
"LowFree: %8lu kB\n"
+#endif
"SwapTotal: %8lu kB\n"
"SwapFree: %8lu kB\n"
"Dirty: %8lu kB\n"
@@ -183,10 +185,12 @@ static int meminfo_read_proc(char *page,
K(total_swapcache_pages),
K(active),
K(inactive),
+#ifdef CONFIG_HIGHMEM
K(i.totalhigh),
K(i.freehigh),
K(i.totalram-i.totalhigh),
K(i.freeram-i.freehigh),
+#endif
K(i.totalswap),
K(i.freeswap),
K(global_page_state(NR_FILE_DIRTY)),
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c 2006-07-03 13:58:32.611757801 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c 2006-07-03 14:03:19.964129358 -0700
@@ -1394,9 +1394,13 @@ void show_free_areas(void)
get_zone_counts(&active, &inactive, &free);
+#ifdef CONFIG_HIGHMEM
printk("Free pages: %11ukB (%ukB HighMem)\n",
K(nr_free_pages()),
K(nr_free_highpages()));
+#else
+ printk("Free pages: %11ukB\n", K(nr_free_pages()));
+#endif
printk("Active:%lu inactive:%lu dirty:%lu writeback:%lu "
"unstable:%lu free:%u slab:%lu mapped:%lu pagetables:%lu\n",
^ permalink raw reply [flat|nested] 32+ messages in thread* [RFC 3/8] Move HIGHMEM counter into highmem.c/.h
2006-07-03 21:55 [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Lameter
2006-07-03 21:55 ` [RFC 1/8] Rework mmzone.h: Make DMA32 and HIGHMEM optional Christoph Lameter
2006-07-03 21:55 ` [RFC 2/8] Make display of highmem counters conditional on CONFIG_HIGHMEM Christoph Lameter
@ 2006-07-03 21:55 ` Christoph Lameter
2006-07-04 5:47 ` KAMEZAWA Hiroyuki
2006-07-03 21:55 ` [RFC 4/8] Remove display of counters for not available zones Christoph Lameter
` (5 subsequent siblings)
8 siblings, 1 reply; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 21:55 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin,
Christoph Lameter, Andi Kleen
Move highmem counters into highmem.c/.h
Move the totalhigh_pages definition into highmem.c/.h
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.17-mm6/include/linux/highmem.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/highmem.h 2006-07-03 13:47:21.556579985 -0700
+++ linux-2.6.17-mm6/include/linux/highmem.h 2006-07-03 14:03:39.168021629 -0700
@@ -24,11 +24,14 @@ static inline void flush_kernel_dcache_p
/* declarations for linux/mm/highmem.c */
unsigned int nr_free_highpages(void);
+extern unsigned long totalhigh_pages;
#else /* CONFIG_HIGHMEM */
static inline unsigned int nr_free_highpages(void) { return 0; }
+#define totalhigh_pages 0
+
static inline void *kmap(struct page *page)
{
might_sleep();
Index: linux-2.6.17-mm6/include/linux/swap.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/swap.h 2006-07-03 13:47:22.066314085 -0700
+++ linux-2.6.17-mm6/include/linux/swap.h 2006-07-03 14:03:39.168998131 -0700
@@ -162,7 +162,6 @@ extern void swapin_readahead(swp_entry_t
/* linux/mm/page_alloc.c */
extern unsigned long totalram_pages;
-extern unsigned long totalhigh_pages;
extern unsigned long totalreserve_pages;
extern long nr_swap_pages;
extern unsigned int nr_free_pages(void);
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c 2006-07-03 14:03:19.964129358 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c 2006-07-03 14:03:39.170951135 -0700
@@ -51,7 +51,6 @@ EXPORT_SYMBOL(node_online_map);
nodemask_t node_possible_map __read_mostly = NODE_MASK_ALL;
EXPORT_SYMBOL(node_possible_map);
unsigned long totalram_pages __read_mostly;
-unsigned long totalhigh_pages __read_mostly;
unsigned long totalreserve_pages __read_mostly;
long nr_swap_pages;
int percpu_pagelist_fraction;
Index: linux-2.6.17-mm6/mm/shmem.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/shmem.c 2006-07-03 13:47:22.646356337 -0700
+++ linux-2.6.17-mm6/mm/shmem.c 2006-07-03 14:03:39.171927638 -0700
@@ -45,6 +45,7 @@
#include <linux/namei.h>
#include <linux/ctype.h>
#include <linux/migrate.h>
+#include <linux/highmem.h>
#include <asm/uaccess.h>
#include <asm/div64.h>
Index: linux-2.6.17-mm6/mm/highmem.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/highmem.c 2006-07-03 13:47:22.613155266 -0700
+++ linux-2.6.17-mm6/mm/highmem.c 2006-07-03 14:03:39.172904140 -0700
@@ -46,6 +46,7 @@ static void *mempool_alloc_pages_isa(gfp
*/
#ifdef CONFIG_HIGHMEM
+unsigned long totalhigh_pages __read_mostly;
static int pkmap_count[LAST_PKMAP];
static unsigned int last_pkmap_nr;
static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock);
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [RFC 3/8] Move HIGHMEM counter into highmem.c/.h
2006-07-03 21:55 ` [RFC 3/8] Move HIGHMEM counter into highmem.c/.h Christoph Lameter
@ 2006-07-04 5:47 ` KAMEZAWA Hiroyuki
2006-07-04 5:56 ` Christoph Lameter
0 siblings, 1 reply; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-07-04 5:47 UTC (permalink / raw)
To: Christoph Lameter
Cc: linux-kernel, akpm, hugh, kernel, marcelo, nickpiggin, clameter,
ak
On Mon, 3 Jul 2006 14:55:50 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:
> Move highmem counters into highmem.c/.h
>
> Move the totalhigh_pages definition into highmem.c/.h
>
Hi, I love this patch series :)
I found this :
== arch/um/kernel/mem.c ==
void mem_init(void)
{
<snip>
totalhigh_pages = highmem >> PAGE_SHIFT;
....
==
this should be covered by CONFIG_HIGHMEM if you change totalhigh_pages
to be #define.
Regards,
-Kame
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> Index: linux-2.6.17-mm6/include/linux/highmem.h
> ===================================================================
> --- linux-2.6.17-mm6.orig/include/linux/highmem.h 2006-07-03 13:47:21.556579985 -0700
> +++ linux-2.6.17-mm6/include/linux/highmem.h 2006-07-03 14:03:39.168021629 -0700
> @@ -24,11 +24,14 @@ static inline void flush_kernel_dcache_p
>
> /* declarations for linux/mm/highmem.c */
> unsigned int nr_free_highpages(void);
> +extern unsigned long totalhigh_pages;
>
> #else /* CONFIG_HIGHMEM */
>
> static inline unsigned int nr_free_highpages(void) { return 0; }
>
> +#define totalhigh_pages 0
> +
> static inline void *kmap(struct page *page)
> {
> might_sleep();
> Index: linux-2.6.17-mm6/include/linux/swap.h
> ===================================================================
> --- linux-2.6.17-mm6.orig/include/linux/swap.h 2006-07-03 13:47:22.066314085 -0700
> +++ linux-2.6.17-mm6/include/linux/swap.h 2006-07-03 14:03:39.168998131 -0700
> @@ -162,7 +162,6 @@ extern void swapin_readahead(swp_entry_t
>
> /* linux/mm/page_alloc.c */
> extern unsigned long totalram_pages;
> -extern unsigned long totalhigh_pages;
> extern unsigned long totalreserve_pages;
> extern long nr_swap_pages;
> extern unsigned int nr_free_pages(void);
> Index: linux-2.6.17-mm6/mm/page_alloc.c
> ===================================================================
> --- linux-2.6.17-mm6.orig/mm/page_alloc.c 2006-07-03 14:03:19.964129358 -0700
> +++ linux-2.6.17-mm6/mm/page_alloc.c 2006-07-03 14:03:39.170951135 -0700
> @@ -51,7 +51,6 @@ EXPORT_SYMBOL(node_online_map);
> nodemask_t node_possible_map __read_mostly = NODE_MASK_ALL;
> EXPORT_SYMBOL(node_possible_map);
> unsigned long totalram_pages __read_mostly;
> -unsigned long totalhigh_pages __read_mostly;
> unsigned long totalreserve_pages __read_mostly;
> long nr_swap_pages;
> int percpu_pagelist_fraction;
> Index: linux-2.6.17-mm6/mm/shmem.c
> ===================================================================
> --- linux-2.6.17-mm6.orig/mm/shmem.c 2006-07-03 13:47:22.646356337 -0700
> +++ linux-2.6.17-mm6/mm/shmem.c 2006-07-03 14:03:39.171927638 -0700
> @@ -45,6 +45,7 @@
> #include <linux/namei.h>
> #include <linux/ctype.h>
> #include <linux/migrate.h>
> +#include <linux/highmem.h>
>
> #include <asm/uaccess.h>
> #include <asm/div64.h>
> Index: linux-2.6.17-mm6/mm/highmem.c
> ===================================================================
> --- linux-2.6.17-mm6.orig/mm/highmem.c 2006-07-03 13:47:22.613155266 -0700
> +++ linux-2.6.17-mm6/mm/highmem.c 2006-07-03 14:03:39.172904140 -0700
> @@ -46,6 +46,7 @@ static void *mempool_alloc_pages_isa(gfp
> */
> #ifdef CONFIG_HIGHMEM
>
> +unsigned long totalhigh_pages __read_mostly;
> static int pkmap_count[LAST_PKMAP];
> static unsigned int last_pkmap_nr;
> static __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock);
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [RFC 3/8] Move HIGHMEM counter into highmem.c/.h
2006-07-04 5:47 ` KAMEZAWA Hiroyuki
@ 2006-07-04 5:56 ` Christoph Lameter
2006-07-04 6:20 ` Andrew Morton
0 siblings, 1 reply; 32+ messages in thread
From: Christoph Lameter @ 2006-07-04 5:56 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: linux-kernel, akpm, hugh, kernel, marcelo, nickpiggin, ak
On Tue, 4 Jul 2006, KAMEZAWA Hiroyuki wrote:
> Hi, I love this patch series :)
Thanks.
> I found this :
> == arch/um/kernel/mem.c ==
>
> void mem_init(void)
> {
> <snip>
> totalhigh_pages = highmem >> PAGE_SHIFT;
> ....
> ==
> this should be covered by CONFIG_HIGHMEM if you change totalhigh_pages
> to be #define.
Ok. Will put a #ifdef CONFIG_HIGHMEM around that statement and the
following one.
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [RFC 3/8] Move HIGHMEM counter into highmem.c/.h
2006-07-04 5:56 ` Christoph Lameter
@ 2006-07-04 6:20 ` Andrew Morton
2006-07-04 15:20 ` Christoph Lameter
0 siblings, 1 reply; 32+ messages in thread
From: Andrew Morton @ 2006-07-04 6:20 UTC (permalink / raw)
To: Christoph Lameter
Cc: kamezawa.hiroyu, linux-kernel, hugh, kernel, marcelo, nickpiggin,
ak
On Mon, 3 Jul 2006 22:56:36 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:
> > this should be covered by CONFIG_HIGHMEM if you change totalhigh_pages
> > to be #define.
>
> Ok. Will put a #ifdef CONFIG_HIGHMEM around that statement and the
> following one.
That will take the patchset up to 27 new ifdefs. Is there a way of improving
that?
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 3/8] Move HIGHMEM counter into highmem.c/.h
2006-07-04 6:20 ` Andrew Morton
@ 2006-07-04 15:20 ` Christoph Lameter
2006-07-04 16:50 ` Nick Piggin
0 siblings, 1 reply; 32+ messages in thread
From: Christoph Lameter @ 2006-07-04 15:20 UTC (permalink / raw)
To: Andrew Morton
Cc: kamezawa.hiroyu, linux-kernel, hugh, kernel, marcelo, nickpiggin,
ak
On Mon, 3 Jul 2006, Andrew Morton wrote:
> > Ok. Will put a #ifdef CONFIG_HIGHMEM around that statement and the
> > following one.
>
> That will take the patchset up to 27 new ifdefs. Is there a way of improving
> that?
Ideas are welcome. I can put some of the tests for zones together into one
big #ifdef in mmzone.h but otherwise this is going to be difficult.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 3/8] Move HIGHMEM counter into highmem.c/.h
2006-07-04 15:20 ` Christoph Lameter
@ 2006-07-04 16:50 ` Nick Piggin
2006-07-05 0:17 ` KAMEZAWA Hiroyuki
0 siblings, 1 reply; 32+ messages in thread
From: Nick Piggin @ 2006-07-04 16:50 UTC (permalink / raw)
To: Christoph Lameter
Cc: Andrew Morton, kamezawa.hiroyu, linux-kernel, hugh, kernel,
marcelo, ak
Christoph Lameter wrote:
> On Mon, 3 Jul 2006, Andrew Morton wrote:
>
>
>>>Ok. Will put a #ifdef CONFIG_HIGHMEM around that statement and the
>>>following one.
>>
>>That will take the patchset up to 27 new ifdefs. Is there a way of improving
>>that?
>
>
> Ideas are welcome. I can put some of the tests for zones together into one
> big #ifdef in mmzone.h but otherwise this is going to be difficult.
I don't think there's much point. They all look pretty straightforward,
and if you try doing something fancy it might just make it more fragile
or harder to read.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 3/8] Move HIGHMEM counter into highmem.c/.h
2006-07-04 16:50 ` Nick Piggin
@ 2006-07-05 0:17 ` KAMEZAWA Hiroyuki
0 siblings, 0 replies; 32+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-07-05 0:17 UTC (permalink / raw)
To: Nick Piggin; +Cc: clameter, akpm, linux-kernel, hugh, kernel, marcelo, ak
On Wed, 05 Jul 2006 02:50:32 +1000
Nick Piggin <nickpiggin@yahoo.com.au> wrote:
> Christoph Lameter wrote:
> > On Mon, 3 Jul 2006, Andrew Morton wrote:
> >
> >
> >>>Ok. Will put a #ifdef CONFIG_HIGHMEM around that statement and the
> >>>following one.
> >>
> >>That will take the patchset up to 27 new ifdefs. Is there a way of improving
> >>that?
> >
> >
> > Ideas are welcome. I can put some of the tests for zones together into one
> > big #ifdef in mmzone.h but otherwise this is going to be difficult.
>
> I don't think there's much point. They all look pretty straightforward,
> and if you try doing something fancy it might just make it more fragile
> or harder to read.
>
just one point.
I'm not sure dropping "printing HIGHMEM statistics" stuff is good or not.
It is shown in /proc/meminfo even if CONFIG_HIGHMEM=n now. this will change look
of user interface a bit. but maybe not so important ....
-Kame
^ permalink raw reply [flat|nested] 32+ messages in thread
* [RFC 4/8] Remove display of counters for not available zones
2006-07-03 21:55 [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Lameter
` (2 preceding siblings ...)
2006-07-03 21:55 ` [RFC 3/8] Move HIGHMEM counter into highmem.c/.h Christoph Lameter
@ 2006-07-03 21:55 ` Christoph Lameter
2006-07-03 21:56 ` [RFC 5/8] swap_prefetch: Make use of ZONE_HIGHMEM dependend on CONFIG_HIGHMEM Christoph Lameter
` (4 subsequent siblings)
8 siblings, 0 replies; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 21:55 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin,
Christoph Lameter, Andi Kleen
eventcounters: Do not display counters for zones that are not available on an arch
Remove the counter display for all zones that are not in use.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.17-mm6/include/linux/vmstat.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/vmstat.h 2006-07-03 13:58:32.623475826 -0700
+++ linux-2.6.17-mm6/include/linux/vmstat.h 2006-07-03 14:04:27.383794230 -0700
@@ -18,7 +18,17 @@
* generated will simply be the increment of a global address.
*/
-#define FOR_ALL_ZONES(x) x##_DMA, x##_DMA32, x##_NORMAL, x##_HIGH
+#ifdef CONFIG_DMA32
+#define FOR_ALL_LOWER_ZONES(xx) xx##_DMA, xx##_DMA32, xx##_NORMAL
+#else
+#define FOR_ALL_LOWER_ZONES(xx) xx##_DMA, xx##_NORMAL
+#endif
+
+#ifdef CONFIG_HIGHMEM
+#define FOR_ALL_ZONES(xx) FOR_ALL_LOWER_ZONES(xx), xx##_HIGH
+#else
+#define FOR_ALL_ZONES(xx) FOR_ALL_LOWER_ZONES(xx)
+#endif
enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
FOR_ALL_ZONES(PGALLOC),
Index: linux-2.6.17-mm6/mm/vmstat.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/vmstat.c 2006-07-03 13:47:22.663933375 -0700
+++ linux-2.6.17-mm6/mm/vmstat.c 2006-07-03 14:04:27.383794230 -0700
@@ -381,6 +381,18 @@ struct seq_operations fragmentation_op =
.show = frag_show,
};
+#ifdef CONFIG_ZONE_DMA32
+#define TEXTS_FOR_LOWER_ZONES(xx) xx "_dma", xx "_dma32", xx "_normal"
+#else
+#define TEXTS_FOR_LOWER_ZONES(xx) xx "_dma", xx "_normal"
+#endif
+
+#ifdef CONFIG_HIGHMEM
+#define TEXTS_FOR_ZONES(xx) TEXTS_FOR_LOWER_ZONES(xx), xx "_high"
+#else
+#define TEXTS_FOR_ZONES(xx) TEXTS_FOR_LOWER_ZONES(xx)
+#endif
+
static char *vmstat_text[] = {
/* Zoned VM counters */
"nr_anon_pages",
@@ -408,10 +420,7 @@ static char *vmstat_text[] = {
"pswpin",
"pswpout",
- "pgalloc_dma",
- "pgalloc_dma32",
- "pgalloc_normal",
- "pgalloc_high",
+ TEXTS_FOR_ZONES("pgalloc"),
"pgfree",
"pgactivate",
@@ -420,25 +429,10 @@ static char *vmstat_text[] = {
"pgfault",
"pgmajfault",
- "pgrefill_dma",
- "pgrefill_dma32",
- "pgrefill_normal",
- "pgrefill_high",
-
- "pgsteal_dma",
- "pgsteal_dma32",
- "pgsteal_normal",
- "pgsteal_high",
-
- "pgscan_kswapd_dma",
- "pgscan_kswapd_dma32",
- "pgscan_kswapd_normal",
- "pgscan_kswapd_high",
-
- "pgscan_direct_dma",
- "pgscan_direct_dma32",
- "pgscan_direct_normal",
- "pgscan_direct_high",
+ TEXTS_FOR_ZONES("pgrefill"),
+ TEXTS_FOR_ZONES("pgsteal"),
+ TEXTS_FOR_ZONES("pgscan_kswapd"),
+ TEXTS_FOR_ZONES("pgscan_direct"),
"pginodesteal",
"slabs_scanned",
^ permalink raw reply [flat|nested] 32+ messages in thread* [RFC 5/8] swap_prefetch: Make use of ZONE_HIGHMEM dependend on CONFIG_HIGHMEM
2006-07-03 21:55 [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Lameter
` (3 preceding siblings ...)
2006-07-03 21:55 ` [RFC 4/8] Remove display of counters for not available zones Christoph Lameter
@ 2006-07-03 21:56 ` Christoph Lameter
2006-07-03 21:56 ` [RFC 6/8] Fix MAX_NR_ZONES array initializations in various arches Christoph Lameter
` (3 subsequent siblings)
8 siblings, 0 replies; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 21:56 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin,
Christoph Lameter, Andi Kleen
swap_prefetch: Make use of ZONE_HIGHMEM conditional
swap prefetch uses ZONE_HIGHMEM even if CONFIG_HIGHMEM is off. Make
that use conditional.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.17/mm/swap_prefetch.c
===================================================================
--- linux-2.6.17.orig/mm/swap_prefetch.c 2006-07-03 13:11:06.000000000 -0700
+++ linux-2.6.17/mm/swap_prefetch.c 2006-07-03 13:12:08.000000000 -0700
@@ -277,8 +277,10 @@
ns = &sp_stat.node[z->zone_pgdat->node_id];
idx = zone_idx(z);
- ns->lowfree[idx] = z->pages_high * 3 +
- z->lowmem_reserve[ZONE_HIGHMEM];
+ ns->lowfree[idx] = z->pages_high * 3;
+#ifdef CONFIG_HIGHMEM
+ ns->lowfree[idx] += z->lowmem_reserve[ZONE_HIGHMEM];
+#endif
ns->highfree[idx] = ns->lowfree[idx] + z->pages_high;
if (z->free_pages > ns->highfree[idx]) {
^ permalink raw reply [flat|nested] 32+ messages in thread* [RFC 6/8] Fix MAX_NR_ZONES array initializations in various arches
2006-07-03 21:55 [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Lameter
` (4 preceding siblings ...)
2006-07-03 21:56 ` [RFC 5/8] swap_prefetch: Make use of ZONE_HIGHMEM dependend on CONFIG_HIGHMEM Christoph Lameter
@ 2006-07-03 21:56 ` Christoph Lameter
2006-07-03 21:56 ` [RFC 7/8] Fix strange uses of MAX_NR_ZONES Christoph Lameter
` (2 subsequent siblings)
8 siblings, 0 replies; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 21:56 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin,
Christoph Lameter, Andi Kleen
Fix array initialization in lots of arches
The number of zones may now be reduced from 4 to 2 for many arches. Fix the
array initialization so that it is not initializing 3 elements.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.17-mm6/arch/sh64/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/sh64/mm/init.c 2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-mm6/arch/sh64/mm/init.c 2006-07-03 14:30:12.661342570 -0700
@@ -110,7 +110,7 @@ void show_mem(void)
*/
void __init paging_init(void)
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = {0, };
pgd_init((unsigned long)swapper_pg_dir);
pgd_init((unsigned long)swapper_pg_dir +
Index: linux-2.6.17-mm6/arch/m32r/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/m32r/mm/init.c 2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-mm6/arch/m32r/mm/init.c 2006-07-03 14:30:12.656460059 -0700
@@ -100,7 +100,7 @@ void free_initrd_mem(unsigned long, unsi
#ifndef CONFIG_DISCONTIGMEM
unsigned long __init zone_sizes_init(void)
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = {0, };
unsigned long max_dma;
unsigned long low;
unsigned long start_pfn;
Index: linux-2.6.17-mm6/arch/parisc/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/parisc/mm/init.c 2006-07-03 13:47:13.329549726 -0700
+++ linux-2.6.17-mm6/arch/parisc/mm/init.c 2006-07-03 14:30:12.660366068 -0700
@@ -809,7 +809,7 @@ void __init paging_init(void)
flush_tlb_all_local(NULL);
for (i = 0; i < npmem_ranges; i++) {
- unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0 };
+ unsigned long zones_size[MAX_NR_ZONES] = { 0, };
/* We have an IOMMU, so all memory can go into a single
ZONE_DMA zone. */
Index: linux-2.6.17-mm6/arch/i386/kernel/setup.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/kernel/setup.c 2006-07-03 13:47:12.664551790 -0700
+++ linux-2.6.17-mm6/arch/i386/kernel/setup.c 2006-07-03 14:31:05.813329367 -0700
@@ -1201,7 +1201,7 @@ static unsigned long __init setup_memory
void __init zone_sizes_init(void)
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = { 0, };
unsigned int max_dma, low;
max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
Index: linux-2.6.17-mm6/arch/m68knommu/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/m68knommu/mm/init.c 2006-07-03 13:47:12.941878389 -0700
+++ linux-2.6.17-mm6/arch/m68knommu/mm/init.c 2006-07-03 14:30:12.657436561 -0700
@@ -136,7 +136,7 @@ void paging_init(void)
#endif
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = {0, };
zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT;
zones_size[ZONE_NORMAL] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
Index: linux-2.6.17-mm6/arch/mips/sgi-ip27/ip27-memory.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/mips/sgi-ip27/ip27-memory.c 2006-07-03 13:47:13.274865608 -0700
+++ linux-2.6.17-mm6/arch/mips/sgi-ip27/ip27-memory.c 2006-07-03 14:30:12.659389566 -0700
@@ -508,7 +508,7 @@ extern unsigned long setup_zero_pages(vo
void __init paging_init(void)
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = {0, };
unsigned node;
pagetable_init();
Index: linux-2.6.17-mm6/arch/frv/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/frv/mm/init.c 2006-07-03 13:47:12.538583018 -0700
+++ linux-2.6.17-mm6/arch/frv/mm/init.c 2006-07-03 14:30:12.654507055 -0700
@@ -98,7 +98,7 @@ void show_mem(void)
*/
void __init paging_init(void)
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = {0, };
/* allocate some pages for kernel housekeeping tasks */
empty_bad_page_table = (unsigned long) alloc_bootmem_pages(PAGE_SIZE);
Index: linux-2.6.17-mm6/arch/h8300/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/h8300/mm/init.c 2006-07-03 13:47:12.550301044 -0700
+++ linux-2.6.17-mm6/arch/h8300/mm/init.c 2006-07-03 14:30:12.655483557 -0700
@@ -138,7 +138,7 @@ void paging_init(void)
#endif
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = {0, };
zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT;
zones_size[ZONE_NORMAL] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
Index: linux-2.6.17-mm6/arch/mips/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/mips/mm/init.c 2006-07-03 13:47:13.195768937 -0700
+++ linux-2.6.17-mm6/arch/mips/mm/init.c 2006-07-03 14:30:12.658413063 -0700
@@ -141,7 +141,7 @@ extern void pagetable_init(void);
void __init paging_init(void)
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = {0, };
unsigned long max_dma, high, low;
pagetable_init();
Index: linux-2.6.17-mm6/arch/alpha/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/alpha/mm/init.c 2006-07-03 13:47:11.897021133 -0700
+++ linux-2.6.17-mm6/arch/alpha/mm/init.c 2006-07-03 14:31:05.814305869 -0700
@@ -270,7 +270,7 @@ callback_init(void * kernel_end)
void
paging_init(void)
{
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = {0, };
unsigned long dma_pfn, high_pfn;
dma_pfn = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
Index: linux-2.6.17-mm6/arch/i386/mm/discontig.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/mm/discontig.c 2006-07-03 13:47:12.735836444 -0700
+++ linux-2.6.17-mm6/arch/i386/mm/discontig.c 2006-07-03 14:31:05.815282371 -0700
@@ -354,7 +354,7 @@ void __init zone_sizes_init(void)
for_each_online_node(nid) {
- unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+ unsigned long zones_size[MAX_NR_ZONES] = {0, };
unsigned long *zholes_size;
unsigned int max_dma;
^ permalink raw reply [flat|nested] 32+ messages in thread* [RFC 7/8] Fix strange uses of MAX_NR_ZONES
2006-07-03 21:55 [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Lameter
` (5 preceding siblings ...)
2006-07-03 21:56 ` [RFC 6/8] Fix MAX_NR_ZONES array initializations in various arches Christoph Lameter
@ 2006-07-03 21:56 ` Christoph Lameter
2006-07-03 21:56 ` [RFC 8/8] Fix i386 SRAT check for MAX_NR_ZONES Christoph Lameter
2006-07-03 22:17 ` [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Hellwig
8 siblings, 0 replies; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 21:56 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin,
Christoph Lameter, Andi Kleen
Fix strange uses of MAX_NR_ZONES
Sometimes we use MAX_NR_ZONES - x to refer to a zone. Make that
explicit.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.17-mm6/arch/x86_64/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/x86_64/mm/init.c 2006-07-03 13:47:14.329487884 -0700
+++ linux-2.6.17-mm6/arch/x86_64/mm/init.c 2006-07-03 14:33:13.479261596 -0700
@@ -536,7 +536,7 @@ int memory_add_physaddr_to_nid(u64 start
int arch_add_memory(int nid, u64 start, u64 size)
{
struct pglist_data *pgdat = NODE_DATA(nid);
- struct zone *zone = pgdat->node_zones + MAX_NR_ZONES-2;
+ struct zone *zone = pgdat->node_zones + ZONE_NORMAL;
unsigned long start_pfn = start >> PAGE_SHIFT;
unsigned long nr_pages = size >> PAGE_SHIFT;
int ret;
Index: linux-2.6.17-mm6/arch/i386/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/mm/init.c 2006-07-03 13:47:12.740718955 -0700
+++ linux-2.6.17-mm6/arch/i386/mm/init.c 2006-07-03 14:33:13.481214600 -0700
@@ -657,7 +657,7 @@ void __init mem_init(void)
int arch_add_memory(int nid, u64 start, u64 size)
{
struct pglist_data *pgdata = &contig_page_data;
- struct zone *zone = pgdata->node_zones + MAX_NR_ZONES-1;
+ struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM;
unsigned long start_pfn = start >> PAGE_SHIFT;
unsigned long nr_pages = size >> PAGE_SHIFT;
^ permalink raw reply [flat|nested] 32+ messages in thread* [RFC 8/8] Fix i386 SRAT check for MAX_NR_ZONES
2006-07-03 21:55 [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Lameter
` (6 preceding siblings ...)
2006-07-03 21:56 ` [RFC 7/8] Fix strange uses of MAX_NR_ZONES Christoph Lameter
@ 2006-07-03 21:56 ` Christoph Lameter
2006-07-04 5:52 ` KAMEZAWA Hiroyuki
2006-07-03 22:17 ` [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Hellwig
8 siblings, 1 reply; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 21:56 UTC (permalink / raw)
To: linux-kernel
Cc: akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin,
Christoph Lameter, Andi Kleen
swap_prefetch: Make use of ZONE_HIGHMEM conditional
swap prefetch uses ZONE_HIGHMEM even if CONFIG_HIGHMEM is off. Make
that use conditional.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.17/mm/swap_prefetch.c
===================================================================
--- linux-2.6.17.orig/mm/swap_prefetch.c 2006-07-03 13:11:06.000000000 -0700
+++ linux-2.6.17/mm/swap_prefetch.c 2006-07-03 13:12:08.000000000 -0700
@@ -277,8 +277,10 @@
ns = &sp_stat.node[z->zone_pgdat->node_id];
idx = zone_idx(z);
- ns->lowfree[idx] = z->pages_high * 3 +
- z->lowmem_reserve[ZONE_HIGHMEM];
+ ns->lowfree[idx] = z->pages_high * 3;
+#ifdef CONFIG_HIGHMEM
+ ns->lowfree[idx] += z->lowmem_reserve[ZONE_HIGHMEM];
+#endif
ns->highfree[idx] = ns->lowfree[idx] + z->pages_high;
if (z->free_pages > ns->highfree[idx]) {
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-03 21:55 [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Lameter
` (7 preceding siblings ...)
2006-07-03 21:56 ` [RFC 8/8] Fix i386 SRAT check for MAX_NR_ZONES Christoph Lameter
@ 2006-07-03 22:17 ` Christoph Hellwig
2006-07-03 23:26 ` Christoph Lameter
8 siblings, 1 reply; 32+ messages in thread
From: Christoph Hellwig @ 2006-07-03 22:17 UTC (permalink / raw)
To: Christoph Lameter
Cc: linux-kernel, akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti,
Nick Piggin, Andi Kleen
On Mon, Jul 03, 2006 at 02:55:34PM -0700, Christoph Lameter wrote:
> I keep seeing zones on various platforms that are never used and wonder
> why we compile support for them into the kernel.
>
> IA64 on SGI for example only uses ZONE_DMA other IA64 platforms can
> also use ZONE_NORMAL.
Which btw is utterly wrong. It should have a 4GB ZONE_DMA32 and everything
else in ZONE_NORMAL.
That doesn't mean I want to discourage this patchset, quite contrary.
But please fix this oddity aswell.
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-03 22:17 ` [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones Christoph Hellwig
@ 2006-07-03 23:26 ` Christoph Lameter
2006-07-03 23:47 ` Andi Kleen
2006-07-04 12:02 ` Christoph Hellwig
0 siblings, 2 replies; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 23:26 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-kernel, akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti,
Nick Piggin, Andi Kleen
On Mon, 3 Jul 2006, Christoph Hellwig wrote:
> On Mon, Jul 03, 2006 at 02:55:34PM -0700, Christoph Lameter wrote:
> > I keep seeing zones on various platforms that are never used and wonder
> > why we compile support for them into the kernel.
> >
> > IA64 on SGI for example only uses ZONE_DMA other IA64 platforms can
> > also use ZONE_NORMAL.
>
> Which btw is utterly wrong. It should have a 4GB ZONE_DMA32 and everything
> else in ZONE_NORMAL.
So we want to change the definition of ZONE_DMA to refer to the first 16MB
only? ZONE_DMA32 is always a 4GB border? (Andy disagrees about DMA32 see
his message!).
It seems to me that DMA can be run on ZONE_NORMAL. ZONE_DMAxx is used for
situations in which DMA cannot be done to all of memory. ZONE_DMA allows
an architecture to define a single exception zone that ends at
MAX_DMA_ADDRESS (which is arch specific).
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-03 23:26 ` Christoph Lameter
@ 2006-07-03 23:47 ` Andi Kleen
2006-07-03 23:53 ` Christoph Lameter
2006-07-04 12:04 ` Christoph Hellwig
2006-07-04 12:02 ` Christoph Hellwig
1 sibling, 2 replies; 32+ messages in thread
From: Andi Kleen @ 2006-07-03 23:47 UTC (permalink / raw)
To: Christoph Lameter
Cc: Christoph Hellwig, linux-kernel, akpm, Hugh Dickins, Con Kolivas,
Marcelo Tosatti, Nick Piggin
> So we want to change the definition of ZONE_DMA to refer to the first 16MB
> only? ZONE_DMA32 is always a 4GB border? (Andy disagrees about DMA32 see
> his message!).
Hmm? I didn't write anything about DMA32. Just noted a minor comment thinko about
highmem.
> It seems to me that DMA can be run on ZONE_NORMAL. ZONE_DMAxx is used for
> situations in which DMA cannot be done to all of memory. ZONE_DMA allows
> an architecture to define a single exception zone that ends at
> MAX_DMA_ADDRESS (which is arch specific).
It's really architecture dependent. The portable interfaces are
dma_alloc_* and suitable device masks and the architecture should sort
out then what zone to use.
I would say nearly everybody who uses GFP_DMA directly outside
{arch,asm}/* is wrong.
-Andi
^ permalink raw reply [flat|nested] 32+ messages in thread* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-03 23:47 ` Andi Kleen
@ 2006-07-03 23:53 ` Christoph Lameter
2006-07-04 12:04 ` Christoph Hellwig
1 sibling, 0 replies; 32+ messages in thread
From: Christoph Lameter @ 2006-07-03 23:53 UTC (permalink / raw)
To: Andi Kleen
Cc: Christoph Hellwig, linux-kernel, akpm, Hugh Dickins, Con Kolivas,
Marcelo Tosatti, Nick Piggin
On Tue, 4 Jul 2006, Andi Kleen wrote:
>
> > So we want to change the definition of ZONE_DMA to refer to the first 16MB
> > only? ZONE_DMA32 is always a 4GB border? (Andy disagrees about DMA32 see
> > his message!).
>
> Hmm? I didn't write anything about DMA32. Just noted a minor comment thinko about
> highmem.
The message was addressed to Christoph. You were only CCed. I fixed the
issue you mentioined before. Thanks.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-03 23:47 ` Andi Kleen
2006-07-03 23:53 ` Christoph Lameter
@ 2006-07-04 12:04 ` Christoph Hellwig
1 sibling, 0 replies; 32+ messages in thread
From: Christoph Hellwig @ 2006-07-04 12:04 UTC (permalink / raw)
To: Andi Kleen
Cc: Christoph Lameter, Christoph Hellwig, linux-kernel, akpm,
Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin
On Tue, Jul 04, 2006 at 01:47:10AM +0200, Andi Kleen wrote:
> It's really architecture dependent. The portable interfaces are
> dma_alloc_* and suitable device masks and the architecture should sort
> out then what zone to use.
Well, there's some cases where you don't want coherent mappings but
rather alloc_page + dma_map_*. And having a ZONE_DMA32 that is valid
on all architectures is very valueable for that.
I remember James promised a kmalloc_mask a last Kernel Summit that would
many things easier, but even than having predictable memory zone layouts
overy different architectures is a win.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-03 23:26 ` Christoph Lameter
2006-07-03 23:47 ` Andi Kleen
@ 2006-07-04 12:02 ` Christoph Hellwig
2006-07-04 15:10 ` Christoph Lameter
1 sibling, 1 reply; 32+ messages in thread
From: Christoph Hellwig @ 2006-07-04 12:02 UTC (permalink / raw)
To: Christoph Lameter
Cc: Christoph Hellwig, linux-kernel, akpm, Hugh Dickins, Con Kolivas,
Marcelo Tosatti, Nick Piggin, Andi Kleen
On Mon, Jul 03, 2006 at 04:26:57PM -0700, Christoph Lameter wrote:
> > Which btw is utterly wrong. It should have a 4GB ZONE_DMA32 and everything
> > else in ZONE_NORMAL.
>
> So we want to change the definition of ZONE_DMA to refer to the first 16MB
> only? ZONE_DMA32 is always a 4GB border?
The definition of ZONE_DMA32 is to be te 32bit border. I think we should
implement it wherever possible but at least on all architectures that
maybe have non-iommu implementations. ZONE_DMA should be an arch-specific
low memory zone.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-04 12:02 ` Christoph Hellwig
@ 2006-07-04 15:10 ` Christoph Lameter
2006-07-04 15:23 ` Andi Kleen
0 siblings, 1 reply; 32+ messages in thread
From: Christoph Lameter @ 2006-07-04 15:10 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-kernel, akpm, Hugh Dickins, Con Kolivas, Marcelo Tosatti,
Nick Piggin, Andi Kleen
On Tue, 4 Jul 2006, Christoph Hellwig wrote:
> On Mon, Jul 03, 2006 at 04:26:57PM -0700, Christoph Lameter wrote:
> > > Which btw is utterly wrong. It should have a 4GB ZONE_DMA32 and everything
> > > else in ZONE_NORMAL.
> >
> > So we want to change the definition of ZONE_DMA to refer to the first 16MB
> > only? ZONE_DMA32 is always a 4GB border?
>
> The definition of ZONE_DMA32 is to be te 32bit border. I think we should
> implement it wherever possible but at least on all architectures that
> maybe have non-iommu implementations. ZONE_DMA should be an arch-specific
> low memory zone.
I guess then we should drop ZONE_DMA (its a misnoner anyways since it
seems to indicate that DMA is only possible in this zone). Instead use
ZONE_ISA_DMA -> ISA DMA Area (16 MB boundary)
ZONE_32BIT_DMA -> 32bit DMA area (well 900 MB on x86_64 but somewhere in that area)
only used for 64 bit platforms with 32 bit devices.
<and maybe define new ones in the future?>
Some arches seem to make ZONE_DMA their default zone instead of
ZONE_NORMAL if DMA is possible to all of memory. I think in that case we
should have no ZONE_DMA at all.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-04 15:10 ` Christoph Lameter
@ 2006-07-04 15:23 ` Andi Kleen
2006-07-04 16:16 ` Christoph Lameter
0 siblings, 1 reply; 32+ messages in thread
From: Andi Kleen @ 2006-07-04 15:23 UTC (permalink / raw)
To: Christoph Lameter
Cc: Christoph Hellwig, linux-kernel, akpm, Hugh Dickins, Con Kolivas,
Marcelo Tosatti, Nick Piggin
> I guess then we should drop ZONE_DMA (its a misnoner anyways since it
> seems to indicate that DMA is only possible in this zone). Instead use
>
> ZONE_ISA_DMA -> ISA DMA Area (16 MB boundary)
> ZONE_32BIT_DMA -> 32bit DMA area (well 900 MB on x86_64 but somewhere in that area)
It's 4GB on x86-64.
The 900MB refered to the boundary between NORMAL and HIGHMEM on i386.
-Andi
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-04 15:23 ` Andi Kleen
@ 2006-07-04 16:16 ` Christoph Lameter
2006-07-04 16:23 ` Arjan van de Ven
2006-07-04 16:25 ` Andi Kleen
0 siblings, 2 replies; 32+ messages in thread
From: Christoph Lameter @ 2006-07-04 16:16 UTC (permalink / raw)
To: Andi Kleen
Cc: Christoph Hellwig, linux-kernel, akpm, Hugh Dickins, Con Kolivas,
Marcelo Tosatti, Nick Piggin
On Tue, 4 Jul 2006, Andi Kleen wrote:
> The 900MB refered to the boundary between NORMAL and HIGHMEM on i386.
Yikes. So any system with 1MB will need to have highmem? I guess the 2G/2G
config option changes that?
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-04 16:16 ` Christoph Lameter
@ 2006-07-04 16:23 ` Arjan van de Ven
2006-07-04 16:41 ` Christoph Lameter
2006-07-04 16:25 ` Andi Kleen
1 sibling, 1 reply; 32+ messages in thread
From: Arjan van de Ven @ 2006-07-04 16:23 UTC (permalink / raw)
To: Christoph Lameter
Cc: Andi Kleen, Christoph Hellwig, linux-kernel, akpm, Hugh Dickins,
Con Kolivas, Marcelo Tosatti, Nick Piggin
On Tue, 2006-07-04 at 09:16 -0700, Christoph Lameter wrote:
> On Tue, 4 Jul 2006, Andi Kleen wrote:
>
> > The 900MB refered to the boundary between NORMAL and HIGHMEM on i386.
>
> Yikes. So any system with 1MB
1G, but yes.
> will need to have highmem? I guess the 2G/2G
> config option changes that?
but that breaks userspace ABI and things that really want a lot of
memory ;)
Thankfully x86-64 is there, and just about all systems sold today do 64
bit..
(and highmem is not that bad.. you make it sound as if it's a dirty
word. It's not pretty but it's not THAT evil either)
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-04 16:23 ` Arjan van de Ven
@ 2006-07-04 16:41 ` Christoph Lameter
2006-07-04 16:47 ` Arjan van de Ven
2006-07-04 16:52 ` Andi Kleen
0 siblings, 2 replies; 32+ messages in thread
From: Christoph Lameter @ 2006-07-04 16:41 UTC (permalink / raw)
To: Arjan van de Ven
Cc: Andi Kleen, Christoph Hellwig, linux-kernel, akpm, Hugh Dickins,
Con Kolivas, Marcelo Tosatti, Nick Piggin
On Tue, 4 Jul 2006, Arjan van de Ven wrote:
> > will need to have highmem? I guess the 2G/2G
> > config option changes that?
>
> but that breaks userspace ABI and things that really want a lot of
> memory ;)
Really? What things does it break? Sorry about my i386 ignorance.
> Thankfully x86-64 is there, and just about all systems sold today do 64
> bit..
Right but then some binary stuff is only available for 32 bit.
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-04 16:41 ` Christoph Lameter
@ 2006-07-04 16:47 ` Arjan van de Ven
2006-07-04 16:52 ` Andi Kleen
1 sibling, 0 replies; 32+ messages in thread
From: Arjan van de Ven @ 2006-07-04 16:47 UTC (permalink / raw)
To: Christoph Lameter
Cc: Andi Kleen, Christoph Hellwig, linux-kernel, akpm, Hugh Dickins,
Con Kolivas, Marcelo Tosatti, Nick Piggin
On Tue, 2006-07-04 at 09:41 -0700, Christoph Lameter wrote:
> On Tue, 4 Jul 2006, Arjan van de Ven wrote:
>
> > > will need to have highmem? I guess the 2G/2G
> > > config option changes that?
> >
> > but that breaks userspace ABI and things that really want a lot of
> > memory ;)
>
> Really? What things does it break? Sorry about my i386 ignorance.
things that assume you can malloc a 2gb area for example, or use a 2Gb
stack. Yes fortran apps do that..
>
> > Thankfully x86-64 is there, and just about all systems sold today do 64
> > bit..
>
> Right but then some binary stuff is only available for 32 bit.
the good news is that x86-64 has a pretty good 32 bit emulation... so
that's not an actual problem...
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-04 16:41 ` Christoph Lameter
2006-07-04 16:47 ` Arjan van de Ven
@ 2006-07-04 16:52 ` Andi Kleen
1 sibling, 0 replies; 32+ messages in thread
From: Andi Kleen @ 2006-07-04 16:52 UTC (permalink / raw)
To: Christoph Lameter
Cc: Arjan van de Ven, Christoph Hellwig, linux-kernel, akpm,
Hugh Dickins, Con Kolivas, Marcelo Tosatti, Nick Piggin
On Tuesday 04 July 2006 18:41, Christoph Lameter wrote:
> On Tue, 4 Jul 2006, Arjan van de Ven wrote:
>
> > > will need to have highmem? I guess the 2G/2G
> > > config option changes that?
> >
> > but that breaks userspace ABI and things that really want a lot of
> > memory ;)
>
> Really? What things does it break? Sorry about my i386 ignorance.
There are programs who make address space assumptions for whatever reason.
When you only have 3GB it is precious space.
e.g. old Java also breaks when the AS is larger as on x86-64. That is why
there is a 3GB personality.
>
> > Thankfully x86-64 is there, and just about all systems sold today do 64
> > bit..
>
> Right but then some binary stuff is only available for 32 bit.
That's fine - the x86-64 kernel runs 32bit programs.
-Andi
^ permalink raw reply [flat|nested] 32+ messages in thread
* Re: [RFC 0/8] Reduce MAX_NR_ZONES and remove useless zones.
2006-07-04 16:16 ` Christoph Lameter
2006-07-04 16:23 ` Arjan van de Ven
@ 2006-07-04 16:25 ` Andi Kleen
1 sibling, 0 replies; 32+ messages in thread
From: Andi Kleen @ 2006-07-04 16:25 UTC (permalink / raw)
To: Christoph Lameter
Cc: Christoph Hellwig, linux-kernel, akpm, Hugh Dickins, Con Kolivas,
Marcelo Tosatti, Nick Piggin
On Tuesday 04 July 2006 18:16, Christoph Lameter wrote:
> On Tue, 4 Jul 2006, Andi Kleen wrote:
>
> > The 900MB refered to the boundary between NORMAL and HIGHMEM on i386.
>
> Yikes. So any system with 1MB will need to have highmem?
No. But a 1GB system will.
> I guess the 2G/2G config option changes that?
Yes, but it also breaks a lot of software.
-Andi
^ permalink raw reply [flat|nested] 32+ messages in thread