diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bitops.h | 10 | ||||
-rw-r--r-- | include/linux/gfp.h | 11 | ||||
-rw-r--r-- | include/linux/mm.h | 10 | ||||
-rw-r--r-- | include/linux/mmzone.h | 20 |
4 files changed, 35 insertions, 16 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index cb3c3ef50f50..38c2fb7ebe09 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -84,6 +84,16 @@ static __inline__ int get_bitmask_order(unsigned int count) | |||
84 | return order; /* We could be slightly more clever with -1 here... */ | 84 | return order; /* We could be slightly more clever with -1 here... */ |
85 | } | 85 | } |
86 | 86 | ||
87 | static __inline__ int get_count_order(unsigned int count) | ||
88 | { | ||
89 | int order; | ||
90 | |||
91 | order = fls(count) - 1; | ||
92 | if (count & (count - 1)) | ||
93 | order++; | ||
94 | return order; | ||
95 | } | ||
96 | |||
87 | /* | 97 | /* |
88 | * hweightN: returns the hamming weight (i.e. the number | 98 | * hweightN: returns the hamming weight (i.e. the number |
89 | * of bits set) of a N-bit word | 99 | * of bits set) of a N-bit word |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 23279d8f19b1..313dfe9b443a 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -14,6 +14,13 @@ struct vm_area_struct; | |||
14 | /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */ | 14 | /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */ |
15 | #define __GFP_DMA ((__force gfp_t)0x01u) | 15 | #define __GFP_DMA ((__force gfp_t)0x01u) |
16 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) | 16 | #define __GFP_HIGHMEM ((__force gfp_t)0x02u) |
17 | #ifdef CONFIG_DMA_IS_DMA32 | ||
18 | #define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */ | ||
19 | #elif BITS_PER_LONG < 64 | ||
20 | #define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */ | ||
21 | #else | ||
22 | #define __GFP_DMA32 ((__force gfp_t)0x04) /* Has own ZONE_DMA32 */ | ||
23 | #endif | ||
17 | 24 | ||
18 | /* | 25 | /* |
19 | * Action modifiers - doesn't change the zoning | 26 | * Action modifiers - doesn't change the zoning |
@@ -63,6 +70,10 @@ struct vm_area_struct; | |||
63 | 70 | ||
64 | #define GFP_DMA __GFP_DMA | 71 | #define GFP_DMA __GFP_DMA |
65 | 72 | ||
73 | /* 4GB DMA on some platforms */ | ||
74 | #define GFP_DMA32 __GFP_DMA32 | ||
75 | |||
76 | |||
66 | #define gfp_zone(mask) ((__force int)((mask) & (__force gfp_t)GFP_ZONEMASK)) | 77 | #define gfp_zone(mask) ((__force int)((mask) & (__force gfp_t)GFP_ZONEMASK)) |
67 | 78 | ||
68 | /* | 79 | /* |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 7b115feca4df..1013a42d10b1 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -206,12 +206,6 @@ struct vm_operations_struct { | |||
206 | struct mmu_gather; | 206 | struct mmu_gather; |
207 | struct inode; | 207 | struct inode; |
208 | 208 | ||
209 | #ifdef ARCH_HAS_ATOMIC_UNSIGNED | ||
210 | typedef unsigned page_flags_t; | ||
211 | #else | ||
212 | typedef unsigned long page_flags_t; | ||
213 | #endif | ||
214 | |||
215 | /* | 209 | /* |
216 | * Each physical page in the system has a struct page associated with | 210 | * Each physical page in the system has a struct page associated with |
217 | * it to keep track of whatever it is we are using the page for at the | 211 | * it to keep track of whatever it is we are using the page for at the |
@@ -219,7 +213,7 @@ typedef unsigned long page_flags_t; | |||
219 | * a page. | 213 | * a page. |
220 | */ | 214 | */ |
221 | struct page { | 215 | struct page { |
222 | page_flags_t flags; /* Atomic flags, some possibly | 216 | unsigned long flags; /* Atomic flags, some possibly |
223 | * updated asynchronously */ | 217 | * updated asynchronously */ |
224 | atomic_t _count; /* Usage count, see below. */ | 218 | atomic_t _count; /* Usage count, see below. */ |
225 | atomic_t _mapcount; /* Count of ptes mapped in mms, | 219 | atomic_t _mapcount; /* Count of ptes mapped in mms, |
@@ -435,7 +429,7 @@ static inline void put_page(struct page *page) | |||
435 | #endif | 429 | #endif |
436 | 430 | ||
437 | /* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */ | 431 | /* Page flags: | [SECTION] | [NODE] | ZONE | ... | FLAGS | */ |
438 | #define SECTIONS_PGOFF ((sizeof(page_flags_t)*8) - SECTIONS_WIDTH) | 432 | #define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH) |
439 | #define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH) | 433 | #define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH) |
440 | #define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH) | 434 | #define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH) |
441 | 435 | ||
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 6cfb114a0c34..2c8edad5dccf 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -71,10 +71,11 @@ struct per_cpu_pageset { | |||
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #define ZONE_DMA 0 | 73 | #define ZONE_DMA 0 |
74 | #define ZONE_NORMAL 1 | 74 | #define ZONE_DMA32 1 |
75 | #define ZONE_HIGHMEM 2 | 75 | #define ZONE_NORMAL 2 |
76 | #define ZONE_HIGHMEM 3 | ||
76 | 77 | ||
77 | #define MAX_NR_ZONES 3 /* Sync this with ZONES_SHIFT */ | 78 | #define MAX_NR_ZONES 4 /* Sync this with ZONES_SHIFT */ |
78 | #define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ | 79 | #define ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */ |
79 | 80 | ||
80 | 81 | ||
@@ -108,9 +109,10 @@ struct per_cpu_pageset { | |||
108 | 109 | ||
109 | /* | 110 | /* |
110 | * On machines where it is needed (eg PCs) we divide physical memory | 111 | * On machines where it is needed (eg PCs) we divide physical memory |
111 | * into multiple physical zones. On a PC we have 3 zones: | 112 | * into multiple physical zones. On a PC we have 4 zones: |
112 | * | 113 | * |
113 | * ZONE_DMA < 16 MB ISA DMA capable memory | 114 | * ZONE_DMA < 16 MB ISA DMA capable memory |
115 | * ZONE_DMA32 0 MB Empty | ||
114 | * ZONE_NORMAL 16-896 MB direct mapped by the kernel | 116 | * ZONE_NORMAL 16-896 MB direct mapped by the kernel |
115 | * ZONE_HIGHMEM > 896 MB only page cache and user processes | 117 | * ZONE_HIGHMEM > 896 MB only page cache and user processes |
116 | */ | 118 | */ |
@@ -433,7 +435,9 @@ int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *, | |||
433 | 435 | ||
434 | #include <linux/topology.h> | 436 | #include <linux/topology.h> |
435 | /* Returns the number of the current Node. */ | 437 | /* Returns the number of the current Node. */ |
438 | #ifndef numa_node_id | ||
436 | #define numa_node_id() (cpu_to_node(raw_smp_processor_id())) | 439 | #define numa_node_id() (cpu_to_node(raw_smp_processor_id())) |
440 | #endif | ||
437 | 441 | ||
438 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 442 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
439 | 443 | ||
@@ -453,12 +457,12 @@ extern struct pglist_data contig_page_data; | |||
453 | #include <asm/sparsemem.h> | 457 | #include <asm/sparsemem.h> |
454 | #endif | 458 | #endif |
455 | 459 | ||
456 | #if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED) | 460 | #if BITS_PER_LONG == 32 |
457 | /* | 461 | /* |
458 | * with 32 bit page->flags field, we reserve 8 bits for node/zone info. | 462 | * with 32 bit page->flags field, we reserve 9 bits for node/zone info. |
459 | * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes. | 463 | * there are 4 zones (3 bits) and this leaves 9-3=6 bits for nodes. |
460 | */ | 464 | */ |
461 | #define FLAGS_RESERVED 8 | 465 | #define FLAGS_RESERVED 9 |
462 | 466 | ||
463 | #elif BITS_PER_LONG == 64 | 467 | #elif BITS_PER_LONG == 64 |
464 | /* | 468 | /* |