mm/page_alloc: convert per-cpu list protection to local_lock
[linux-2.6-microblaze.git] / include / linux / mmzone.h
index 0d53eba..0d6bb73 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/atomic.h>
 #include <linux/mm_types.h>
 #include <linux/page-flags.h>
+#include <linux/local_lock.h>
 #include <asm/page.h>
 
 /* Free memory management - zoned buddy allocator.  */
@@ -337,24 +338,26 @@ enum zone_watermarks {
 #define high_wmark_pages(z) (z->_watermark[WMARK_HIGH] + z->watermark_boost)
 #define wmark_pages(z, i) (z->_watermark[i] + z->watermark_boost)
 
+/* Fields and list protected by pagesets local_lock in page_alloc.c */
 struct per_cpu_pages {
        int count;              /* number of pages in the list */
        int high;               /* high watermark, emptying needed */
        int batch;              /* chunk size for buddy add/remove */
+#ifdef CONFIG_NUMA
+       int expire;             /* When 0, remote pagesets are drained */
+#endif
 
        /* Lists of pages, one per migrate type stored on the pcp-lists */
        struct list_head lists[MIGRATE_PCPTYPES];
 };
 
-struct per_cpu_pageset {
-       struct per_cpu_pages pcp;
-#ifdef CONFIG_NUMA
-       s8 expire;
-       u16 vm_numa_stat_diff[NR_VM_NUMA_STAT_ITEMS];
-#endif
+struct per_cpu_zonestat {
 #ifdef CONFIG_SMP
-       s8 stat_threshold;
        s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS];
+       s8 stat_threshold;
+#endif
+#ifdef CONFIG_NUMA
+       u16 vm_numa_stat_diff[NR_VM_NUMA_STAT_ITEMS];
 #endif
 };
 
@@ -484,7 +487,8 @@ struct zone {
        int node;
 #endif
        struct pglist_data      *zone_pgdat;
-       struct per_cpu_pageset __percpu *pageset;
+       struct per_cpu_pages    __percpu *per_cpu_pageset;
+       struct per_cpu_zonestat __percpu *per_cpu_zonestats;
        /*
         * the high and batch values are copied to individual pagesets for
         * faster access
@@ -982,22 +986,11 @@ static inline void zone_set_nid(struct zone *zone, int nid) {}
 
 extern int movable_zone;
 
-#ifdef CONFIG_HIGHMEM
-static inline int zone_movable_is_highmem(void)
-{
-#ifdef CONFIG_NEED_MULTIPLE_NODES
-       return movable_zone == ZONE_HIGHMEM;
-#else
-       return (ZONE_MOVABLE - 1) == ZONE_HIGHMEM;
-#endif
-}
-#endif
-
 static inline int is_highmem_idx(enum zone_type idx)
 {
 #ifdef CONFIG_HIGHMEM
        return (idx == ZONE_HIGHMEM ||
-               (idx == ZONE_MOVABLE && zone_movable_is_highmem()));
+               (idx == ZONE_MOVABLE && movable_zone == ZONE_HIGHMEM));
 #else
        return 0;
 #endif