patch-2.4.23 linux-2.4.23/include/linux/mmzone.h
Next file: linux-2.4.23/include/linux/net.h
Previous file: linux-2.4.23/include/linux/mm.h
Back to the patch index
Back to the overall index
- Lines: 80
- Date:
2003-11-28 10:26:21.000000000 -0800
- Orig file:
linux-2.4.22/include/linux/mmzone.h
- Orig date:
2002-11-28 15:53:15.000000000 -0800
diff -urN linux-2.4.22/include/linux/mmzone.h linux-2.4.23/include/linux/mmzone.h
@@ -19,6 +19,11 @@
#define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER
#endif
+#define ZONE_DMA 0
+#define ZONE_NORMAL 1
+#define ZONE_HIGHMEM 2
+#define MAX_NR_ZONES 3
+
typedef struct free_area_struct {
struct list_head free_list;
unsigned long *map;
@@ -26,6 +31,11 @@
struct pglist_data;
+typedef struct zone_watermarks_s {
+ unsigned long min, low, high;
+} zone_watermarks_t;
+
+
/*
* On machines where it is needed (eg PCs) we divide physical memory
* into multiple physical zones. On a PC we have 3 zones:
@@ -40,8 +50,27 @@
*/
spinlock_t lock;
unsigned long free_pages;
- unsigned long pages_min, pages_low, pages_high;
- int need_balance;
+ /*
+ * We don't know if the memory that we're going to allocate will be freeable
+ * or/and it will be released eventually, so to avoid totally wasting several
+ * GB of ram we must reserve some of the lower zone memory (otherwise we risk
+ * to run OOM on the lower zones despite there's tons of freeable ram
+ * on the higher zones).
+ */
+ zone_watermarks_t watermarks[MAX_NR_ZONES];
+
+ /*
+ * The below fields are protected by different locks (or by
+ * no lock at all like need_balance), so they're longs to
+ * provide an atomic granularity against each other on
+ * all architectures.
+ */
+ unsigned long need_balance;
+ /* protected by the pagemap_lru_lock */
+ unsigned long nr_active_pages, nr_inactive_pages;
+ /* protected by the pagecache_lock */
+ unsigned long nr_cache_pages;
+
/*
* free areas of different sizes
@@ -90,13 +119,9 @@
*/
char *name;
unsigned long size;
+ unsigned long realsize;
} zone_t;
-#define ZONE_DMA 0
-#define ZONE_NORMAL 1
-#define ZONE_HIGHMEM 2
-#define MAX_NR_ZONES 3
-
/*
* One allocation request operates on a zonelist. A zonelist
* is a list of zones, the first one is the 'goal' of the
@@ -143,8 +168,8 @@
extern int numnodes;
extern pg_data_t *pgdat_list;
-#define memclass(pgzone, classzone) (((pgzone)->zone_pgdat == (classzone)->zone_pgdat) \
- && ((pgzone) <= (classzone)))
+#define zone_idx(zone) ((zone) - (zone)->zone_pgdat->node_zones)
+#define memclass(pgzone, classzone) (zone_idx(pgzone) <= zone_idx(classzone))
/*
* The following two are not meant for general usage. They are here as
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)