aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-alpha/bug.h16
-rw-r--r--include/asm-alpha/byteorder.h2
-rw-r--r--include/asm-alpha/pgtable.h2
-rw-r--r--include/asm-arm/pgtable.h3
-rw-r--r--include/asm-avr32/pgtable.h8
-rw-r--r--include/asm-cris/pgtable.h4
-rw-r--r--include/asm-frv/pgtable.h2
-rw-r--r--include/asm-generic/gpio.h15
-rw-r--r--include/asm-ia64/hugetlb.h79
-rw-r--r--include/asm-ia64/page.h6
-rw-r--r--include/asm-ia64/pgtable.h3
-rw-r--r--include/asm-ia64/system.h18
-rw-r--r--include/asm-m32r/pgtable.h10
-rw-r--r--include/asm-m68k/motorola_pgtable.h2
-rw-r--r--include/asm-m68k/sun3_pgtable.h2
-rw-r--r--include/asm-mips/pgtable.h2
-rw-r--r--include/asm-mips/vr41xx/siu.h8
-rw-r--r--include/asm-mips/vr41xx/vr41xx.h8
-rw-r--r--include/asm-mn10300/pgtable.h3
-rw-r--r--include/asm-parisc/pgtable.h2
-rw-r--r--include/asm-powerpc/hugetlb.h79
-rw-r--r--include/asm-powerpc/page_64.h7
-rw-r--r--include/asm-powerpc/pgtable-ppc32.h3
-rw-r--r--include/asm-powerpc/pgtable-ppc64.h3
-rw-r--r--include/asm-ppc/pgtable.h3
-rw-r--r--include/asm-s390/pgtable.h13
-rw-r--r--include/asm-sh/hugetlb.h91
-rw-r--r--include/asm-sh/pgtable_32.h3
-rw-r--r--include/asm-sh/pgtable_64.h10
-rw-r--r--include/asm-sparc/pgtable.h7
-rw-r--r--include/asm-sparc/processor.h4
-rw-r--r--include/asm-sparc64/floppy.h84
-rw-r--r--include/asm-sparc64/hugetlb.h84
-rw-r--r--include/asm-sparc64/isa.h47
-rw-r--r--include/asm-sparc64/page.h2
-rw-r--r--include/asm-sparc64/pgtable.h10
-rw-r--r--include/asm-sparc64/ptrace.h23
-rw-r--r--include/asm-sparc64/thread_info.h6
-rw-r--r--include/asm-um/pgtable.h10
-rw-r--r--include/asm-x86/geode.h38
-rw-r--r--include/asm-x86/hugetlb.h91
-rw-r--r--include/asm-x86/pgtable.h10
-rw-r--r--include/asm-xtensa/pgtable.h4
-rw-r--r--include/linux/bitmap.h6
-rw-r--r--include/linux/bootmem.h2
-rw-r--r--include/linux/cache.h4
-rw-r--r--include/linux/capability.h3
-rw-r--r--include/linux/cpumask.h22
-rw-r--r--include/linux/cpuset.h4
-rw-r--r--include/linux/dmi.h1
-rw-r--r--include/linux/fb.h44
-rw-r--r--include/linux/fs.h7
-rw-r--r--include/linux/gfp.h44
-rw-r--r--include/linux/hid.h4
-rw-r--r--include/linux/hugetlb.h46
-rw-r--r--include/linux/i2o.h5
-rw-r--r--include/linux/init_task.h3
-rw-r--r--include/linux/kprobes.h34
-rw-r--r--include/linux/list.h9
-rw-r--r--include/linux/memory_hotplug.h33
-rw-r--r--include/linux/mempolicy.h156
-rw-r--r--include/linux/mm.h57
-rw-r--r--include/linux/mm_types.h4
-rw-r--r--include/linux/mmzone.h183
-rw-r--r--include/linux/msdos_fs.h10
-rw-r--r--include/linux/ncp_fs.h7
-rw-r--r--include/linux/nodemask.h22
-rw-r--r--include/linux/notifier.h1
-rw-r--r--include/linux/oom.h4
-rw-r--r--include/linux/page-flags.h319
-rw-r--r--include/linux/prctl.h9
-rw-r--r--include/linux/quota.h21
-rw-r--r--include/linux/quotaops.h137
-rw-r--r--include/linux/raid/raid5.h7
-rw-r--r--include/linux/reiserfs_fs.h1
-rw-r--r--include/linux/sched.h3
-rw-r--r--include/linux/securebits.h25
-rw-r--r--include/linux/security.h16
-rw-r--r--include/linux/serial_8250.h1
-rw-r--r--include/linux/shmem_fs.h3
-rw-r--r--include/linux/suspend.h15
-rw-r--r--include/linux/swap.h4
-rw-r--r--include/linux/synclink.h4
-rw-r--r--include/linux/vmalloc.h5
-rw-r--r--include/linux/vmstat.h6
-rw-r--r--include/net/compat.h3
-rw-r--r--include/video/atmel_lcdc.h11
-rw-r--r--include/video/hecubafb.h51
-rw-r--r--include/video/metronomefb.h62
89 files changed, 1630 insertions, 615 deletions
diff --git a/include/asm-alpha/bug.h b/include/asm-alpha/bug.h
index 39a3e2a5017d..695a5ee4b5d3 100644
--- a/include/asm-alpha/bug.h
+++ b/include/asm-alpha/bug.h
@@ -1,14 +1,24 @@
1#ifndef _ALPHA_BUG_H 1#ifndef _ALPHA_BUG_H
2#define _ALPHA_BUG_H 2#define _ALPHA_BUG_H
3 3
4#include <linux/linkage.h>
5
4#ifdef CONFIG_BUG 6#ifdef CONFIG_BUG
5#include <asm/pal.h> 7#include <asm/pal.h>
6 8
7/* ??? Would be nice to use .gprel32 here, but we can't be sure that the 9/* ??? Would be nice to use .gprel32 here, but we can't be sure that the
8 function loaded the GP, so this could fail in modules. */ 10 function loaded the GP, so this could fail in modules. */
9#define BUG() \ 11static inline void ATTRIB_NORET __BUG(const char *file, int line)
10 __asm__ __volatile__("call_pal %0 # bugchk\n\t"".long %1\n\t.8byte %2" \ 12{
11 : : "i" (PAL_bugchk), "i"(__LINE__), "i"(__FILE__)) 13 __asm__ __volatile__(
14 "call_pal %0 # bugchk\n\t"
15 ".long %1\n\t.8byte %2"
16 : : "i" (PAL_bugchk), "i"(line), "i"(file));
17 for ( ; ; )
18 ;
19}
20
21#define BUG() __BUG(__FILE__, __LINE__)
12 22
13#define HAVE_ARCH_BUG 23#define HAVE_ARCH_BUG
14#endif 24#endif
diff --git a/include/asm-alpha/byteorder.h b/include/asm-alpha/byteorder.h
index 7af2b8d25486..58e958fc7f1b 100644
--- a/include/asm-alpha/byteorder.h
+++ b/include/asm-alpha/byteorder.h
@@ -7,7 +7,7 @@
7 7
8#ifdef __GNUC__ 8#ifdef __GNUC__
9 9
10static __inline __attribute_const__ __u32 __arch__swab32(__u32 x) 10static inline __attribute_const__ __u32 __arch__swab32(__u32 x)
11{ 11{
12 /* 12 /*
13 * Unfortunately, we can't use the 6 instruction sequence 13 * Unfortunately, we can't use the 6 instruction sequence
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
index 99037b032357..05ce5fba43e3 100644
--- a/include/asm-alpha/pgtable.h
+++ b/include/asm-alpha/pgtable.h
@@ -268,6 +268,7 @@ extern inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_FOW); }
268extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 268extern inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
269extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 269extern inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
270extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 270extern inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
271extern inline int pte_special(pte_t pte) { return 0; }
271 272
272extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; } 273extern inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_FOW; return pte; }
273extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(__DIRTY_BITS); return pte; } 274extern inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~(__DIRTY_BITS); return pte; }
@@ -275,6 +276,7 @@ extern inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~(__ACCESS_BITS); ret
275extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_FOW; return pte; } 276extern inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) &= ~_PAGE_FOW; return pte; }
276extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; } 277extern inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= __DIRTY_BITS; return pte; }
277extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; } 278extern inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= __ACCESS_BITS; return pte; }
279extern inline pte_t pte_mkspecial(pte_t pte) { return pte; }
278 280
279#define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address)) 281#define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address))
280 282
diff --git a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
index 5e0182485d8c..5571c13c3f3b 100644
--- a/include/asm-arm/pgtable.h
+++ b/include/asm-arm/pgtable.h
@@ -260,6 +260,7 @@ extern struct page *empty_zero_page;
260#define pte_write(pte) (pte_val(pte) & L_PTE_WRITE) 260#define pte_write(pte) (pte_val(pte) & L_PTE_WRITE)
261#define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY) 261#define pte_dirty(pte) (pte_val(pte) & L_PTE_DIRTY)
262#define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) 262#define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG)
263#define pte_special(pte) (0)
263 264
264/* 265/*
265 * The following only works if pte_present() is not true. 266 * The following only works if pte_present() is not true.
@@ -280,6 +281,8 @@ PTE_BIT_FUNC(mkdirty, |= L_PTE_DIRTY);
280PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG); 281PTE_BIT_FUNC(mkold, &= ~L_PTE_YOUNG);
281PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG); 282PTE_BIT_FUNC(mkyoung, |= L_PTE_YOUNG);
282 283
284static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
285
283/* 286/*
284 * Mark the prot value as uncacheable and unbufferable. 287 * Mark the prot value as uncacheable and unbufferable.
285 */ 288 */
diff --git a/include/asm-avr32/pgtable.h b/include/asm-avr32/pgtable.h
index 3ae7b548fce7..c0e5e29417df 100644
--- a/include/asm-avr32/pgtable.h
+++ b/include/asm-avr32/pgtable.h
@@ -212,6 +212,10 @@ static inline int pte_young(pte_t pte)
212{ 212{
213 return pte_val(pte) & _PAGE_ACCESSED; 213 return pte_val(pte) & _PAGE_ACCESSED;
214} 214}
215static inline int pte_special(pte_t pte)
216{
217 return 0;
218}
215 219
216/* 220/*
217 * The following only work if pte_present() is not true. 221 * The following only work if pte_present() is not true.
@@ -252,6 +256,10 @@ static inline pte_t pte_mkyoung(pte_t pte)
252 set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); 256 set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED));
253 return pte; 257 return pte;
254} 258}
259static inline pte_t pte_mkspecial(pte_t pte)
260{
261 return pte;
262}
255 263
256#define pmd_none(x) (!pmd_val(x)) 264#define pmd_none(x) (!pmd_val(x))
257#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) 265#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT)
diff --git a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
index a2607575681b..829e7a7d9fb9 100644
--- a/include/asm-cris/pgtable.h
+++ b/include/asm-cris/pgtable.h
@@ -115,6 +115,7 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WR
115static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; } 115static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_MODIFIED; }
116static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 116static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
117static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 117static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
118static inline int pte_special(pte_t pte) { return 0; }
118 119
119static inline pte_t pte_wrprotect(pte_t pte) 120static inline pte_t pte_wrprotect(pte_t pte)
120{ 121{
@@ -162,6 +163,7 @@ static inline pte_t pte_mkyoung(pte_t pte)
162 } 163 }
163 return pte; 164 return pte;
164} 165}
166static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
165 167
166/* 168/*
167 * Conversion functions: convert a page and protection to a page entry, 169 * Conversion functions: convert a page and protection to a page entry,
@@ -229,7 +231,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
229#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 231#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
230 232
231/* to find an entry in a page-table-directory */ 233/* to find an entry in a page-table-directory */
232static inline pgd_t * pgd_offset(struct mm_struct * mm, unsigned long address) 234static inline pgd_t * pgd_offset(const struct mm_struct *mm, unsigned long address)
233{ 235{
234 return mm->pgd + pgd_index(address); 236 return mm->pgd + pgd_index(address);
235} 237}
diff --git a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
index 4e219046fe42..83c51aba534b 100644
--- a/include/asm-frv/pgtable.h
+++ b/include/asm-frv/pgtable.h
@@ -380,6 +380,7 @@ static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address)
380static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; } 380static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; }
381static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; } 381static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; }
382static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); } 382static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); }
383static inline int pte_special(pte_t pte) { return 0; }
383 384
384static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; } 385static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; }
385static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; } 386static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; }
@@ -387,6 +388,7 @@ static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte |= _PAGE_WP; return pte
387static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; } 388static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; }
388static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; } 389static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; }
389static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte &= ~_PAGE_WP; return pte; } 390static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte &= ~_PAGE_WP; return pte; }
391static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
390 392
391static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 393static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
392{ 394{
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index f29a502f4a6c..ecf675a59d21 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -16,7 +16,14 @@
16#define ARCH_NR_GPIOS 256 16#define ARCH_NR_GPIOS 256
17#endif 17#endif
18 18
19static inline int gpio_is_valid(int number)
20{
21 /* only some non-negative numbers are valid */
22 return ((unsigned)number) < ARCH_NR_GPIOS;
23}
24
19struct seq_file; 25struct seq_file;
26struct module;
20 27
21/** 28/**
22 * struct gpio_chip - abstract a GPIO controller 29 * struct gpio_chip - abstract a GPIO controller
@@ -48,6 +55,7 @@ struct seq_file;
48 */ 55 */
49struct gpio_chip { 56struct gpio_chip {
50 char *label; 57 char *label;
58 struct module *owner;
51 59
52 int (*direction_input)(struct gpio_chip *chip, 60 int (*direction_input)(struct gpio_chip *chip,
53 unsigned offset); 61 unsigned offset);
@@ -66,6 +74,7 @@ struct gpio_chip {
66 74
67extern const char *gpiochip_is_requested(struct gpio_chip *chip, 75extern const char *gpiochip_is_requested(struct gpio_chip *chip,
68 unsigned offset); 76 unsigned offset);
77extern int __init __must_check gpiochip_reserve(int start, int ngpio);
69 78
70/* add/remove chips */ 79/* add/remove chips */
71extern int gpiochip_add(struct gpio_chip *chip); 80extern int gpiochip_add(struct gpio_chip *chip);
@@ -97,6 +106,12 @@ extern int __gpio_cansleep(unsigned gpio);
97 106
98#else 107#else
99 108
109static inline int gpio_is_valid(int number)
110{
111 /* only non-negative numbers are valid */
112 return number >= 0;
113}
114
100/* platforms that don't directly support access to GPIOs through I2C, SPI, 115/* platforms that don't directly support access to GPIOs through I2C, SPI,
101 * or other blocking infrastructure can use these wrappers. 116 * or other blocking infrastructure can use these wrappers.
102 */ 117 */
diff --git a/include/asm-ia64/hugetlb.h b/include/asm-ia64/hugetlb.h
new file mode 100644
index 000000000000..f28a9701f1cf
--- /dev/null
+++ b/include/asm-ia64/hugetlb.h
@@ -0,0 +1,79 @@
1#ifndef _ASM_IA64_HUGETLB_H
2#define _ASM_IA64_HUGETLB_H
3
4#include <asm/page.h>
5
6
7void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
8 unsigned long end, unsigned long floor,
9 unsigned long ceiling);
10
11int prepare_hugepage_range(unsigned long addr, unsigned long len);
12
13static inline int is_hugepage_only_range(struct mm_struct *mm,
14 unsigned long addr,
15 unsigned long len)
16{
17 return (REGION_NUMBER(addr) == RGN_HPAGE ||
18 REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE);
19}
20
21static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
22{
23}
24
25static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
26 pte_t *ptep, pte_t pte)
27{
28 set_pte_at(mm, addr, ptep, pte);
29}
30
31static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
32 unsigned long addr, pte_t *ptep)
33{
34 return ptep_get_and_clear(mm, addr, ptep);
35}
36
37static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
38 unsigned long addr, pte_t *ptep)
39{
40}
41
42static inline int huge_pte_none(pte_t pte)
43{
44 return pte_none(pte);
45}
46
47static inline pte_t huge_pte_wrprotect(pte_t pte)
48{
49 return pte_wrprotect(pte);
50}
51
52static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
53 unsigned long addr, pte_t *ptep)
54{
55 ptep_set_wrprotect(mm, addr, ptep);
56}
57
58static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
59 unsigned long addr, pte_t *ptep,
60 pte_t pte, int dirty)
61{
62 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
63}
64
65static inline pte_t huge_ptep_get(pte_t *ptep)
66{
67 return *ptep;
68}
69
70static inline int arch_prepare_hugepage(struct page *page)
71{
72 return 0;
73}
74
75static inline void arch_release_hugepage(struct page *page)
76{
77}
78
79#endif /* _ASM_IA64_HUGETLB_H */
diff --git a/include/asm-ia64/page.h b/include/asm-ia64/page.h
index 4999a6c63775..36f39321b768 100644
--- a/include/asm-ia64/page.h
+++ b/include/asm-ia64/page.h
@@ -54,9 +54,6 @@
54# define HPAGE_MASK (~(HPAGE_SIZE - 1)) 54# define HPAGE_MASK (~(HPAGE_SIZE - 1))
55 55
56# define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 56# define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
57# define ARCH_HAS_HUGEPAGE_ONLY_RANGE
58# define ARCH_HAS_PREPARE_HUGEPAGE_RANGE
59# define ARCH_HAS_HUGETLB_FREE_PGD_RANGE
60#endif /* CONFIG_HUGETLB_PAGE */ 57#endif /* CONFIG_HUGETLB_PAGE */
61 58
62#ifdef __ASSEMBLY__ 59#ifdef __ASSEMBLY__
@@ -153,9 +150,6 @@ typedef union ia64_va {
153# define htlbpage_to_page(x) (((unsigned long) REGION_NUMBER(x) << 61) \ 150# define htlbpage_to_page(x) (((unsigned long) REGION_NUMBER(x) << 61) \
154 | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT))) 151 | (REGION_OFFSET(x) >> (HPAGE_SHIFT-PAGE_SHIFT)))
155# define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 152# define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
156# define is_hugepage_only_range(mm, addr, len) \
157 (REGION_NUMBER(addr) == RGN_HPAGE || \
158 REGION_NUMBER((addr)+(len)-1) == RGN_HPAGE)
159extern unsigned int hpage_shift; 153extern unsigned int hpage_shift;
160#endif 154#endif
161 155
diff --git a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
index ed70862ea247..7a9bff47564f 100644
--- a/include/asm-ia64/pgtable.h
+++ b/include/asm-ia64/pgtable.h
@@ -302,6 +302,8 @@ ia64_phys_addr_valid (unsigned long addr)
302#define pte_dirty(pte) ((pte_val(pte) & _PAGE_D) != 0) 302#define pte_dirty(pte) ((pte_val(pte) & _PAGE_D) != 0)
303#define pte_young(pte) ((pte_val(pte) & _PAGE_A) != 0) 303#define pte_young(pte) ((pte_val(pte) & _PAGE_A) != 0)
304#define pte_file(pte) ((pte_val(pte) & _PAGE_FILE) != 0) 304#define pte_file(pte) ((pte_val(pte) & _PAGE_FILE) != 0)
305#define pte_special(pte) 0
306
305/* 307/*
306 * Note: we convert AR_RWX to AR_RX and AR_RW to AR_R by clearing the 2nd bit in the 308 * Note: we convert AR_RWX to AR_RX and AR_RW to AR_R by clearing the 2nd bit in the
307 * access rights: 309 * access rights:
@@ -313,6 +315,7 @@ ia64_phys_addr_valid (unsigned long addr)
313#define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D)) 315#define pte_mkclean(pte) (__pte(pte_val(pte) & ~_PAGE_D))
314#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_D)) 316#define pte_mkdirty(pte) (__pte(pte_val(pte) | _PAGE_D))
315#define pte_mkhuge(pte) (__pte(pte_val(pte))) 317#define pte_mkhuge(pte) (__pte(pte_val(pte)))
318#define pte_mkspecial(pte) (pte)
316 319
317/* 320/*
318 * Because ia64's Icache and Dcache is not coherent (on a cpu), we need to 321 * Because ia64's Icache and Dcache is not coherent (on a cpu), we need to
diff --git a/include/asm-ia64/system.h b/include/asm-ia64/system.h
index dff8128fa58e..26e250bfb912 100644
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -146,23 +146,23 @@ do { \
146 146
147# define local_irq_save(x) \ 147# define local_irq_save(x) \
148do { \ 148do { \
149 unsigned long psr; \ 149 unsigned long __psr; \
150 \ 150 \
151 __local_irq_save(psr); \ 151 __local_irq_save(__psr); \
152 if (psr & IA64_PSR_I) \ 152 if (__psr & IA64_PSR_I) \
153 __save_ip(); \ 153 __save_ip(); \
154 (x) = psr; \ 154 (x) = __psr; \
155} while (0) 155} while (0)
156 156
157# define local_irq_disable() do { unsigned long x; local_irq_save(x); } while (0) 157# define local_irq_disable() do { unsigned long __x; local_irq_save(__x); } while (0)
158 158
159# define local_irq_restore(x) \ 159# define local_irq_restore(x) \
160do { \ 160do { \
161 unsigned long old_psr, psr = (x); \ 161 unsigned long __old_psr, __psr = (x); \
162 \ 162 \
163 local_save_flags(old_psr); \ 163 local_save_flags(__old_psr); \
164 __local_irq_restore(psr); \ 164 __local_irq_restore(__psr); \
165 if ((old_psr & IA64_PSR_I) && !(psr & IA64_PSR_I)) \ 165 if ((__old_psr & IA64_PSR_I) && !(__psr & IA64_PSR_I)) \
166 __save_ip(); \ 166 __save_ip(); \
167} while (0) 167} while (0)
168 168
diff --git a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
index 86505387be08..e6359c566b50 100644
--- a/include/asm-m32r/pgtable.h
+++ b/include/asm-m32r/pgtable.h
@@ -214,6 +214,11 @@ static inline int pte_file(pte_t pte)
214 return pte_val(pte) & _PAGE_FILE; 214 return pte_val(pte) & _PAGE_FILE;
215} 215}
216 216
217static inline int pte_special(pte_t pte)
218{
219 return 0;
220}
221
217static inline pte_t pte_mkclean(pte_t pte) 222static inline pte_t pte_mkclean(pte_t pte)
218{ 223{
219 pte_val(pte) &= ~_PAGE_DIRTY; 224 pte_val(pte) &= ~_PAGE_DIRTY;
@@ -250,6 +255,11 @@ static inline pte_t pte_mkwrite(pte_t pte)
250 return pte; 255 return pte;
251} 256}
252 257
258static inline pte_t pte_mkspecial(pte_t pte)
259{
260 return pte;
261}
262
253static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) 263static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
254{ 264{
255 return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); 265 return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep);
diff --git a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h
index 13135d4821d8..8e9a8a754dde 100644
--- a/include/asm-m68k/motorola_pgtable.h
+++ b/include/asm-m68k/motorola_pgtable.h
@@ -168,6 +168,7 @@ static inline int pte_write(pte_t pte) { return !(pte_val(pte) & _PAGE_RONLY);
168static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 168static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
169static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 169static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
170static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 170static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
171static inline int pte_special(pte_t pte) { return 0; }
171 172
172static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; } 173static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) |= _PAGE_RONLY; return pte; }
173static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 174static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
@@ -185,6 +186,7 @@ static inline pte_t pte_mkcache(pte_t pte)
185 pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_supervisor_cachemode; 186 pte_val(pte) = (pte_val(pte) & _CACHEMASK040) | m68k_supervisor_cachemode;
186 return pte; 187 return pte;
187} 188}
189static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
188 190
189#define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address)) 191#define PAGE_DIR_OFFSET(tsk,address) pgd_offset((tsk),(address))
190 192
diff --git a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h
index b766fc261bde..f847ec732d62 100644
--- a/include/asm-m68k/sun3_pgtable.h
+++ b/include/asm-m68k/sun3_pgtable.h
@@ -169,6 +169,7 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & SUN3_PAGE_WRITEA
169static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; } 169static inline int pte_dirty(pte_t pte) { return pte_val(pte) & SUN3_PAGE_MODIFIED; }
170static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } 170static inline int pte_young(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; }
171static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; } 171static inline int pte_file(pte_t pte) { return pte_val(pte) & SUN3_PAGE_ACCESSED; }
172static inline int pte_special(pte_t pte) { return 0; }
172 173
173static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; } 174static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_WRITEABLE; return pte; }
174static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; } 175static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~SUN3_PAGE_MODIFIED; return pte; }
@@ -181,6 +182,7 @@ static inline pte_t pte_mknocache(pte_t pte) { pte_val(pte) |= SUN3_PAGE_NOCACHE
181//static inline pte_t pte_mkcache(pte_t pte) { pte_val(pte) &= SUN3_PAGE_NOCACHE; return pte; } 182//static inline pte_t pte_mkcache(pte_t pte) { pte_val(pte) &= SUN3_PAGE_NOCACHE; return pte; }
182// until then, use: 183// until then, use:
183static inline pte_t pte_mkcache(pte_t pte) { return pte; } 184static inline pte_t pte_mkcache(pte_t pte) { return pte; }
185static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
184 186
185extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 187extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
186extern pgd_t kernel_pg_dir[PTRS_PER_PGD]; 188extern pgd_t kernel_pg_dir[PTRS_PER_PGD];
diff --git a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
index 17a7703a2969..782221e57c0a 100644
--- a/include/asm-mips/pgtable.h
+++ b/include/asm-mips/pgtable.h
@@ -285,6 +285,8 @@ static inline pte_t pte_mkyoung(pte_t pte)
285 return pte; 285 return pte;
286} 286}
287#endif 287#endif
288static inline int pte_special(pte_t pte) { return 0; }
289static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
288 290
289/* 291/*
290 * Macro to make mark a page protection value as "uncacheable". Note 292 * Macro to make mark a page protection value as "uncacheable". Note
diff --git a/include/asm-mips/vr41xx/siu.h b/include/asm-mips/vr41xx/siu.h
index 98cdb4096485..da9f6e373409 100644
--- a/include/asm-mips/vr41xx/siu.h
+++ b/include/asm-mips/vr41xx/siu.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Include file for NEC VR4100 series Serial Interface Unit. 2 * Include file for NEC VR4100 series Serial Interface Unit.
3 * 3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 4 * Copyright (C) 2005-2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -49,4 +49,10 @@ typedef enum {
49 49
50extern void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed); 50extern void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed);
51 51
52#ifdef CONFIG_SERIAL_VR41XX_CONSOLE
53extern void vr41xx_siu_early_setup(struct uart_port *port);
54#else
55static inline void vr41xx_siu_early_setup(struct uart_port *port) {}
56#endif
57
52#endif /* __NEC_VR41XX_SIU_H */ 58#endif /* __NEC_VR41XX_SIU_H */
diff --git a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
index 88b492f6ea9c..22be64971cc6 100644
--- a/include/asm-mips/vr41xx/vr41xx.h
+++ b/include/asm-mips/vr41xx/vr41xx.h
@@ -7,7 +7,7 @@
7 * Copyright (C) 2001, 2002 Paul Mundt 7 * Copyright (C) 2001, 2002 Paul Mundt
8 * Copyright (C) 2002 MontaVista Software, Inc. 8 * Copyright (C) 2002 MontaVista Software, Inc.
9 * Copyright (C) 2002 TimeSys Corp. 9 * Copyright (C) 2002 TimeSys Corp.
10 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 10 * Copyright (C) 2003-2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
11 * 11 *
12 * This program is free software; you can redistribute it and/or modify it 12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 13 * under the terms of the GNU General Public License as published by the
@@ -143,4 +143,10 @@ extern void vr41xx_disable_csiint(uint16_t mask);
143extern void vr41xx_enable_bcuint(void); 143extern void vr41xx_enable_bcuint(void);
144extern void vr41xx_disable_bcuint(void); 144extern void vr41xx_disable_bcuint(void);
145 145
146#ifdef CONFIG_SERIAL_VR41XX_CONSOLE
147extern void vr41xx_siu_setup(void);
148#else
149static inline void vr41xx_siu_setup(void) {}
150#endif
151
146#endif /* __NEC_VR41XX_H */ 152#endif /* __NEC_VR41XX_H */
diff --git a/include/asm-mn10300/pgtable.h b/include/asm-mn10300/pgtable.h
index 375c4941deda..6dc30fc827c4 100644
--- a/include/asm-mn10300/pgtable.h
+++ b/include/asm-mn10300/pgtable.h
@@ -224,6 +224,7 @@ static inline int pte_read(pte_t pte) { return pte_val(pte) & __PAGE_PROT_USER;
224static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 224static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
225static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 225static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
226static inline int pte_write(pte_t pte) { return pte_val(pte) & __PAGE_PROT_WRITE; } 226static inline int pte_write(pte_t pte) { return pte_val(pte) & __PAGE_PROT_WRITE; }
227static inline int pte_special(pte_t pte){ return 0; }
227 228
228/* 229/*
229 * The following only works if pte_present() is not true. 230 * The following only works if pte_present() is not true.
@@ -265,6 +266,8 @@ static inline pte_t pte_mkwrite(pte_t pte)
265 return pte; 266 return pte;
266} 267}
267 268
269static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
270
268#define pte_ERROR(e) \ 271#define pte_ERROR(e) \
269 printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \ 272 printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \
270 __FILE__, __LINE__, pte_val(e)) 273 __FILE__, __LINE__, pte_val(e))
diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
index dc86adbec916..470a4b88124d 100644
--- a/include/asm-parisc/pgtable.h
+++ b/include/asm-parisc/pgtable.h
@@ -323,6 +323,7 @@ static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
323static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 323static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
324static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 324static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
325static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 325static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
326static inline int pte_special(pte_t pte) { return 0; }
326 327
327static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } 328static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; }
328static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } 329static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; }
@@ -330,6 +331,7 @@ static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= ~_PAGE_WRITE; ret
330static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } 331static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; }
331static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 332static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
332static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; } 333static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; }
334static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
333 335
334/* 336/*
335 * Conversion functions: convert a page and protection to a page entry, 337 * Conversion functions: convert a page and protection to a page entry,
diff --git a/include/asm-powerpc/hugetlb.h b/include/asm-powerpc/hugetlb.h
new file mode 100644
index 000000000000..649c6c3b87b3
--- /dev/null
+++ b/include/asm-powerpc/hugetlb.h
@@ -0,0 +1,79 @@
1#ifndef _ASM_POWERPC_HUGETLB_H
2#define _ASM_POWERPC_HUGETLB_H
3
4#include <asm/page.h>
5
6
7int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
8 unsigned long len);
9
10void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
11 unsigned long end, unsigned long floor,
12 unsigned long ceiling);
13
14void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
15 pte_t *ptep, pte_t pte);
16
17pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
18 pte_t *ptep);
19
20/*
21 * If the arch doesn't supply something else, assume that hugepage
22 * size aligned regions are ok without further preparation.
23 */
24static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
25{
26 if (len & ~HPAGE_MASK)
27 return -EINVAL;
28 if (addr & ~HPAGE_MASK)
29 return -EINVAL;
30 return 0;
31}
32
33static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
34{
35}
36
37static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
38 unsigned long addr, pte_t *ptep)
39{
40}
41
42static inline int huge_pte_none(pte_t pte)
43{
44 return pte_none(pte);
45}
46
47static inline pte_t huge_pte_wrprotect(pte_t pte)
48{
49 return pte_wrprotect(pte);
50}
51
52static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
53 unsigned long addr, pte_t *ptep)
54{
55 ptep_set_wrprotect(mm, addr, ptep);
56}
57
58static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
59 unsigned long addr, pte_t *ptep,
60 pte_t pte, int dirty)
61{
62 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
63}
64
65static inline pte_t huge_ptep_get(pte_t *ptep)
66{
67 return *ptep;
68}
69
70static inline int arch_prepare_hugepage(struct page *page)
71{
72 return 0;
73}
74
75static inline void arch_release_hugepage(struct page *page)
76{
77}
78
79#endif /* _ASM_POWERPC_HUGETLB_H */
diff --git a/include/asm-powerpc/page_64.h b/include/asm-powerpc/page_64.h
index 67834eae5702..25af4fc8daf4 100644
--- a/include/asm-powerpc/page_64.h
+++ b/include/asm-powerpc/page_64.h
@@ -128,11 +128,6 @@ extern void slice_init_context(struct mm_struct *mm, unsigned int psize);
128extern void slice_set_user_psize(struct mm_struct *mm, unsigned int psize); 128extern void slice_set_user_psize(struct mm_struct *mm, unsigned int psize);
129#define slice_mm_new_context(mm) ((mm)->context.id == 0) 129#define slice_mm_new_context(mm) ((mm)->context.id == 0)
130 130
131#define ARCH_HAS_HUGEPAGE_ONLY_RANGE
132extern int is_hugepage_only_range(struct mm_struct *m,
133 unsigned long addr,
134 unsigned long len);
135
136#endif /* __ASSEMBLY__ */ 131#endif /* __ASSEMBLY__ */
137#else 132#else
138#define slice_init() 133#define slice_init()
@@ -146,8 +141,6 @@ do { \
146 141
147#ifdef CONFIG_HUGETLB_PAGE 142#ifdef CONFIG_HUGETLB_PAGE
148 143
149#define ARCH_HAS_HUGETLB_FREE_PGD_RANGE
150#define ARCH_HAS_SETCLEAR_HUGE_PTE
151#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 144#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
152 145
153#endif /* !CONFIG_HUGETLB_PAGE */ 146#endif /* !CONFIG_HUGETLB_PAGE */
diff --git a/include/asm-powerpc/pgtable-ppc32.h b/include/asm-powerpc/pgtable-ppc32.h
index daea7692d070..7c97b5a08d08 100644
--- a/include/asm-powerpc/pgtable-ppc32.h
+++ b/include/asm-powerpc/pgtable-ppc32.h
@@ -504,6 +504,7 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
504static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 504static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
505static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 505static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
506static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 506static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
507static inline int pte_special(pte_t pte) { return 0; }
507 508
508static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 509static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
509static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 510static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
@@ -521,6 +522,8 @@ static inline pte_t pte_mkdirty(pte_t pte) {
521 pte_val(pte) |= _PAGE_DIRTY; return pte; } 522 pte_val(pte) |= _PAGE_DIRTY; return pte; }
522static inline pte_t pte_mkyoung(pte_t pte) { 523static inline pte_t pte_mkyoung(pte_t pte) {
523 pte_val(pte) |= _PAGE_ACCESSED; return pte; } 524 pte_val(pte) |= _PAGE_ACCESSED; return pte; }
525static inline pte_t pte_mkspecial(pte_t pte) {
526 return pte; }
524 527
525static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 528static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
526{ 529{
diff --git a/include/asm-powerpc/pgtable-ppc64.h b/include/asm-powerpc/pgtable-ppc64.h
index dd4c26dc57d2..27f18695f7d6 100644
--- a/include/asm-powerpc/pgtable-ppc64.h
+++ b/include/asm-powerpc/pgtable-ppc64.h
@@ -239,6 +239,7 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW;}
239static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;} 239static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY;}
240static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;} 240static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED;}
241static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;} 241static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE;}
242static inline int pte_special(pte_t pte) { return 0; }
242 243
243static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 244static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
244static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 245static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
@@ -257,6 +258,8 @@ static inline pte_t pte_mkyoung(pte_t pte) {
257 pte_val(pte) |= _PAGE_ACCESSED; return pte; } 258 pte_val(pte) |= _PAGE_ACCESSED; return pte; }
258static inline pte_t pte_mkhuge(pte_t pte) { 259static inline pte_t pte_mkhuge(pte_t pte) {
259 return pte; } 260 return pte; }
261static inline pte_t pte_mkspecial(pte_t pte) {
262 return pte; }
260 263
261/* Atomic PTE updates */ 264/* Atomic PTE updates */
262static inline unsigned long pte_update(struct mm_struct *mm, 265static inline unsigned long pte_update(struct mm_struct *mm,
diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
index 70435d32129a..55f9d38e3bf8 100644
--- a/include/asm-ppc/pgtable.h
+++ b/include/asm-ppc/pgtable.h
@@ -483,6 +483,7 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
483static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 483static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
484static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 484static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
485static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 485static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
486static inline int pte_special(pte_t pte) { return 0; }
486 487
487static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; } 488static inline void pte_uncache(pte_t pte) { pte_val(pte) |= _PAGE_NO_CACHE; }
488static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; } 489static inline void pte_cache(pte_t pte) { pte_val(pte) &= ~_PAGE_NO_CACHE; }
@@ -500,6 +501,8 @@ static inline pte_t pte_mkdirty(pte_t pte) {
500 pte_val(pte) |= _PAGE_DIRTY; return pte; } 501 pte_val(pte) |= _PAGE_DIRTY; return pte; }
501static inline pte_t pte_mkyoung(pte_t pte) { 502static inline pte_t pte_mkyoung(pte_t pte) {
502 pte_val(pte) |= _PAGE_ACCESSED; return pte; } 503 pte_val(pte) |= _PAGE_ACCESSED; return pte; }
504static inline pte_t pte_mkspecial(pte_t pte) {
505 return pte; }
503 506
504static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) 507static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
505{ 508{
diff --git a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
index 4c0698c0dda5..f8347ce9c5a1 100644
--- a/include/asm-s390/pgtable.h
+++ b/include/asm-s390/pgtable.h
@@ -220,6 +220,8 @@ extern char empty_zero_page[PAGE_SIZE];
220/* Software bits in the page table entry */ 220/* Software bits in the page table entry */
221#define _PAGE_SWT 0x001 /* SW pte type bit t */ 221#define _PAGE_SWT 0x001 /* SW pte type bit t */
222#define _PAGE_SWX 0x002 /* SW pte type bit x */ 222#define _PAGE_SWX 0x002 /* SW pte type bit x */
223#define _PAGE_SPECIAL 0x004 /* SW associated with special page */
224#define __HAVE_ARCH_PTE_SPECIAL
223 225
224/* Six different types of pages. */ 226/* Six different types of pages. */
225#define _PAGE_TYPE_EMPTY 0x400 227#define _PAGE_TYPE_EMPTY 0x400
@@ -518,6 +520,11 @@ static inline int pte_file(pte_t pte)
518 return (pte_val(pte) & mask) == _PAGE_TYPE_FILE; 520 return (pte_val(pte) & mask) == _PAGE_TYPE_FILE;
519} 521}
520 522
523static inline int pte_special(pte_t pte)
524{
525 return (pte_val(pte) & _PAGE_SPECIAL);
526}
527
521#define __HAVE_ARCH_PTE_SAME 528#define __HAVE_ARCH_PTE_SAME
522#define pte_same(a,b) (pte_val(a) == pte_val(b)) 529#define pte_same(a,b) (pte_val(a) == pte_val(b))
523 530
@@ -715,6 +722,12 @@ static inline pte_t pte_mkyoung(pte_t pte)
715 return pte; 722 return pte;
716} 723}
717 724
725static inline pte_t pte_mkspecial(pte_t pte)
726{
727 pte_val(pte) |= _PAGE_SPECIAL;
728 return pte;
729}
730
718#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 731#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
719static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, 732static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
720 unsigned long addr, pte_t *ptep) 733 unsigned long addr, pte_t *ptep)
diff --git a/include/asm-sh/hugetlb.h b/include/asm-sh/hugetlb.h
new file mode 100644
index 000000000000..02402303d89b
--- /dev/null
+++ b/include/asm-sh/hugetlb.h
@@ -0,0 +1,91 @@
1#ifndef _ASM_SH_HUGETLB_H
2#define _ASM_SH_HUGETLB_H
3
4#include <asm/page.h>
5
6
7static inline int is_hugepage_only_range(struct mm_struct *mm,
8 unsigned long addr,
9 unsigned long len) {
10 return 0;
11}
12
13/*
14 * If the arch doesn't supply something else, assume that hugepage
15 * size aligned regions are ok without further preparation.
16 */
17static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
18{
19 if (len & ~HPAGE_MASK)
20 return -EINVAL;
21 if (addr & ~HPAGE_MASK)
22 return -EINVAL;
23 return 0;
24}
25
26static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) {
27}
28
29static inline void hugetlb_free_pgd_range(struct mmu_gather **tlb,
30 unsigned long addr, unsigned long end,
31 unsigned long floor,
32 unsigned long ceiling)
33{
34 free_pgd_range(tlb, addr, end, floor, ceiling);
35}
36
37static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
38 pte_t *ptep, pte_t pte)
39{
40 set_pte_at(mm, addr, ptep, pte);
41}
42
43static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
44 unsigned long addr, pte_t *ptep)
45{
46 return ptep_get_and_clear(mm, addr, ptep);
47}
48
49static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
50 unsigned long addr, pte_t *ptep)
51{
52}
53
54static inline int huge_pte_none(pte_t pte)
55{
56 return pte_none(pte);
57}
58
59static inline pte_t huge_pte_wrprotect(pte_t pte)
60{
61 return pte_wrprotect(pte);
62}
63
64static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
65 unsigned long addr, pte_t *ptep)
66{
67 ptep_set_wrprotect(mm, addr, ptep);
68}
69
70static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
71 unsigned long addr, pte_t *ptep,
72 pte_t pte, int dirty)
73{
74 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
75}
76
77static inline pte_t huge_ptep_get(pte_t *ptep)
78{
79 return *ptep;
80}
81
82static inline int arch_prepare_hugepage(struct page *page)
83{
84 return 0;
85}
86
87static inline void arch_release_hugepage(struct page *page)
88{
89}
90
91#endif /* _ASM_SH_HUGETLB_H */
diff --git a/include/asm-sh/pgtable_32.h b/include/asm-sh/pgtable_32.h
index 3e3557c53c55..cbc731d35c25 100644
--- a/include/asm-sh/pgtable_32.h
+++ b/include/asm-sh/pgtable_32.h
@@ -326,6 +326,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
326#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY) 326#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY)
327#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED) 327#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED)
328#define pte_file(pte) ((pte).pte_low & _PAGE_FILE) 328#define pte_file(pte) ((pte).pte_low & _PAGE_FILE)
329#define pte_special(pte) (0)
329 330
330#ifdef CONFIG_X2TLB 331#ifdef CONFIG_X2TLB
331#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE) 332#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE)
@@ -356,6 +357,8 @@ PTE_BIT_FUNC(low, mkdirty, |= _PAGE_DIRTY);
356PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED); 357PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED);
357PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED); 358PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED);
358 359
360static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
361
359/* 362/*
360 * Macro and implementation to make a page protection as uncachable. 363 * Macro and implementation to make a page protection as uncachable.
361 */ 364 */
diff --git a/include/asm-sh/pgtable_64.h b/include/asm-sh/pgtable_64.h
index f9dd9d311441..c78990cda557 100644
--- a/include/asm-sh/pgtable_64.h
+++ b/include/asm-sh/pgtable_64.h
@@ -254,10 +254,11 @@ extern void __handle_bad_pmd_kernel(pmd_t * pmd);
254/* 254/*
255 * The following have defined behavior only work if pte_present() is true. 255 * The following have defined behavior only work if pte_present() is true.
256 */ 256 */
257static inline int pte_dirty(pte_t pte){ return pte_val(pte) & _PAGE_DIRTY; } 257static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
258static inline int pte_young(pte_t pte){ return pte_val(pte) & _PAGE_ACCESSED; } 258static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
259static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 259static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
260static inline int pte_write(pte_t pte){ return pte_val(pte) & _PAGE_WRITE; } 260static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
261static inline int pte_special(pte_t pte){ return 0; }
261 262
262static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; } 263static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; }
263static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 264static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
@@ -266,6 +267,7 @@ static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) |
266static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 267static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
267static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 268static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
268static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } 269static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; }
270static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
269 271
270 272
271/* 273/*
diff --git a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
index 2cc235b74d94..d84af6d95f5c 100644
--- a/include/asm-sparc/pgtable.h
+++ b/include/asm-sparc/pgtable.h
@@ -219,6 +219,11 @@ static inline int pte_file(pte_t pte)
219 return pte_val(pte) & BTFIXUP_HALF(pte_filei); 219 return pte_val(pte) & BTFIXUP_HALF(pte_filei);
220} 220}
221 221
222static inline int pte_special(pte_t pte)
223{
224 return 0;
225}
226
222/* 227/*
223 */ 228 */
224BTFIXUPDEF_HALF(pte_wrprotecti) 229BTFIXUPDEF_HALF(pte_wrprotecti)
@@ -251,6 +256,8 @@ BTFIXUPDEF_CALL_CONST(pte_t, pte_mkyoung, pte_t)
251#define pte_mkdirty(pte) BTFIXUP_CALL(pte_mkdirty)(pte) 256#define pte_mkdirty(pte) BTFIXUP_CALL(pte_mkdirty)(pte)
252#define pte_mkyoung(pte) BTFIXUP_CALL(pte_mkyoung)(pte) 257#define pte_mkyoung(pte) BTFIXUP_CALL(pte_mkyoung)(pte)
253 258
259#define pte_mkspecial(pte) (pte)
260
254#define pfn_pte(pfn, prot) mk_pte(pfn_to_page(pfn), prot) 261#define pfn_pte(pfn, prot) mk_pte(pfn_to_page(pfn), prot)
255 262
256BTFIXUPDEF_CALL(unsigned long, pte_pfn, pte_t) 263BTFIXUPDEF_CALL(unsigned long, pte_pfn, pte_t)
diff --git a/include/asm-sparc/processor.h b/include/asm-sparc/processor.h
index e3006979709b..8898efbbbe07 100644
--- a/include/asm-sparc/processor.h
+++ b/include/asm-sparc/processor.h
@@ -1,5 +1,4 @@
1/* $Id: processor.h,v 1.83 2001/10/08 09:32:13 davem Exp $ 1/* include/asm-sparc/processor.h
2 * include/asm-sparc/processor.h
3 * 2 *
4 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu) 3 * Copyright (C) 1994 David S. Miller (davem@caip.rutgers.edu)
5 */ 4 */
@@ -65,7 +64,6 @@ struct thread_struct {
65 struct fpq fpqueue[16]; 64 struct fpq fpqueue[16];
66 unsigned long flags; 65 unsigned long flags;
67 mm_segment_t current_ds; 66 mm_segment_t current_ds;
68 int new_signal;
69}; 67};
70 68
71#define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */ 69#define SPARC_FLAG_KTHREAD 0x1 /* task is a kernel thread */
diff --git a/include/asm-sparc64/floppy.h b/include/asm-sparc64/floppy.h
index c47f58d6c15c..ca19f80a9b7d 100644
--- a/include/asm-sparc64/floppy.h
+++ b/include/asm-sparc64/floppy.h
@@ -293,7 +293,6 @@ static int sun_fd_eject(int drive)
293 293
294#ifdef CONFIG_PCI 294#ifdef CONFIG_PCI
295#include <asm/ebus.h> 295#include <asm/ebus.h>
296#include <asm/isa.h>
297#include <asm/ns87303.h> 296#include <asm/ns87303.h>
298 297
299static struct ebus_dma_info sun_pci_fd_ebus_dma; 298static struct ebus_dma_info sun_pci_fd_ebus_dma;
@@ -558,82 +557,6 @@ static int __init ebus_fdthree_p(struct linux_ebus_device *edev)
558} 557}
559#endif 558#endif
560 559
561#ifdef CONFIG_PCI
562#undef ISA_FLOPPY_WORKS
563
564#ifdef ISA_FLOPPY_WORKS
565static unsigned long __init isa_floppy_init(void)
566{
567 struct sparc_isa_bridge *isa_br;
568 struct sparc_isa_device *isa_dev = NULL;
569
570 for_each_isa(isa_br) {
571 for_each_isadev(isa_dev, isa_br) {
572 if (!strcmp(isa_dev->prom_node->name, "dma")) {
573 struct sparc_isa_device *child =
574 isa_dev->child;
575
576 while (child) {
577 if (!strcmp(child->prom_node->name,
578 "floppy")) {
579 isa_dev = child;
580 goto isa_done;
581 }
582 child = child->next;
583 }
584 }
585 }
586 }
587isa_done:
588 if (!isa_dev)
589 return 0;
590
591 /* We could use DMA on devices behind the ISA bridge, but...
592 *
593 * There is a slight problem. Normally on x86 kit the x86 processor
594 * delays I/O port instructions when the ISA bus "dma in progress"
595 * signal is active. Well, sparc64 systems do not monitor this
596 * signal thus we would need to block all I/O port accesses in software
597 * when a dma transfer is active for some device.
598 */
599
600 sun_fdc = (struct sun_flpy_controller *)isa_dev->resource.start;
601 FLOPPY_IRQ = isa_dev->irq;
602
603 sun_fdops.fd_inb = sun_pci_fd_inb;
604 sun_fdops.fd_outb = sun_pci_fd_outb;
605
606 can_use_virtual_dma = use_virtual_dma = 1;
607 sun_fdops.fd_enable_dma = sun_fd_enable_dma;
608 sun_fdops.fd_disable_dma = sun_fd_disable_dma;
609 sun_fdops.fd_set_dma_mode = sun_fd_set_dma_mode;
610 sun_fdops.fd_set_dma_addr = sun_fd_set_dma_addr;
611 sun_fdops.fd_set_dma_count = sun_fd_set_dma_count;
612 sun_fdops.get_dma_residue = sun_get_dma_residue;
613
614 sun_fdops.fd_request_irq = sun_fd_request_irq;
615 sun_fdops.fd_free_irq = sun_fd_free_irq;
616
617 /* Floppy eject is manual. Actually, could determine this
618 * via presence of 'manual' property in OBP node.
619 */
620 sun_fdops.fd_eject = sun_pci_fd_eject;
621
622 fdc_status = (unsigned long) &sun_fdc->status_82077;
623
624 allowed_drive_mask = 0;
625 sun_floppy_types[0] = 0;
626 sun_floppy_types[1] = 4;
627
628 sun_pci_broken_drive = 1;
629 sun_fdops.fd_outb = sun_pci_fd_broken_outb;
630
631 return sun_floppy_types[0];
632}
633#endif /* ISA_FLOPPY_WORKS */
634
635#endif
636
637static unsigned long __init sun_floppy_init(void) 560static unsigned long __init sun_floppy_init(void)
638{ 561{
639 char state[128]; 562 char state[128];
@@ -667,13 +590,8 @@ static unsigned long __init sun_floppy_init(void)
667 } 590 }
668 } 591 }
669 ebus_done: 592 ebus_done:
670 if (!edev) { 593 if (!edev)
671#ifdef ISA_FLOPPY_WORKS
672 return isa_floppy_init();
673#else
674 return 0; 594 return 0;
675#endif
676 }
677 595
678 state_prop = of_get_property(edev->prom_node, "status", NULL); 596 state_prop = of_get_property(edev->prom_node, "status", NULL);
679 if (state_prop && !strncmp(state_prop, "disabled", 8)) 597 if (state_prop && !strncmp(state_prop, "disabled", 8))
diff --git a/include/asm-sparc64/hugetlb.h b/include/asm-sparc64/hugetlb.h
new file mode 100644
index 000000000000..412af58926a0
--- /dev/null
+++ b/include/asm-sparc64/hugetlb.h
@@ -0,0 +1,84 @@
1#ifndef _ASM_SPARC64_HUGETLB_H
2#define _ASM_SPARC64_HUGETLB_H
3
4#include <asm/page.h>
5
6
7void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
8 pte_t *ptep, pte_t pte);
9
10pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
11 pte_t *ptep);
12
13void hugetlb_prefault_arch_hook(struct mm_struct *mm);
14
15static inline int is_hugepage_only_range(struct mm_struct *mm,
16 unsigned long addr,
17 unsigned long len) {
18 return 0;
19}
20
21/*
22 * If the arch doesn't supply something else, assume that hugepage
23 * size aligned regions are ok without further preparation.
24 */
25static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
26{
27 if (len & ~HPAGE_MASK)
28 return -EINVAL;
29 if (addr & ~HPAGE_MASK)
30 return -EINVAL;
31 return 0;
32}
33
34static inline void hugetlb_free_pgd_range(struct mmu_gather **tlb,
35 unsigned long addr, unsigned long end,
36 unsigned long floor,
37 unsigned long ceiling)
38{
39 free_pgd_range(tlb, addr, end, floor, ceiling);
40}
41
42static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
43 unsigned long addr, pte_t *ptep)
44{
45}
46
47static inline int huge_pte_none(pte_t pte)
48{
49 return pte_none(pte);
50}
51
52static inline pte_t huge_pte_wrprotect(pte_t pte)
53{
54 return pte_wrprotect(pte);
55}
56
57static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
58 unsigned long addr, pte_t *ptep)
59{
60 ptep_set_wrprotect(mm, addr, ptep);
61}
62
63static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
64 unsigned long addr, pte_t *ptep,
65 pte_t pte, int dirty)
66{
67 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
68}
69
70static inline pte_t huge_ptep_get(pte_t *ptep)
71{
72 return *ptep;
73}
74
75static inline int arch_prepare_hugepage(struct page *page)
76{
77 return 0;
78}
79
80static inline void arch_release_hugepage(struct page *page)
81{
82}
83
84#endif /* _ASM_SPARC64_HUGETLB_H */
diff --git a/include/asm-sparc64/isa.h b/include/asm-sparc64/isa.h
deleted file mode 100644
index ecd9290f78d4..000000000000
--- a/include/asm-sparc64/isa.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/* $Id: isa.h,v 1.1 2001/05/11 04:31:55 davem Exp $
2 * isa.h: Sparc64 layer for PCI to ISA bridge devices.
3 *
4 * Copyright (C) 2001 David S. Miller (davem@redhat.com)
5 */
6
7#ifndef __SPARC64_ISA_H
8#define __SPARC64_ISA_H
9
10#include <asm/oplib.h>
11#include <asm/prom.h>
12#include <asm/of_device.h>
13
14struct sparc_isa_bridge;
15
16struct sparc_isa_device {
17 struct of_device ofdev;
18 struct sparc_isa_device *next;
19 struct sparc_isa_device *child;
20 struct sparc_isa_bridge *bus;
21 struct device_node *prom_node;
22 struct resource resource;
23 unsigned int irq;
24};
25#define to_isa_device(d) container_of(d, struct sparc_isa_device, ofdev.dev)
26
27struct sparc_isa_bridge {
28 struct of_device ofdev;
29 struct sparc_isa_bridge *next;
30 struct sparc_isa_device *devices;
31 struct pci_dev *self;
32 int index;
33 struct device_node *prom_node;
34};
35#define to_isa_bridge(d) container_of(d, struct sparc_isa_bridge, ofdev.dev)
36
37extern struct sparc_isa_bridge *isa_chain;
38
39extern void isa_init(void);
40
41#define for_each_isa(bus) \
42 for((bus) = isa_chain; (bus); (bus) = (bus)->next)
43
44#define for_each_isadev(dev, bus) \
45 for((dev) = (bus)->devices; (dev); (dev) = (dev)->next)
46
47#endif /* !(__SPARC64_ISA_H) */
diff --git a/include/asm-sparc64/page.h b/include/asm-sparc64/page.h
index e93a482aa24a..618117def0dc 100644
--- a/include/asm-sparc64/page.h
+++ b/include/asm-sparc64/page.h
@@ -39,8 +39,6 @@
39#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT) 39#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
40#define HPAGE_MASK (~(HPAGE_SIZE - 1UL)) 40#define HPAGE_MASK (~(HPAGE_SIZE - 1UL))
41#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 41#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
42#define ARCH_HAS_SETCLEAR_HUGE_PTE
43#define ARCH_HAS_HUGETLB_PREFAULT_HOOK
44#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 42#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
45#endif 43#endif
46 44
diff --git a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
index 549e45266b68..0e200e7acec7 100644
--- a/include/asm-sparc64/pgtable.h
+++ b/include/asm-sparc64/pgtable.h
@@ -506,6 +506,11 @@ static inline pte_t pte_mkyoung(pte_t pte)
506 return __pte(pte_val(pte) | mask); 506 return __pte(pte_val(pte) | mask);
507} 507}
508 508
509static inline pte_t pte_mkspecial(pte_t pte)
510{
511 return pte;
512}
513
509static inline unsigned long pte_young(pte_t pte) 514static inline unsigned long pte_young(pte_t pte)
510{ 515{
511 unsigned long mask; 516 unsigned long mask;
@@ -608,6 +613,11 @@ static inline unsigned long pte_present(pte_t pte)
608 return val; 613 return val;
609} 614}
610 615
616static inline int pte_special(pte_t pte)
617{
618 return 0;
619}
620
611#define pmd_set(pmdp, ptep) \ 621#define pmd_set(pmdp, ptep) \
612 (pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL)) 622 (pmd_val(*(pmdp)) = (__pa((unsigned long) (ptep)) >> 11UL))
613#define pud_set(pudp, pmdp) \ 623#define pud_set(pudp, pmdp) \
diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h
index b4b951d570bb..714b81956f32 100644
--- a/include/asm-sparc64/ptrace.h
+++ b/include/asm-sparc64/ptrace.h
@@ -1,4 +1,3 @@
1/* $Id: ptrace.h,v 1.14 2002/02/09 19:49:32 davem Exp $ */
2#ifndef _SPARC64_PTRACE_H 1#ifndef _SPARC64_PTRACE_H
3#define _SPARC64_PTRACE_H 2#define _SPARC64_PTRACE_H
4 3
@@ -8,10 +7,15 @@
8 * stack during a system call and basically all traps. 7 * stack during a system call and basically all traps.
9 */ 8 */
10 9
10/* This magic value must have the low 9 bits clear,
11 * as that is where we encode the %tt value, see below.
12 */
11#define PT_REGS_MAGIC 0x57ac6c00 13#define PT_REGS_MAGIC 0x57ac6c00
12 14
13#ifndef __ASSEMBLY__ 15#ifndef __ASSEMBLY__
14 16
17#include <linux/types.h>
18
15struct pt_regs { 19struct pt_regs {
16 unsigned long u_regs[16]; /* globals and ins */ 20 unsigned long u_regs[16]; /* globals and ins */
17 unsigned long tstate; 21 unsigned long tstate;
@@ -33,6 +37,23 @@ struct pt_regs {
33 unsigned int magic; 37 unsigned int magic;
34}; 38};
35 39
40static inline int pt_regs_trap_type(struct pt_regs *regs)
41{
42 return regs->magic & 0x1ff;
43}
44
45static inline int pt_regs_clear_trap_type(struct pt_regs *regs)
46{
47 return regs->magic &= ~0x1ff;
48}
49
50static inline bool pt_regs_is_syscall(struct pt_regs *regs)
51{
52 int tt = pt_regs_trap_type(regs);
53
54 return (tt == 0x110 || tt == 0x111 || tt == 0x16d);
55}
56
36struct pt_regs32 { 57struct pt_regs32 {
37 unsigned int psr; 58 unsigned int psr;
38 unsigned int pc; 59 unsigned int pc;
diff --git a/include/asm-sparc64/thread_info.h b/include/asm-sparc64/thread_info.h
index 98252cd44dd6..71e42d1a80d9 100644
--- a/include/asm-sparc64/thread_info.h
+++ b/include/asm-sparc64/thread_info.h
@@ -1,5 +1,4 @@
1/* $Id: thread_info.h,v 1.1 2002/02/10 00:00:58 davem Exp $ 1/* thread_info.h: sparc64 low-level thread information
2 * thread_info.h: sparc64 low-level thread information
3 * 2 *
4 * Copyright (C) 2002 David S. Miller (davem@redhat.com) 3 * Copyright (C) 2002 David S. Miller (davem@redhat.com)
5 */ 4 */
@@ -223,7 +222,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
223#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ 222#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
224#define TIF_PERFCTR 4 /* performance counters active */ 223#define TIF_PERFCTR 4 /* performance counters active */
225#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */ 224#define TIF_UNALIGNED 5 /* allowed to do unaligned accesses */
226#define TIF_NEWSIGNALS 6 /* wants new-style signals */ 225/* flag bit 6 is available */
227#define TIF_32BIT 7 /* 32-bit binary */ 226#define TIF_32BIT 7 /* 32-bit binary */
228/* flag bit 8 is available */ 227/* flag bit 8 is available */
229#define TIF_SECCOMP 9 /* secure computing */ 228#define TIF_SECCOMP 9 /* secure computing */
@@ -242,7 +241,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
242#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) 241#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
243#define _TIF_PERFCTR (1<<TIF_PERFCTR) 242#define _TIF_PERFCTR (1<<TIF_PERFCTR)
244#define _TIF_UNALIGNED (1<<TIF_UNALIGNED) 243#define _TIF_UNALIGNED (1<<TIF_UNALIGNED)
245#define _TIF_NEWSIGNALS (1<<TIF_NEWSIGNALS)
246#define _TIF_32BIT (1<<TIF_32BIT) 244#define _TIF_32BIT (1<<TIF_32BIT)
247#define _TIF_SECCOMP (1<<TIF_SECCOMP) 245#define _TIF_SECCOMP (1<<TIF_SECCOMP)
248#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) 246#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
diff --git a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
index 4102b443e925..02db81b7b86e 100644
--- a/include/asm-um/pgtable.h
+++ b/include/asm-um/pgtable.h
@@ -173,6 +173,11 @@ static inline int pte_newprot(pte_t pte)
173 return(pte_present(pte) && (pte_get_bits(pte, _PAGE_NEWPROT))); 173 return(pte_present(pte) && (pte_get_bits(pte, _PAGE_NEWPROT)));
174} 174}
175 175
176static inline int pte_special(pte_t pte)
177{
178 return 0;
179}
180
176/* 181/*
177 * ================================= 182 * =================================
178 * Flags setting section. 183 * Flags setting section.
@@ -241,6 +246,11 @@ static inline pte_t pte_mknewpage(pte_t pte)
241 return(pte); 246 return(pte);
242} 247}
243 248
249static inline pte_t pte_mkspecial(pte_t pte)
250{
251 return(pte);
252}
253
244static inline void set_pte(pte_t *pteptr, pte_t pteval) 254static inline void set_pte(pte_t *pteptr, pte_t pteval)
245{ 255{
246 pte_copy(*pteptr, pteval); 256 pte_copy(*pteptr, pteval);
diff --git a/include/asm-x86/geode.h b/include/asm-x86/geode.h
index 9870cc1f2f8f..7154dc4de951 100644
--- a/include/asm-x86/geode.h
+++ b/include/asm-x86/geode.h
@@ -30,7 +30,13 @@ extern int geode_get_dev_base(unsigned int dev);
30 30
31/* MSRS */ 31/* MSRS */
32 32
33#define GX_GLCP_SYS_RSTPLL 0x4C000014 33#define MSR_GLIU_P2D_RO0 0x10000029
34
35#define MSR_LX_GLD_MSR_CONFIG 0x48002001
36#define MSR_LX_MSR_PADSEL 0x48002011 /* NOT 0x48000011; the data
37 * sheet has the wrong value */
38#define MSR_GLCP_SYS_RSTPLL 0x4C000014
39#define MSR_GLCP_DOTPLL 0x4C000015
34 40
35#define MSR_LBAR_SMB 0x5140000B 41#define MSR_LBAR_SMB 0x5140000B
36#define MSR_LBAR_GPIO 0x5140000C 42#define MSR_LBAR_GPIO 0x5140000C
@@ -45,8 +51,14 @@ extern int geode_get_dev_base(unsigned int dev);
45#define MSR_PIC_ZSEL_LOW 0x51400022 51#define MSR_PIC_ZSEL_LOW 0x51400022
46#define MSR_PIC_ZSEL_HIGH 0x51400023 52#define MSR_PIC_ZSEL_HIGH 0x51400023
47 53
48#define MFGPT_IRQ_MSR 0x51400028 54#define MSR_MFGPT_IRQ 0x51400028
49#define MFGPT_NR_MSR 0x51400029 55#define MSR_MFGPT_NR 0x51400029
56#define MSR_MFGPT_SETUP 0x5140002B
57
58#define MSR_LX_SPARE_MSR 0x80000011 /* DC-specific */
59
60#define MSR_GX_GLD_MSR_CONFIG 0xC0002001
61#define MSR_GX_MSR_PADSEL 0xC0002011
50 62
51/* Resource Sizes */ 63/* Resource Sizes */
52 64
@@ -93,6 +105,15 @@ extern int geode_get_dev_base(unsigned int dev);
93#define PM_AWKD 0x50 105#define PM_AWKD 0x50
94#define PM_SSC 0x54 106#define PM_SSC 0x54
95 107
108/* VSA2 magic values */
109
110#define VSA_VRC_INDEX 0xAC1C
111#define VSA_VRC_DATA 0xAC1E
112#define VSA_VR_UNLOCK 0xFC53 /* unlock virtual register */
113#define VSA_VR_SIGNATURE 0x0003
114#define VSA_VR_MEM_SIZE 0x0200
115#define VSA_SIG 0x4132 /* signature is ascii 'VSA2' */
116
96/* GPIO */ 117/* GPIO */
97 118
98#define GPIO_OUTPUT_VAL 0x00 119#define GPIO_OUTPUT_VAL 0x00
@@ -164,6 +185,17 @@ static inline int is_geode(void)
164 return (is_geode_gx() || is_geode_lx()); 185 return (is_geode_gx() || is_geode_lx());
165} 186}
166 187
188/*
189 * The VSA has virtual registers that we can query for a signature.
190 */
191static inline int geode_has_vsa2(void)
192{
193 outw(VSA_VR_UNLOCK, VSA_VRC_INDEX);
194 outw(VSA_VR_SIGNATURE, VSA_VRC_INDEX);
195
196 return (inw(VSA_VRC_DATA) == VSA_SIG);
197}
198
167/* MFGPTs */ 199/* MFGPTs */
168 200
169#define MFGPT_MAX_TIMERS 8 201#define MFGPT_MAX_TIMERS 8
diff --git a/include/asm-x86/hugetlb.h b/include/asm-x86/hugetlb.h
new file mode 100644
index 000000000000..14171a4924f6
--- /dev/null
+++ b/include/asm-x86/hugetlb.h
@@ -0,0 +1,91 @@
1#ifndef _ASM_X86_HUGETLB_H
2#define _ASM_X86_HUGETLB_H
3
4#include <asm/page.h>
5
6
7static inline int is_hugepage_only_range(struct mm_struct *mm,
8 unsigned long addr,
9 unsigned long len) {
10 return 0;
11}
12
13/*
14 * If the arch doesn't supply something else, assume that hugepage
15 * size aligned regions are ok without further preparation.
16 */
17static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
18{
19 if (len & ~HPAGE_MASK)
20 return -EINVAL;
21 if (addr & ~HPAGE_MASK)
22 return -EINVAL;
23 return 0;
24}
25
26static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm) {
27}
28
29static inline void hugetlb_free_pgd_range(struct mmu_gather **tlb,
30 unsigned long addr, unsigned long end,
31 unsigned long floor,
32 unsigned long ceiling)
33{
34 free_pgd_range(tlb, addr, end, floor, ceiling);
35}
36
37static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
38 pte_t *ptep, pte_t pte)
39{
40 set_pte_at(mm, addr, ptep, pte);
41}
42
43static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
44 unsigned long addr, pte_t *ptep)
45{
46 return ptep_get_and_clear(mm, addr, ptep);
47}
48
49static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
50 unsigned long addr, pte_t *ptep)
51{
52}
53
54static inline int huge_pte_none(pte_t pte)
55{
56 return pte_none(pte);
57}
58
59static inline pte_t huge_pte_wrprotect(pte_t pte)
60{
61 return pte_wrprotect(pte);
62}
63
64static inline void huge_ptep_set_wrprotect(struct mm_struct *mm,
65 unsigned long addr, pte_t *ptep)
66{
67 ptep_set_wrprotect(mm, addr, ptep);
68}
69
70static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma,
71 unsigned long addr, pte_t *ptep,
72 pte_t pte, int dirty)
73{
74 return ptep_set_access_flags(vma, addr, ptep, pte, dirty);
75}
76
77static inline pte_t huge_ptep_get(pte_t *ptep)
78{
79 return *ptep;
80}
81
82static inline int arch_prepare_hugepage(struct page *page)
83{
84 return 0;
85}
86
87static inline void arch_release_hugepage(struct page *page)
88{
89}
90
91#endif /* _ASM_X86_HUGETLB_H */
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
index a496d6335d3b..801b31f71452 100644
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -195,6 +195,11 @@ static inline int pte_exec(pte_t pte)
195 return !(pte_val(pte) & _PAGE_NX); 195 return !(pte_val(pte) & _PAGE_NX);
196} 196}
197 197
198static inline int pte_special(pte_t pte)
199{
200 return 0;
201}
202
198static inline int pmd_large(pmd_t pte) 203static inline int pmd_large(pmd_t pte)
199{ 204{
200 return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == 205 return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
@@ -256,6 +261,11 @@ static inline pte_t pte_clrglobal(pte_t pte)
256 return __pte(pte_val(pte) & ~(pteval_t)_PAGE_GLOBAL); 261 return __pte(pte_val(pte) & ~(pteval_t)_PAGE_GLOBAL);
257} 262}
258 263
264static inline pte_t pte_mkspecial(pte_t pte)
265{
266 return pte;
267}
268
259extern pteval_t __supported_pte_mask; 269extern pteval_t __supported_pte_mask;
260 270
261static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot) 271static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
diff --git a/include/asm-xtensa/pgtable.h b/include/asm-xtensa/pgtable.h
index c8b024a48b4d..8014d96b21f1 100644
--- a/include/asm-xtensa/pgtable.h
+++ b/include/asm-xtensa/pgtable.h
@@ -210,6 +210,8 @@ static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITABLE; }
210static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } 210static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
211static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 211static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
212static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 212static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
213static inline int pte_special(pte_t pte) { return 0; }
214
213static inline pte_t pte_wrprotect(pte_t pte) 215static inline pte_t pte_wrprotect(pte_t pte)
214 { pte_val(pte) &= ~(_PAGE_WRITABLE | _PAGE_HW_WRITE); return pte; } 216 { pte_val(pte) &= ~(_PAGE_WRITABLE | _PAGE_HW_WRITE); return pte; }
215static inline pte_t pte_mkclean(pte_t pte) 217static inline pte_t pte_mkclean(pte_t pte)
@@ -222,6 +224,8 @@ static inline pte_t pte_mkyoung(pte_t pte)
222 { pte_val(pte) |= _PAGE_ACCESSED; return pte; } 224 { pte_val(pte) |= _PAGE_ACCESSED; return pte; }
223static inline pte_t pte_mkwrite(pte_t pte) 225static inline pte_t pte_mkwrite(pte_t pte)
224 { pte_val(pte) |= _PAGE_WRITABLE; return pte; } 226 { pte_val(pte) |= _PAGE_WRITABLE; return pte; }
227static inline pte_t pte_mkspecial(pte_t pte)
228 { return pte; }
225 229
226/* 230/*
227 * Conversion functions: convert a page and protection to a page entry, 231 * Conversion functions: convert a page and protection to a page entry,
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 1dbe074f1c64..43b406def35f 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -46,6 +46,8 @@
46 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n 46 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
47 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) 47 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
48 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit) 48 * bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit)
49 * bitmap_onto(dst, orig, relmap, nbits) *dst = orig relative to relmap
50 * bitmap_fold(dst, orig, sz, nbits) dst bits = orig bits mod sz
49 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf 51 * bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf
50 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf 52 * bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf
51 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf 53 * bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
@@ -121,6 +123,10 @@ extern void bitmap_remap(unsigned long *dst, const unsigned long *src,
121 const unsigned long *old, const unsigned long *new, int bits); 123 const unsigned long *old, const unsigned long *new, int bits);
122extern int bitmap_bitremap(int oldbit, 124extern int bitmap_bitremap(int oldbit,
123 const unsigned long *old, const unsigned long *new, int bits); 125 const unsigned long *old, const unsigned long *new, int bits);
126extern void bitmap_onto(unsigned long *dst, const unsigned long *orig,
127 const unsigned long *relmap, int bits);
128extern void bitmap_fold(unsigned long *dst, const unsigned long *orig,
129 int sz, int bits);
124extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order); 130extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order);
125extern void bitmap_release_region(unsigned long *bitmap, int pos, int order); 131extern void bitmap_release_region(unsigned long *bitmap, int pos, int order);
126extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order); 132extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h
index 4e4e340592fb..6a5dbdc8a7dc 100644
--- a/include/linux/bootmem.h
+++ b/include/linux/bootmem.h
@@ -101,6 +101,8 @@ extern void reserve_bootmem_node(pg_data_t *pgdat,
101extern void free_bootmem_node(pg_data_t *pgdat, 101extern void free_bootmem_node(pg_data_t *pgdat,
102 unsigned long addr, 102 unsigned long addr,
103 unsigned long size); 103 unsigned long size);
104extern void *alloc_bootmem_section(unsigned long size,
105 unsigned long section_nr);
104 106
105#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE 107#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
106#define alloc_bootmem_node(pgdat, x) \ 108#define alloc_bootmem_node(pgdat, x) \
diff --git a/include/linux/cache.h b/include/linux/cache.h
index 4552504c0228..97e24881c4c6 100644
--- a/include/linux/cache.h
+++ b/include/linux/cache.h
@@ -60,4 +60,8 @@
60#endif 60#endif
61#endif 61#endif
62 62
63#ifndef CONFIG_ARCH_HAS_CACHE_LINE_SIZE
64#define cache_line_size() L1_CACHE_BYTES
65#endif
66
63#endif /* __LINUX_CACHE_H */ 67#endif /* __LINUX_CACHE_H */
diff --git a/include/linux/capability.h b/include/linux/capability.h
index 7d50ff6d269f..eaab759b1460 100644
--- a/include/linux/capability.h
+++ b/include/linux/capability.h
@@ -155,6 +155,7 @@ typedef struct kernel_cap_struct {
155 * Add any capability from current's capability bounding set 155 * Add any capability from current's capability bounding set
156 * to the current process' inheritable set 156 * to the current process' inheritable set
157 * Allow taking bits out of capability bounding set 157 * Allow taking bits out of capability bounding set
158 * Allow modification of the securebits for a process
158 */ 159 */
159 160
160#define CAP_SETPCAP 8 161#define CAP_SETPCAP 8
@@ -490,8 +491,6 @@ extern const kernel_cap_t __cap_init_eff_set;
490int capable(int cap); 491int capable(int cap);
491int __capable(struct task_struct *t, int cap); 492int __capable(struct task_struct *t, int cap);
492 493
493extern long cap_prctl_drop(unsigned long cap);
494
495#endif /* __KERNEL__ */ 494#endif /* __KERNEL__ */
496 495
497#endif /* !_LINUX_CAPABILITY_H */ 496#endif /* !_LINUX_CAPABILITY_H */
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
index 259c8051155d..9650806fe2ea 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -14,6 +14,8 @@
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. 14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
15 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c 15 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c
16 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c. 16 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c.
17 * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c.
18 * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c.
17 * 19 *
18 * The available cpumask operations are: 20 * The available cpumask operations are:
19 * 21 *
@@ -53,7 +55,9 @@
53 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing 55 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
54 * int cpulist_parse(buf, map) Parse ascii string as cpulist 56 * int cpulist_parse(buf, map) Parse ascii string as cpulist
55 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit) 57 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
56 * int cpus_remap(dst, src, old, new) *dst = map(old, new)(src) 58 * void cpus_remap(dst, src, old, new) *dst = map(old, new)(src)
59 * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap
60 * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz
57 * 61 *
58 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask 62 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask
59 * 63 *
@@ -330,6 +334,22 @@ static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
330 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); 334 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
331} 335}
332 336
337#define cpus_onto(dst, orig, relmap) \
338 __cpus_onto(&(dst), &(orig), &(relmap), NR_CPUS)
339static inline void __cpus_onto(cpumask_t *dstp, const cpumask_t *origp,
340 const cpumask_t *relmapp, int nbits)
341{
342 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
343}
344
345#define cpus_fold(dst, orig, sz) \
346 __cpus_fold(&(dst), &(orig), sz, NR_CPUS)
347static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
348 int sz, int nbits)
349{
350 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
351}
352
333#if NR_CPUS > 1 353#if NR_CPUS > 1
334#define for_each_cpu_mask(cpu, mask) \ 354#define for_each_cpu_mask(cpu, mask) \
335 for ((cpu) = first_cpu(mask); \ 355 for ((cpu) = first_cpu(mask); \
diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
index 726761e24003..038578362b47 100644
--- a/include/linux/cpuset.h
+++ b/include/linux/cpuset.h
@@ -26,7 +26,7 @@ extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
26#define cpuset_current_mems_allowed (current->mems_allowed) 26#define cpuset_current_mems_allowed (current->mems_allowed)
27void cpuset_init_current_mems_allowed(void); 27void cpuset_init_current_mems_allowed(void);
28void cpuset_update_task_memory_state(void); 28void cpuset_update_task_memory_state(void);
29int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl); 29int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask);
30 30
31extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask); 31extern int __cpuset_zone_allowed_softwall(struct zone *z, gfp_t gfp_mask);
32extern int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask); 32extern int __cpuset_zone_allowed_hardwall(struct zone *z, gfp_t gfp_mask);
@@ -103,7 +103,7 @@ static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
103static inline void cpuset_init_current_mems_allowed(void) {} 103static inline void cpuset_init_current_mems_allowed(void) {}
104static inline void cpuset_update_task_memory_state(void) {} 104static inline void cpuset_update_task_memory_state(void) {}
105 105
106static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl) 106static inline int cpuset_nodemask_valid_mems_allowed(nodemask_t *nodemask)
107{ 107{
108 return 1; 108 return 1;
109} 109}
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 325acdf5c462..2a063b64133f 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -90,6 +90,7 @@ static inline int dmi_check_system(const struct dmi_system_id *list) { return 0;
90static inline const char * dmi_get_system_info(int field) { return NULL; } 90static inline const char * dmi_get_system_info(int field) { return NULL; }
91static inline const struct dmi_device * dmi_find_device(int type, const char *name, 91static inline const struct dmi_device * dmi_find_device(int type, const char *name,
92 const struct dmi_device *from) { return NULL; } 92 const struct dmi_device *from) { return NULL; }
93static inline void dmi_scan_machine(void) { return; }
93static inline int dmi_get_year(int year) { return 0; } 94static inline int dmi_get_year(int year) { return 0; }
94static inline int dmi_name_in_vendors(const char *s) { return 0; } 95static inline int dmi_name_in_vendors(const char *s) { return 0; }
95#define dmi_available 0 96#define dmi_available 0
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 58c57a33e5dd..72295b099228 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -791,6 +791,17 @@ struct fb_tile_ops {
791 */ 791 */
792#define FBINFO_MISC_ALWAYS_SETPAR 0x40000 792#define FBINFO_MISC_ALWAYS_SETPAR 0x40000
793 793
794/*
795 * Host and GPU endianness differ.
796 */
797#define FBINFO_FOREIGN_ENDIAN 0x100000
798/*
799 * Big endian math. This is the same flags as above, but with different
800 * meaning, it is set by the fb subsystem depending FOREIGN_ENDIAN flag
801 * and host endianness. Drivers should not use this flag.
802 */
803#define FBINFO_BE_MATH 0x100000
804
794struct fb_info { 805struct fb_info {
795 int node; 806 int node;
796 int flags; 807 int flags;
@@ -899,15 +910,11 @@ struct fb_info {
899 910
900#endif 911#endif
901 912
902#if defined (__BIG_ENDIAN) 913#define FB_LEFT_POS(p, bpp) (fb_be_math(p) ? (32 - (bpp)) : 0)
903#define FB_LEFT_POS(bpp) (32 - bpp) 914#define FB_SHIFT_HIGH(p, val, bits) (fb_be_math(p) ? (val) >> (bits) : \
904#define FB_SHIFT_HIGH(val, bits) ((val) >> (bits)) 915 (val) << (bits))
905#define FB_SHIFT_LOW(val, bits) ((val) << (bits)) 916#define FB_SHIFT_LOW(p, val, bits) (fb_be_math(p) ? (val) << (bits) : \
906#else 917 (val) >> (bits))
907#define FB_LEFT_POS(bpp) (0)
908#define FB_SHIFT_HIGH(val, bits) ((val) << (bits))
909#define FB_SHIFT_LOW(val, bits) ((val) >> (bits))
910#endif
911 918
912 /* 919 /*
913 * `Generic' versions of the frame buffer device operations 920 * `Generic' versions of the frame buffer device operations
@@ -970,6 +977,25 @@ extern void fb_deferred_io_cleanup(struct fb_info *info);
970extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, 977extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry,
971 int datasync); 978 int datasync);
972 979
980static inline bool fb_be_math(struct fb_info *info)
981{
982#ifdef CONFIG_FB_FOREIGN_ENDIAN
983#if defined(CONFIG_FB_BOTH_ENDIAN)
984 return info->flags & FBINFO_BE_MATH;
985#elif defined(CONFIG_FB_BIG_ENDIAN)
986 return true;
987#elif defined(CONFIG_FB_LITTLE_ENDIAN)
988 return false;
989#endif /* CONFIG_FB_BOTH_ENDIAN */
990#else
991#ifdef __BIG_ENDIAN
992 return true;
993#else
994 return false;
995#endif /* __BIG_ENDIAN */
996#endif /* CONFIG_FB_FOREIGN_ENDIAN */
997}
998
973/* drivers/video/fbsysfs.c */ 999/* drivers/video/fbsysfs.c */
974extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); 1000extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev);
975extern void framebuffer_release(struct fb_info *info); 1001extern void framebuffer_release(struct fb_info *info);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d6d7c52055c6..2c925747bc49 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -474,8 +474,8 @@ struct address_space_operations {
474 int (*releasepage) (struct page *, gfp_t); 474 int (*releasepage) (struct page *, gfp_t);
475 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 475 ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
476 loff_t offset, unsigned long nr_segs); 476 loff_t offset, unsigned long nr_segs);
477 struct page* (*get_xip_page)(struct address_space *, sector_t, 477 int (*get_xip_mem)(struct address_space *, pgoff_t, int,
478 int); 478 void **, unsigned long *);
479 /* migrate the contents of a page to the specified target */ 479 /* migrate the contents of a page to the specified target */
480 int (*migratepage) (struct address_space *, 480 int (*migratepage) (struct address_space *,
481 struct page *, struct page *); 481 struct page *, struct page *);
@@ -1178,7 +1178,8 @@ struct block_device_operations {
1178 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); 1178 int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
1179 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); 1179 long (*unlocked_ioctl) (struct file *, unsigned, unsigned long);
1180 long (*compat_ioctl) (struct file *, unsigned, unsigned long); 1180 long (*compat_ioctl) (struct file *, unsigned, unsigned long);
1181 int (*direct_access) (struct block_device *, sector_t, unsigned long *); 1181 int (*direct_access) (struct block_device *, sector_t,
1182 void **, unsigned long *);
1182 int (*media_changed) (struct gendisk *); 1183 int (*media_changed) (struct gendisk *);
1183 int (*revalidate_disk) (struct gendisk *); 1184 int (*revalidate_disk) (struct gendisk *);
1184 int (*getgeo)(struct block_device *, struct hd_geometry *); 1185 int (*getgeo)(struct block_device *, struct hd_geometry *);
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 164be9da3c1b..c37653b6843f 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -119,35 +119,22 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
119 119
120static inline enum zone_type gfp_zone(gfp_t flags) 120static inline enum zone_type gfp_zone(gfp_t flags)
121{ 121{
122 int base = 0;
123
124#ifdef CONFIG_NUMA
125 if (flags & __GFP_THISNODE)
126 base = MAX_NR_ZONES;
127#endif
128
129#ifdef CONFIG_ZONE_DMA 122#ifdef CONFIG_ZONE_DMA
130 if (flags & __GFP_DMA) 123 if (flags & __GFP_DMA)
131 return base + ZONE_DMA; 124 return ZONE_DMA;
132#endif 125#endif
133#ifdef CONFIG_ZONE_DMA32 126#ifdef CONFIG_ZONE_DMA32
134 if (flags & __GFP_DMA32) 127 if (flags & __GFP_DMA32)
135 return base + ZONE_DMA32; 128 return ZONE_DMA32;
136#endif 129#endif
137 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) == 130 if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
138 (__GFP_HIGHMEM | __GFP_MOVABLE)) 131 (__GFP_HIGHMEM | __GFP_MOVABLE))
139 return base + ZONE_MOVABLE; 132 return ZONE_MOVABLE;
140#ifdef CONFIG_HIGHMEM 133#ifdef CONFIG_HIGHMEM
141 if (flags & __GFP_HIGHMEM) 134 if (flags & __GFP_HIGHMEM)
142 return base + ZONE_HIGHMEM; 135 return ZONE_HIGHMEM;
143#endif 136#endif
144 return base + ZONE_NORMAL; 137 return ZONE_NORMAL;
145}
146
147static inline gfp_t set_migrateflags(gfp_t gfp, gfp_t migrate_flags)
148{
149 BUG_ON((gfp & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
150 return (gfp & ~(GFP_MOVABLE_MASK)) | migrate_flags;
151} 138}
152 139
153/* 140/*
@@ -157,13 +144,27 @@ static inline gfp_t set_migrateflags(gfp_t gfp, gfp_t migrate_flags)
157 * virtual kernel addresses to the allocated page(s). 144 * virtual kernel addresses to the allocated page(s).
158 */ 145 */
159 146
147static inline int gfp_zonelist(gfp_t flags)
148{
149 if (NUMA_BUILD && unlikely(flags & __GFP_THISNODE))
150 return 1;
151
152 return 0;
153}
154
160/* 155/*
161 * We get the zone list from the current node and the gfp_mask. 156 * We get the zone list from the current node and the gfp_mask.
162 * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones. 157 * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones.
158 * There are two zonelists per node, one for all zones with memory and
159 * one containing just zones from the node the zonelist belongs to.
163 * 160 *
164 * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets 161 * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets
165 * optimized to &contig_page_data at compile-time. 162 * optimized to &contig_page_data at compile-time.
166 */ 163 */
164static inline struct zonelist *node_zonelist(int nid, gfp_t flags)
165{
166 return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags);
167}
167 168
168#ifndef HAVE_ARCH_FREE_PAGE 169#ifndef HAVE_ARCH_FREE_PAGE
169static inline void arch_free_page(struct page *page, int order) { } 170static inline void arch_free_page(struct page *page, int order) { }
@@ -174,6 +175,10 @@ static inline void arch_alloc_page(struct page *page, int order) { }
174 175
175extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *); 176extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *);
176 177
178extern struct page *
179__alloc_pages_nodemask(gfp_t, unsigned int,
180 struct zonelist *, nodemask_t *nodemask);
181
177static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, 182static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
178 unsigned int order) 183 unsigned int order)
179{ 184{
@@ -184,8 +189,7 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
184 if (nid < 0) 189 if (nid < 0)
185 nid = numa_node_id(); 190 nid = numa_node_id();
186 191
187 return __alloc_pages(gfp_mask, order, 192 return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
188 NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
189} 193}
190 194
191#ifdef CONFIG_NUMA 195#ifdef CONFIG_NUMA
diff --git a/include/linux/hid.h b/include/linux/hid.h
index d951ec411241..4ce3b7a979ba 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -498,13 +498,13 @@ struct hid_parser {
498 498
499struct hid_class_descriptor { 499struct hid_class_descriptor {
500 __u8 bDescriptorType; 500 __u8 bDescriptorType;
501 __u16 wDescriptorLength; 501 __le16 wDescriptorLength;
502} __attribute__ ((packed)); 502} __attribute__ ((packed));
503 503
504struct hid_descriptor { 504struct hid_descriptor {
505 __u8 bLength; 505 __u8 bLength;
506 __u8 bDescriptorType; 506 __u8 bDescriptorType;
507 __u16 bcdHID; 507 __le16 bcdHID;
508 __u8 bCountryCode; 508 __u8 bCountryCode;
509 __u8 bNumDescriptors; 509 __u8 bNumDescriptors;
510 510
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index addca4cd4f11..a79e80b689d8 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -8,6 +8,7 @@
8#include <linux/mempolicy.h> 8#include <linux/mempolicy.h>
9#include <linux/shm.h> 9#include <linux/shm.h>
10#include <asm/tlbflush.h> 10#include <asm/tlbflush.h>
11#include <asm/hugetlb.h>
11 12
12struct ctl_table; 13struct ctl_table;
13 14
@@ -51,51 +52,6 @@ int pmd_huge(pmd_t pmd);
51void hugetlb_change_protection(struct vm_area_struct *vma, 52void hugetlb_change_protection(struct vm_area_struct *vma,
52 unsigned long address, unsigned long end, pgprot_t newprot); 53 unsigned long address, unsigned long end, pgprot_t newprot);
53 54
54#ifndef ARCH_HAS_HUGEPAGE_ONLY_RANGE
55#define is_hugepage_only_range(mm, addr, len) 0
56#endif
57
58#ifndef ARCH_HAS_HUGETLB_FREE_PGD_RANGE
59#define hugetlb_free_pgd_range free_pgd_range
60#else
61void hugetlb_free_pgd_range(struct mmu_gather **tlb, unsigned long addr,
62 unsigned long end, unsigned long floor,
63 unsigned long ceiling);
64#endif
65
66#ifndef ARCH_HAS_PREPARE_HUGEPAGE_RANGE
67/*
68 * If the arch doesn't supply something else, assume that hugepage
69 * size aligned regions are ok without further preparation.
70 */
71static inline int prepare_hugepage_range(unsigned long addr, unsigned long len)
72{
73 if (len & ~HPAGE_MASK)
74 return -EINVAL;
75 if (addr & ~HPAGE_MASK)
76 return -EINVAL;
77 return 0;
78}
79#else
80int prepare_hugepage_range(unsigned long addr, unsigned long len);
81#endif
82
83#ifndef ARCH_HAS_SETCLEAR_HUGE_PTE
84#define set_huge_pte_at(mm, addr, ptep, pte) set_pte_at(mm, addr, ptep, pte)
85#define huge_ptep_get_and_clear(mm, addr, ptep) ptep_get_and_clear(mm, addr, ptep)
86#else
87void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
88 pte_t *ptep, pte_t pte);
89pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
90 pte_t *ptep);
91#endif
92
93#ifndef ARCH_HAS_HUGETLB_PREFAULT_HOOK
94#define hugetlb_prefault_arch_hook(mm) do { } while (0)
95#else
96void hugetlb_prefault_arch_hook(struct mm_struct *mm);
97#endif
98
99#else /* !CONFIG_HUGETLB_PAGE */ 55#else /* !CONFIG_HUGETLB_PAGE */
100 56
101static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 57static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index e92170dda245..f65e58a1d925 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -613,14 +613,9 @@ struct i2o_sys_tbl {
613extern struct list_head i2o_controllers; 613extern struct list_head i2o_controllers;
614 614
615/* Message functions */ 615/* Message functions */
616static inline struct i2o_message *i2o_msg_get(struct i2o_controller *);
617extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int); 616extern struct i2o_message *i2o_msg_get_wait(struct i2o_controller *, int);
618static inline void i2o_msg_post(struct i2o_controller *, struct i2o_message *);
619static inline int i2o_msg_post_wait(struct i2o_controller *,
620 struct i2o_message *, unsigned long);
621extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *, 617extern int i2o_msg_post_wait_mem(struct i2o_controller *, struct i2o_message *,
622 unsigned long, struct i2o_dma *); 618 unsigned long, struct i2o_dma *);
623static inline void i2o_flush_reply(struct i2o_controller *, u32);
624 619
625/* IOP functions */ 620/* IOP functions */
626extern int i2o_status_get(struct i2o_controller *); 621extern int i2o_status_get(struct i2o_controller *);
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 37a6f5bc4a92..bf6b8a61f8db 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -9,6 +9,7 @@
9#include <linux/ipc.h> 9#include <linux/ipc.h>
10#include <linux/pid_namespace.h> 10#include <linux/pid_namespace.h>
11#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
12#include <linux/securebits.h>
12#include <net/net_namespace.h> 13#include <net/net_namespace.h>
13 14
14#define INIT_FDTABLE \ 15#define INIT_FDTABLE \
@@ -172,7 +173,7 @@ extern struct group_info init_groups;
172 .cap_inheritable = CAP_INIT_INH_SET, \ 173 .cap_inheritable = CAP_INIT_INH_SET, \
173 .cap_permitted = CAP_FULL_SET, \ 174 .cap_permitted = CAP_FULL_SET, \
174 .cap_bset = CAP_INIT_BSET, \ 175 .cap_bset = CAP_INIT_BSET, \
175 .keep_capabilities = 0, \ 176 .securebits = SECUREBITS_DEFAULT, \
176 .user = INIT_USER, \ 177 .user = INIT_USER, \
177 .comm = "swapper", \ 178 .comm = "swapper", \
178 .thread = INIT_THREAD, \ 179 .thread = INIT_THREAD, \
diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h
index 0f28486f6360..1036631ff4fa 100644
--- a/include/linux/kprobes.h
+++ b/include/linux/kprobes.h
@@ -173,6 +173,13 @@ struct kretprobe_blackpoint {
173 const char *name; 173 const char *name;
174 void *addr; 174 void *addr;
175}; 175};
176
177struct kprobe_blackpoint {
178 const char *name;
179 unsigned long start_addr;
180 unsigned long range;
181};
182
176extern struct kretprobe_blackpoint kretprobe_blacklist[]; 183extern struct kretprobe_blackpoint kretprobe_blacklist[];
177 184
178static inline void kretprobe_assert(struct kretprobe_instance *ri, 185static inline void kretprobe_assert(struct kretprobe_instance *ri,
@@ -227,15 +234,21 @@ static inline struct kprobe_ctlblk *get_kprobe_ctlblk(void)
227 234
228int register_kprobe(struct kprobe *p); 235int register_kprobe(struct kprobe *p);
229void unregister_kprobe(struct kprobe *p); 236void unregister_kprobe(struct kprobe *p);
237int register_kprobes(struct kprobe **kps, int num);
238void unregister_kprobes(struct kprobe **kps, int num);
230int setjmp_pre_handler(struct kprobe *, struct pt_regs *); 239int setjmp_pre_handler(struct kprobe *, struct pt_regs *);
231int longjmp_break_handler(struct kprobe *, struct pt_regs *); 240int longjmp_break_handler(struct kprobe *, struct pt_regs *);
232int register_jprobe(struct jprobe *p); 241int register_jprobe(struct jprobe *p);
233void unregister_jprobe(struct jprobe *p); 242void unregister_jprobe(struct jprobe *p);
243int register_jprobes(struct jprobe **jps, int num);
244void unregister_jprobes(struct jprobe **jps, int num);
234void jprobe_return(void); 245void jprobe_return(void);
235unsigned long arch_deref_entry_point(void *); 246unsigned long arch_deref_entry_point(void *);
236 247
237int register_kretprobe(struct kretprobe *rp); 248int register_kretprobe(struct kretprobe *rp);
238void unregister_kretprobe(struct kretprobe *rp); 249void unregister_kretprobe(struct kretprobe *rp);
250int register_kretprobes(struct kretprobe **rps, int num);
251void unregister_kretprobes(struct kretprobe **rps, int num);
239 252
240void kprobe_flush_task(struct task_struct *tk); 253void kprobe_flush_task(struct task_struct *tk);
241void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head); 254void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
@@ -254,16 +267,30 @@ static inline int register_kprobe(struct kprobe *p)
254{ 267{
255 return -ENOSYS; 268 return -ENOSYS;
256} 269}
270static inline int register_kprobes(struct kprobe **kps, int num)
271{
272 return -ENOSYS;
273}
257static inline void unregister_kprobe(struct kprobe *p) 274static inline void unregister_kprobe(struct kprobe *p)
258{ 275{
259} 276}
277static inline void unregister_kprobes(struct kprobe **kps, int num)
278{
279}
260static inline int register_jprobe(struct jprobe *p) 280static inline int register_jprobe(struct jprobe *p)
261{ 281{
262 return -ENOSYS; 282 return -ENOSYS;
263} 283}
284static inline int register_jprobes(struct jprobe **jps, int num)
285{
286 return -ENOSYS;
287}
264static inline void unregister_jprobe(struct jprobe *p) 288static inline void unregister_jprobe(struct jprobe *p)
265{ 289{
266} 290}
291static inline void unregister_jprobes(struct jprobe **jps, int num)
292{
293}
267static inline void jprobe_return(void) 294static inline void jprobe_return(void)
268{ 295{
269} 296}
@@ -271,9 +298,16 @@ static inline int register_kretprobe(struct kretprobe *rp)
271{ 298{
272 return -ENOSYS; 299 return -ENOSYS;
273} 300}
301static inline int register_kretprobes(struct kretprobe **rps, int num)
302{
303 return -ENOSYS;
304}
274static inline void unregister_kretprobe(struct kretprobe *rp) 305static inline void unregister_kretprobe(struct kretprobe *rp)
275{ 306{
276} 307}
308static inline void unregister_kretprobes(struct kretprobe **rps, int num)
309{
310}
277static inline void kprobe_flush_task(struct task_struct *tk) 311static inline void kprobe_flush_task(struct task_struct *tk)
278{ 312{
279} 313}
diff --git a/include/linux/list.h b/include/linux/list.h
index dac16f99c701..b4a939b6b625 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -319,6 +319,15 @@ static inline int list_empty_careful(const struct list_head *head)
319 return (next == head) && (next == head->prev); 319 return (next == head) && (next == head->prev);
320} 320}
321 321
322/**
323 * list_is_singular - tests whether a list has just one entry.
324 * @head: the list to test.
325 */
326static inline int list_is_singular(const struct list_head *head)
327{
328 return !list_empty(head) && (head->next == head->prev);
329}
330
322static inline void __list_splice(struct list_head *list, 331static inline void __list_splice(struct list_head *list,
323 struct list_head *head) 332 struct list_head *head)
324{ 333{
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index 8fee7a45736b..73e358612eaf 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -8,8 +8,18 @@
8struct page; 8struct page;
9struct zone; 9struct zone;
10struct pglist_data; 10struct pglist_data;
11struct mem_section;
11 12
12#ifdef CONFIG_MEMORY_HOTPLUG 13#ifdef CONFIG_MEMORY_HOTPLUG
14
15/*
16 * Magic number for free bootmem.
17 * The normal smallest mapcount is -1. Here is smaller value than it.
18 */
19#define SECTION_INFO 0xfffffffe
20#define MIX_INFO 0xfffffffd
21#define NODE_INFO 0xfffffffc
22
13/* 23/*
14 * pgdat resizing functions 24 * pgdat resizing functions
15 */ 25 */
@@ -64,9 +74,11 @@ extern int offline_pages(unsigned long, unsigned long, unsigned long);
64/* reasonably generic interface to expand the physical pages in a zone */ 74/* reasonably generic interface to expand the physical pages in a zone */
65extern int __add_pages(struct zone *zone, unsigned long start_pfn, 75extern int __add_pages(struct zone *zone, unsigned long start_pfn,
66 unsigned long nr_pages); 76 unsigned long nr_pages);
77extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
78 unsigned long nr_pages);
67 79
68/* 80/*
69 * Walk thorugh all memory which is registered as resource. 81 * Walk through all memory which is registered as resource.
70 * arg is (start_pfn, nr_pages, private_arg_pointer) 82 * arg is (start_pfn, nr_pages, private_arg_pointer)
71 */ 83 */
72extern int walk_memory_resource(unsigned long start_pfn, 84extern int walk_memory_resource(unsigned long start_pfn,
@@ -142,6 +154,18 @@ static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat)
142#endif /* CONFIG_NUMA */ 154#endif /* CONFIG_NUMA */
143#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ 155#endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
144 156
157#ifdef CONFIG_SPARSEMEM_VMEMMAP
158static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
159{
160}
161static inline void put_page_bootmem(struct page *page)
162{
163}
164#else
165extern void register_page_bootmem_info_node(struct pglist_data *pgdat);
166extern void put_page_bootmem(struct page *page);
167#endif
168
145#else /* ! CONFIG_MEMORY_HOTPLUG */ 169#else /* ! CONFIG_MEMORY_HOTPLUG */
146/* 170/*
147 * Stub functions for when hotplug is off 171 * Stub functions for when hotplug is off
@@ -169,6 +193,10 @@ static inline int mhp_notimplemented(const char *func)
169 return -ENOSYS; 193 return -ENOSYS;
170} 194}
171 195
196static inline void register_page_bootmem_info_node(struct pglist_data *pgdat)
197{
198}
199
172#endif /* ! CONFIG_MEMORY_HOTPLUG */ 200#endif /* ! CONFIG_MEMORY_HOTPLUG */
173 201
174extern int add_memory(int nid, u64 start, u64 size); 202extern int add_memory(int nid, u64 start, u64 size);
@@ -176,5 +204,8 @@ extern int arch_add_memory(int nid, u64 start, u64 size);
176extern int remove_memory(u64 start, u64 size); 204extern int remove_memory(u64 start, u64 size);
177extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn, 205extern int sparse_add_one_section(struct zone *zone, unsigned long start_pfn,
178 int nr_pages); 206 int nr_pages);
207extern void sparse_remove_one_section(struct zone *zone, struct mem_section *ms);
208extern struct page *sparse_decode_mem_map(unsigned long coded_mem_map,
209 unsigned long pnum);
179 210
180#endif /* __LINUX_MEMORY_HOTPLUG_H */ 211#endif /* __LINUX_MEMORY_HOTPLUG_H */
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 59c4865bc85f..3a39570b81b8 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -8,15 +8,32 @@
8 * Copyright 2003,2004 Andi Kleen SuSE Labs 8 * Copyright 2003,2004 Andi Kleen SuSE Labs
9 */ 9 */
10 10
11/*
12 * Both the MPOL_* mempolicy mode and the MPOL_F_* optional mode flags are
13 * passed by the user to either set_mempolicy() or mbind() in an 'int' actual.
14 * The MPOL_MODE_FLAGS macro determines the legal set of optional mode flags.
15 */
16
11/* Policies */ 17/* Policies */
12#define MPOL_DEFAULT 0 18enum {
13#define MPOL_PREFERRED 1 19 MPOL_DEFAULT,
14#define MPOL_BIND 2 20 MPOL_PREFERRED,
15#define MPOL_INTERLEAVE 3 21 MPOL_BIND,
22 MPOL_INTERLEAVE,
23 MPOL_MAX, /* always last member of enum */
24};
16 25
17#define MPOL_MAX MPOL_INTERLEAVE 26/* Flags for set_mempolicy */
27#define MPOL_F_STATIC_NODES (1 << 15)
28#define MPOL_F_RELATIVE_NODES (1 << 14)
18 29
19/* Flags for get_mem_policy */ 30/*
31 * MPOL_MODE_FLAGS is the union of all possible optional mode flags passed to
32 * either set_mempolicy() or mbind().
33 */
34#define MPOL_MODE_FLAGS (MPOL_F_STATIC_NODES | MPOL_F_RELATIVE_NODES)
35
36/* Flags for get_mempolicy */
20#define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */ 37#define MPOL_F_NODE (1<<0) /* return next IL mode instead of node mask */
21#define MPOL_F_ADDR (1<<1) /* look up vma using address */ 38#define MPOL_F_ADDR (1<<1) /* look up vma using address */
22#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */ 39#define MPOL_F_MEMS_ALLOWED (1<<2) /* return allowed memories */
@@ -27,6 +44,14 @@
27#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */ 44#define MPOL_MF_MOVE_ALL (1<<2) /* Move every page to conform to mapping */
28#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */ 45#define MPOL_MF_INTERNAL (1<<3) /* Internal flags start here */
29 46
47/*
48 * Internal flags that share the struct mempolicy flags word with
49 * "mode flags". These flags are allocated from bit 0 up, as they
50 * are never OR'ed into the mode in mempolicy API arguments.
51 */
52#define MPOL_F_SHARED (1 << 0) /* identify shared policies */
53#define MPOL_F_LOCAL (1 << 1) /* preferred local allocation */
54
30#ifdef __KERNEL__ 55#ifdef __KERNEL__
31 56
32#include <linux/mmzone.h> 57#include <linux/mmzone.h>
@@ -35,7 +60,6 @@
35#include <linux/spinlock.h> 60#include <linux/spinlock.h>
36#include <linux/nodemask.h> 61#include <linux/nodemask.h>
37 62
38struct vm_area_struct;
39struct mm_struct; 63struct mm_struct;
40 64
41#ifdef CONFIG_NUMA 65#ifdef CONFIG_NUMA
@@ -54,22 +78,27 @@ struct mm_struct;
54 * mmap_sem. 78 * mmap_sem.
55 * 79 *
56 * Freeing policy: 80 * Freeing policy:
57 * When policy is MPOL_BIND v.zonelist is kmalloc'ed and must be kfree'd. 81 * Mempolicy objects are reference counted. A mempolicy will be freed when
58 * All other policies don't have any external state. mpol_free() handles this. 82 * mpol_put() decrements the reference count to zero.
59 * 83 *
60 * Copying policy objects: 84 * Duplicating policy objects:
61 * For MPOL_BIND the zonelist must be always duplicated. mpol_clone() does this. 85 * mpol_dup() allocates a new mempolicy and copies the specified mempolicy
86 * to the new storage. The reference count of the new object is initialized
87 * to 1, representing the caller of mpol_dup().
62 */ 88 */
63struct mempolicy { 89struct mempolicy {
64 atomic_t refcnt; 90 atomic_t refcnt;
65 short policy; /* See MPOL_* above */ 91 unsigned short mode; /* See MPOL_* above */
92 unsigned short flags; /* See set_mempolicy() MPOL_F_* above */
66 union { 93 union {
67 struct zonelist *zonelist; /* bind */
68 short preferred_node; /* preferred */ 94 short preferred_node; /* preferred */
69 nodemask_t nodes; /* interleave */ 95 nodemask_t nodes; /* interleave/bind */
70 /* undefined for default */ 96 /* undefined for default */
71 } v; 97 } v;
72 nodemask_t cpuset_mems_allowed; /* mempolicy relative to these nodes */ 98 union {
99 nodemask_t cpuset_mems_allowed; /* relative to these nodes */
100 nodemask_t user_nodemask; /* nodemask passed by user */
101 } w;
73}; 102};
74 103
75/* 104/*
@@ -77,18 +106,43 @@ struct mempolicy {
77 * The default fast path of a NULL MPOL_DEFAULT policy is always inlined. 106 * The default fast path of a NULL MPOL_DEFAULT policy is always inlined.
78 */ 107 */
79 108
80extern void __mpol_free(struct mempolicy *pol); 109extern void __mpol_put(struct mempolicy *pol);
81static inline void mpol_free(struct mempolicy *pol) 110static inline void mpol_put(struct mempolicy *pol)
82{ 111{
83 if (pol) 112 if (pol)
84 __mpol_free(pol); 113 __mpol_put(pol);
85} 114}
86 115
87extern struct mempolicy *__mpol_copy(struct mempolicy *pol); 116/*
88static inline struct mempolicy *mpol_copy(struct mempolicy *pol) 117 * Does mempolicy pol need explicit unref after use?
118 * Currently only needed for shared policies.
119 */
120static inline int mpol_needs_cond_ref(struct mempolicy *pol)
121{
122 return (pol && (pol->flags & MPOL_F_SHARED));
123}
124
125static inline void mpol_cond_put(struct mempolicy *pol)
126{
127 if (mpol_needs_cond_ref(pol))
128 __mpol_put(pol);
129}
130
131extern struct mempolicy *__mpol_cond_copy(struct mempolicy *tompol,
132 struct mempolicy *frompol);
133static inline struct mempolicy *mpol_cond_copy(struct mempolicy *tompol,
134 struct mempolicy *frompol)
135{
136 if (!frompol)
137 return frompol;
138 return __mpol_cond_copy(tompol, frompol);
139}
140
141extern struct mempolicy *__mpol_dup(struct mempolicy *pol);
142static inline struct mempolicy *mpol_dup(struct mempolicy *pol)
89{ 143{
90 if (pol) 144 if (pol)
91 pol = __mpol_copy(pol); 145 pol = __mpol_dup(pol);
92 return pol; 146 return pol;
93} 147}
94 148
@@ -108,11 +162,6 @@ static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
108 return 1; 162 return 1;
109 return __mpol_equal(a, b); 163 return __mpol_equal(a, b);
110} 164}
111#define vma_mpol_equal(a,b) mpol_equal(vma_policy(a), vma_policy(b))
112
113/* Could later add inheritance of the process policy here. */
114
115#define mpol_set_vma_default(vma) ((vma)->vm_policy = NULL)
116 165
117/* 166/*
118 * Tree of shared policies for a shared memory region. 167 * Tree of shared policies for a shared memory region.
@@ -133,8 +182,7 @@ struct shared_policy {
133 spinlock_t lock; 182 spinlock_t lock;
134}; 183};
135 184
136void mpol_shared_policy_init(struct shared_policy *info, int policy, 185void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol);
137 nodemask_t *nodes);
138int mpol_set_shared_policy(struct shared_policy *info, 186int mpol_set_shared_policy(struct shared_policy *info,
139 struct vm_area_struct *vma, 187 struct vm_area_struct *vma,
140 struct mempolicy *new); 188 struct mempolicy *new);
@@ -149,9 +197,9 @@ extern void mpol_rebind_task(struct task_struct *tsk,
149extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new); 197extern void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new);
150extern void mpol_fix_fork_child_flag(struct task_struct *p); 198extern void mpol_fix_fork_child_flag(struct task_struct *p);
151 199
152extern struct mempolicy default_policy;
153extern struct zonelist *huge_zonelist(struct vm_area_struct *vma, 200extern struct zonelist *huge_zonelist(struct vm_area_struct *vma,
154 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol); 201 unsigned long addr, gfp_t gfp_flags,
202 struct mempolicy **mpol, nodemask_t **nodemask);
155extern unsigned slab_node(struct mempolicy *policy); 203extern unsigned slab_node(struct mempolicy *policy);
156 204
157extern enum zone_type policy_zone; 205extern enum zone_type policy_zone;
@@ -165,6 +213,13 @@ static inline void check_highest_zone(enum zone_type k)
165int do_migrate_pages(struct mm_struct *mm, 213int do_migrate_pages(struct mm_struct *mm,
166 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags); 214 const nodemask_t *from_nodes, const nodemask_t *to_nodes, int flags);
167 215
216
217#ifdef CONFIG_TMPFS
218extern int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context);
219
220extern int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
221 int no_context);
222#endif
168#else 223#else
169 224
170struct mempolicy {}; 225struct mempolicy {};
@@ -173,19 +228,26 @@ static inline int mpol_equal(struct mempolicy *a, struct mempolicy *b)
173{ 228{
174 return 1; 229 return 1;
175} 230}
176#define vma_mpol_equal(a,b) 1
177 231
178#define mpol_set_vma_default(vma) do {} while(0) 232static inline void mpol_put(struct mempolicy *p)
233{
234}
235
236static inline void mpol_cond_put(struct mempolicy *pol)
237{
238}
179 239
180static inline void mpol_free(struct mempolicy *p) 240static inline struct mempolicy *mpol_cond_copy(struct mempolicy *to,
241 struct mempolicy *from)
181{ 242{
243 return from;
182} 244}
183 245
184static inline void mpol_get(struct mempolicy *pol) 246static inline void mpol_get(struct mempolicy *pol)
185{ 247{
186} 248}
187 249
188static inline struct mempolicy *mpol_copy(struct mempolicy *old) 250static inline struct mempolicy *mpol_dup(struct mempolicy *old)
189{ 251{
190 return NULL; 252 return NULL;
191} 253}
@@ -199,8 +261,8 @@ static inline int mpol_set_shared_policy(struct shared_policy *info,
199 return -EINVAL; 261 return -EINVAL;
200} 262}
201 263
202static inline void mpol_shared_policy_init(struct shared_policy *info, 264static inline void mpol_shared_policy_init(struct shared_policy *sp,
203 int policy, nodemask_t *nodes) 265 struct mempolicy *mpol)
204{ 266{
205} 267}
206 268
@@ -239,9 +301,12 @@ static inline void mpol_fix_fork_child_flag(struct task_struct *p)
239} 301}
240 302
241static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma, 303static inline struct zonelist *huge_zonelist(struct vm_area_struct *vma,
242 unsigned long addr, gfp_t gfp_flags, struct mempolicy **mpol) 304 unsigned long addr, gfp_t gfp_flags,
305 struct mempolicy **mpol, nodemask_t **nodemask)
243{ 306{
244 return NODE_DATA(0)->node_zonelists + gfp_zone(gfp_flags); 307 *mpol = NULL;
308 *nodemask = NULL;
309 return node_zonelist(0, gfp_flags);
245} 310}
246 311
247static inline int do_migrate_pages(struct mm_struct *mm, 312static inline int do_migrate_pages(struct mm_struct *mm,
@@ -254,6 +319,21 @@ static inline int do_migrate_pages(struct mm_struct *mm,
254static inline void check_highest_zone(int k) 319static inline void check_highest_zone(int k)
255{ 320{
256} 321}
322
323#ifdef CONFIG_TMPFS
324static inline int mpol_parse_str(char *str, struct mempolicy **mpol,
325 int no_context)
326{
327 return 1; /* error */
328}
329
330static inline int mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol,
331 int no_context)
332{
333 return 0;
334}
335#endif
336
257#endif /* CONFIG_NUMA */ 337#endif /* CONFIG_NUMA */
258#endif /* __KERNEL__ */ 338#endif /* __KERNEL__ */
259 339
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 286d31521605..8b7f4a5d4f6a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -107,6 +107,7 @@ extern unsigned int kobjsize(const void *objp);
107#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */ 107#define VM_ALWAYSDUMP 0x04000000 /* Always include in core dumps */
108 108
109#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */ 109#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
110#define VM_MIXEDMAP 0x10000000 /* Can contain "struct page" and pure PFN pages */
110 111
111#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */ 112#ifndef VM_STACK_DEFAULT_FLAGS /* arch can override this */
112#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS 113#define VM_STACK_DEFAULT_FLAGS VM_DATA_DEFAULT_FLAGS
@@ -164,8 +165,6 @@ struct vm_operations_struct {
164 void (*open)(struct vm_area_struct * area); 165 void (*open)(struct vm_area_struct * area);
165 void (*close)(struct vm_area_struct * area); 166 void (*close)(struct vm_area_struct * area);
166 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf); 167 int (*fault)(struct vm_area_struct *vma, struct vm_fault *vmf);
167 struct page *(*nopage)(struct vm_area_struct *area,
168 unsigned long address, int *type);
169 unsigned long (*nopfn)(struct vm_area_struct *area, 168 unsigned long (*nopfn)(struct vm_area_struct *area,
170 unsigned long address); 169 unsigned long address);
171 170
@@ -173,7 +172,25 @@ struct vm_operations_struct {
173 * writable, if an error is returned it will cause a SIGBUS */ 172 * writable, if an error is returned it will cause a SIGBUS */
174 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page); 173 int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
175#ifdef CONFIG_NUMA 174#ifdef CONFIG_NUMA
175 /*
176 * set_policy() op must add a reference to any non-NULL @new mempolicy
177 * to hold the policy upon return. Caller should pass NULL @new to
178 * remove a policy and fall back to surrounding context--i.e. do not
179 * install a MPOL_DEFAULT policy, nor the task or system default
180 * mempolicy.
181 */
176 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new); 182 int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
183
184 /*
185 * get_policy() op must add reference [mpol_get()] to any policy at
186 * (vma,addr) marked as MPOL_SHARED. The shared policy infrastructure
187 * in mm/mempolicy.c will do this automatically.
188 * get_policy() must NOT add a ref if the policy at (vma,addr) is not
189 * marked as MPOL_SHARED. vma policies are protected by the mmap_sem.
190 * If no [shared/vma] mempolicy exists at the addr, get_policy() op
191 * must return NULL--i.e., do not "fallback" to task or system default
192 * policy.
193 */
177 struct mempolicy *(*get_policy)(struct vm_area_struct *vma, 194 struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
178 unsigned long addr); 195 unsigned long addr);
179 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from, 196 int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
@@ -397,11 +414,11 @@ static inline void set_compound_order(struct page *page, unsigned long order)
397 * we have run out of space and have to fall back to an 414 * we have run out of space and have to fall back to an
398 * alternate (slower) way of determining the node. 415 * alternate (slower) way of determining the node.
399 * 416 *
400 * No sparsemem: | NODE | ZONE | ... | FLAGS | 417 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
401 * with space for node: | SECTION | NODE | ZONE | ... | FLAGS | 418 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
402 * no space for node: | SECTION | ZONE | ... | FLAGS | 419 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
403 */ 420 */
404#ifdef CONFIG_SPARSEMEM 421#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
405#define SECTIONS_WIDTH SECTIONS_SHIFT 422#define SECTIONS_WIDTH SECTIONS_SHIFT
406#else 423#else
407#define SECTIONS_WIDTH 0 424#define SECTIONS_WIDTH 0
@@ -409,9 +426,12 @@ static inline void set_compound_order(struct page *page, unsigned long order)
409 426
410#define ZONES_WIDTH ZONES_SHIFT 427#define ZONES_WIDTH ZONES_SHIFT
411 428
412#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= FLAGS_RESERVED 429#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
413#define NODES_WIDTH NODES_SHIFT 430#define NODES_WIDTH NODES_SHIFT
414#else 431#else
432#ifdef CONFIG_SPARSEMEM_VMEMMAP
433#error "Vmemmap: No space for nodes field in page flags"
434#endif
415#define NODES_WIDTH 0 435#define NODES_WIDTH 0
416#endif 436#endif
417 437
@@ -454,8 +474,8 @@ static inline void set_compound_order(struct page *page, unsigned long order)
454 474
455#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0)) 475#define ZONEID_PGSHIFT (ZONEID_PGOFF * (ZONEID_SHIFT != 0))
456 476
457#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 477#if SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
458#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > FLAGS_RESERVED 478#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
459#endif 479#endif
460 480
461#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 481#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
@@ -504,10 +524,12 @@ static inline struct zone *page_zone(struct page *page)
504 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)]; 524 return &NODE_DATA(page_to_nid(page))->node_zones[page_zonenum(page)];
505} 525}
506 526
527#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
507static inline unsigned long page_to_section(struct page *page) 528static inline unsigned long page_to_section(struct page *page)
508{ 529{
509 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK; 530 return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
510} 531}
532#endif
511 533
512static inline void set_page_zone(struct page *page, enum zone_type zone) 534static inline void set_page_zone(struct page *page, enum zone_type zone)
513{ 535{
@@ -602,9 +624,12 @@ static inline struct address_space *page_mapping(struct page *page)
602 struct address_space *mapping = page->mapping; 624 struct address_space *mapping = page->mapping;
603 625
604 VM_BUG_ON(PageSlab(page)); 626 VM_BUG_ON(PageSlab(page));
627#ifdef CONFIG_SWAP
605 if (unlikely(PageSwapCache(page))) 628 if (unlikely(PageSwapCache(page)))
606 mapping = &swapper_space; 629 mapping = &swapper_space;
607 else if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON)) 630 else
631#endif
632 if (unlikely((unsigned long)mapping & PAGE_MAPPING_ANON))
608 mapping = NULL; 633 mapping = NULL;
609 return mapping; 634 return mapping;
610} 635}
@@ -649,12 +674,6 @@ static inline int page_mapped(struct page *page)
649} 674}
650 675
651/* 676/*
652 * Error return values for the *_nopage functions
653 */
654#define NOPAGE_SIGBUS (NULL)
655#define NOPAGE_OOM ((struct page *) (-1))
656
657/*
658 * Error return values for the *_nopfn functions 677 * Error return values for the *_nopfn functions
659 */ 678 */
660#define NOPFN_SIGBUS ((unsigned long) -1) 679#define NOPFN_SIGBUS ((unsigned long) -1)
@@ -720,7 +739,9 @@ struct zap_details {
720 unsigned long truncate_count; /* Compare vm_truncate_count */ 739 unsigned long truncate_count; /* Compare vm_truncate_count */
721}; 740};
722 741
723struct page *vm_normal_page(struct vm_area_struct *, unsigned long, pte_t); 742struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
743 pte_t pte);
744
724unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address, 745unsigned long zap_page_range(struct vm_area_struct *vma, unsigned long address,
725 unsigned long size, struct zap_details *); 746 unsigned long size, struct zap_details *);
726unsigned long unmap_vmas(struct mmu_gather **tlb, 747unsigned long unmap_vmas(struct mmu_gather **tlb,
@@ -1149,6 +1170,8 @@ int remap_pfn_range(struct vm_area_struct *, unsigned long addr,
1149int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *); 1170int vm_insert_page(struct vm_area_struct *, unsigned long addr, struct page *);
1150int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, 1171int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr,
1151 unsigned long pfn); 1172 unsigned long pfn);
1173int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr,
1174 unsigned long pfn);
1152 1175
1153struct page *follow_page(struct vm_area_struct *, unsigned long address, 1176struct page *follow_page(struct vm_area_struct *, unsigned long address,
1154 unsigned int foll_flags); 1177 unsigned int foll_flags);
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index af190ceab971..29adaa781cb6 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -172,6 +172,7 @@ struct mm_struct {
172 atomic_t mm_users; /* How many users with user space? */ 172 atomic_t mm_users; /* How many users with user space? */
173 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */ 173 atomic_t mm_count; /* How many references to "struct mm_struct" (users count as 1) */
174 int map_count; /* number of VMAs */ 174 int map_count; /* number of VMAs */
175 int core_waiters;
175 struct rw_semaphore mmap_sem; 176 struct rw_semaphore mmap_sem;
176 spinlock_t page_table_lock; /* Protects page tables and some counters */ 177 spinlock_t page_table_lock; /* Protects page tables and some counters */
177 178
@@ -216,11 +217,10 @@ struct mm_struct {
216 unsigned long flags; /* Must use atomic bitops to access the bits */ 217 unsigned long flags; /* Must use atomic bitops to access the bits */
217 218
218 /* coredumping support */ 219 /* coredumping support */
219 int core_waiters;
220 struct completion *core_startup_done, core_done; 220 struct completion *core_startup_done, core_done;
221 221
222 /* aio bits */ 222 /* aio bits */
223 rwlock_t ioctx_list_lock; 223 rwlock_t ioctx_list_lock; /* aio lock */
224 struct kioctx *ioctx_list; 224 struct kioctx *ioctx_list;
225#ifdef CONFIG_CGROUP_MEM_RES_CTLR 225#ifdef CONFIG_CGROUP_MEM_RES_CTLR
226 struct mem_cgroup *mem_cgroup; 226 struct mem_cgroup *mem_cgroup;
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 9f274a687c7e..aad98003176f 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -3,6 +3,7 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5#ifndef __ASSEMBLY__ 5#ifndef __ASSEMBLY__
6#ifndef __GENERATING_BOUNDS_H
6 7
7#include <linux/spinlock.h> 8#include <linux/spinlock.h>
8#include <linux/list.h> 9#include <linux/list.h>
@@ -15,6 +16,7 @@
15#include <linux/seqlock.h> 16#include <linux/seqlock.h>
16#include <linux/nodemask.h> 17#include <linux/nodemask.h>
17#include <linux/pageblock-flags.h> 18#include <linux/pageblock-flags.h>
19#include <linux/bounds.h>
18#include <asm/atomic.h> 20#include <asm/atomic.h>
19#include <asm/page.h> 21#include <asm/page.h>
20 22
@@ -129,6 +131,8 @@ struct per_cpu_pageset {
129#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) 131#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
130#endif 132#endif
131 133
134#endif /* !__GENERATING_BOUNDS.H */
135
132enum zone_type { 136enum zone_type {
133#ifdef CONFIG_ZONE_DMA 137#ifdef CONFIG_ZONE_DMA
134 /* 138 /*
@@ -177,9 +181,11 @@ enum zone_type {
177 ZONE_HIGHMEM, 181 ZONE_HIGHMEM,
178#endif 182#endif
179 ZONE_MOVABLE, 183 ZONE_MOVABLE,
180 MAX_NR_ZONES 184 __MAX_NR_ZONES
181}; 185};
182 186
187#ifndef __GENERATING_BOUNDS_H
188
183/* 189/*
184 * When a memory allocation must conform to specific limitations (such 190 * When a memory allocation must conform to specific limitations (such
185 * as being suitable for DMA) the caller will pass in hints to the 191 * as being suitable for DMA) the caller will pass in hints to the
@@ -188,28 +194,15 @@ enum zone_type {
188 * match the requested limits. See gfp_zone() in include/linux/gfp.h 194 * match the requested limits. See gfp_zone() in include/linux/gfp.h
189 */ 195 */
190 196
191/* 197#if MAX_NR_ZONES < 2
192 * Count the active zones. Note that the use of defined(X) outside
193 * #if and family is not necessarily defined so ensure we cannot use
194 * it later. Use __ZONE_COUNT to work out how many shift bits we need.
195 */
196#define __ZONE_COUNT ( \
197 defined(CONFIG_ZONE_DMA) \
198 + defined(CONFIG_ZONE_DMA32) \
199 + 1 \
200 + defined(CONFIG_HIGHMEM) \
201 + 1 \
202)
203#if __ZONE_COUNT < 2
204#define ZONES_SHIFT 0 198#define ZONES_SHIFT 0
205#elif __ZONE_COUNT <= 2 199#elif MAX_NR_ZONES <= 2
206#define ZONES_SHIFT 1 200#define ZONES_SHIFT 1
207#elif __ZONE_COUNT <= 4 201#elif MAX_NR_ZONES <= 4
208#define ZONES_SHIFT 2 202#define ZONES_SHIFT 2
209#else 203#else
210#error ZONES_SHIFT -- too many zones configured adjust calculation 204#error ZONES_SHIFT -- too many zones configured adjust calculation
211#endif 205#endif
212#undef __ZONE_COUNT
213 206
214struct zone { 207struct zone {
215 /* Fields commonly accessed by the page allocator */ 208 /* Fields commonly accessed by the page allocator */
@@ -393,10 +386,10 @@ static inline int zone_is_oom_locked(const struct zone *zone)
393 * The NUMA zonelists are doubled becausse we need zonelists that restrict the 386 * The NUMA zonelists are doubled becausse we need zonelists that restrict the
394 * allocations to a single node for GFP_THISNODE. 387 * allocations to a single node for GFP_THISNODE.
395 * 388 *
396 * [0 .. MAX_NR_ZONES -1] : Zonelists with fallback 389 * [0] : Zonelist with fallback
397 * [MAZ_NR_ZONES ... MAZ_ZONELISTS -1] : No fallback (GFP_THISNODE) 390 * [1] : No fallback (GFP_THISNODE)
398 */ 391 */
399#define MAX_ZONELISTS (2 * MAX_NR_ZONES) 392#define MAX_ZONELISTS 2
400 393
401 394
402/* 395/*
@@ -464,11 +457,20 @@ struct zonelist_cache {
464 unsigned long last_full_zap; /* when last zap'd (jiffies) */ 457 unsigned long last_full_zap; /* when last zap'd (jiffies) */
465}; 458};
466#else 459#else
467#define MAX_ZONELISTS MAX_NR_ZONES 460#define MAX_ZONELISTS 1
468struct zonelist_cache; 461struct zonelist_cache;
469#endif 462#endif
470 463
471/* 464/*
465 * This struct contains information about a zone in a zonelist. It is stored
466 * here to avoid dereferences into large structures and lookups of tables
467 */
468struct zoneref {
469 struct zone *zone; /* Pointer to actual zone */
470 int zone_idx; /* zone_idx(zoneref->zone) */
471};
472
473/*
472 * One allocation request operates on a zonelist. A zonelist 474 * One allocation request operates on a zonelist. A zonelist
473 * is a list of zones, the first one is the 'goal' of the 475 * is a list of zones, the first one is the 'goal' of the
474 * allocation, the other zones are fallback zones, in decreasing 476 * allocation, the other zones are fallback zones, in decreasing
@@ -476,34 +478,23 @@ struct zonelist_cache;
476 * 478 *
477 * If zlcache_ptr is not NULL, then it is just the address of zlcache, 479 * If zlcache_ptr is not NULL, then it is just the address of zlcache,
478 * as explained above. If zlcache_ptr is NULL, there is no zlcache. 480 * as explained above. If zlcache_ptr is NULL, there is no zlcache.
481 * *
482 * To speed the reading of the zonelist, the zonerefs contain the zone index
483 * of the entry being read. Helper functions to access information given
484 * a struct zoneref are
485 *
486 * zonelist_zone() - Return the struct zone * for an entry in _zonerefs
487 * zonelist_zone_idx() - Return the index of the zone for an entry
488 * zonelist_node_idx() - Return the index of the node for an entry
479 */ 489 */
480
481struct zonelist { 490struct zonelist {
482 struct zonelist_cache *zlcache_ptr; // NULL or &zlcache 491 struct zonelist_cache *zlcache_ptr; // NULL or &zlcache
483 struct zone *zones[MAX_ZONES_PER_ZONELIST + 1]; // NULL delimited 492 struct zoneref _zonerefs[MAX_ZONES_PER_ZONELIST + 1];
484#ifdef CONFIG_NUMA 493#ifdef CONFIG_NUMA
485 struct zonelist_cache zlcache; // optional ... 494 struct zonelist_cache zlcache; // optional ...
486#endif 495#endif
487}; 496};
488 497
489#ifdef CONFIG_NUMA
490/*
491 * Only custom zonelists like MPOL_BIND need to be filtered as part of
492 * policies. As described in the comment for struct zonelist_cache, these
493 * zonelists will not have a zlcache so zlcache_ptr will not be set. Use
494 * that to determine if the zonelists needs to be filtered or not.
495 */
496static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
497{
498 return !zonelist->zlcache_ptr;
499}
500#else
501static inline int alloc_should_filter_zonelist(struct zonelist *zonelist)
502{
503 return 0;
504}
505#endif /* CONFIG_NUMA */
506
507#ifdef CONFIG_ARCH_POPULATES_NODE_MAP 498#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
508struct node_active_region { 499struct node_active_region {
509 unsigned long start_pfn; 500 unsigned long start_pfn;
@@ -637,9 +628,10 @@ static inline int is_normal_idx(enum zone_type idx)
637static inline int is_highmem(struct zone *zone) 628static inline int is_highmem(struct zone *zone)
638{ 629{
639#ifdef CONFIG_HIGHMEM 630#ifdef CONFIG_HIGHMEM
640 int zone_idx = zone - zone->zone_pgdat->node_zones; 631 int zone_off = (char *)zone - (char *)zone->zone_pgdat->node_zones;
641 return zone_idx == ZONE_HIGHMEM || 632 return zone_off == ZONE_HIGHMEM * sizeof(*zone) ||
642 (zone_idx == ZONE_MOVABLE && zone_movable_is_highmem()); 633 (zone_off == ZONE_MOVABLE * sizeof(*zone) &&
634 zone_movable_is_highmem());
643#else 635#else
644 return 0; 636 return 0;
645#endif 637#endif
@@ -730,32 +722,103 @@ extern struct zone *next_zone(struct zone *zone);
730 zone; \ 722 zone; \
731 zone = next_zone(zone)) 723 zone = next_zone(zone))
732 724
733#ifdef CONFIG_SPARSEMEM 725static inline struct zone *zonelist_zone(struct zoneref *zoneref)
734#include <asm/sparsemem.h> 726{
735#endif 727 return zoneref->zone;
728}
736 729
737#if BITS_PER_LONG == 32 730static inline int zonelist_zone_idx(struct zoneref *zoneref)
738/* 731{
739 * with 32 bit page->flags field, we reserve 9 bits for node/zone info. 732 return zoneref->zone_idx;
740 * there are 4 zones (3 bits) and this leaves 9-3=6 bits for nodes. 733}
734
735static inline int zonelist_node_idx(struct zoneref *zoneref)
736{
737#ifdef CONFIG_NUMA
738 /* zone_to_nid not available in this context */
739 return zoneref->zone->node;
740#else
741 return 0;
742#endif /* CONFIG_NUMA */
743}
744
745/**
746 * next_zones_zonelist - Returns the next zone at or below highest_zoneidx within the allowed nodemask using a cursor within a zonelist as a starting point
747 * @z - The cursor used as a starting point for the search
748 * @highest_zoneidx - The zone index of the highest zone to return
749 * @nodes - An optional nodemask to filter the zonelist with
750 * @zone - The first suitable zone found is returned via this parameter
751 *
752 * This function returns the next zone at or below a given zone index that is
753 * within the allowed nodemask using a cursor as the starting point for the
754 * search. The zoneref returned is a cursor that is used as the next starting
755 * point for future calls to next_zones_zonelist().
741 */ 756 */
742#define FLAGS_RESERVED 9 757struct zoneref *next_zones_zonelist(struct zoneref *z,
758 enum zone_type highest_zoneidx,
759 nodemask_t *nodes,
760 struct zone **zone);
743 761
744#elif BITS_PER_LONG == 64 762/**
745/* 763 * first_zones_zonelist - Returns the first zone at or below highest_zoneidx within the allowed nodemask in a zonelist
746 * with 64 bit flags field, there's plenty of room. 764 * @zonelist - The zonelist to search for a suitable zone
765 * @highest_zoneidx - The zone index of the highest zone to return
766 * @nodes - An optional nodemask to filter the zonelist with
767 * @zone - The first suitable zone found is returned via this parameter
768 *
769 * This function returns the first zone at or below a given zone index that is
770 * within the allowed nodemask. The zoneref returned is a cursor that can be
771 * used to iterate the zonelist with next_zones_zonelist. The cursor should
772 * not be used by the caller as it does not match the value of the zone
773 * returned.
747 */ 774 */
748#define FLAGS_RESERVED 32 775static inline struct zoneref *first_zones_zonelist(struct zonelist *zonelist,
776 enum zone_type highest_zoneidx,
777 nodemask_t *nodes,
778 struct zone **zone)
779{
780 return next_zones_zonelist(zonelist->_zonerefs, highest_zoneidx, nodes,
781 zone);
782}
749 783
750#else 784/**
785 * for_each_zone_zonelist_nodemask - helper macro to iterate over valid zones in a zonelist at or below a given zone index and within a nodemask
786 * @zone - The current zone in the iterator
787 * @z - The current pointer within zonelist->zones being iterated
788 * @zlist - The zonelist being iterated
789 * @highidx - The zone index of the highest zone to return
790 * @nodemask - Nodemask allowed by the allocator
791 *
792 * This iterator iterates though all zones at or below a given zone index and
793 * within a given nodemask
794 */
795#define for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, nodemask) \
796 for (z = first_zones_zonelist(zlist, highidx, nodemask, &zone); \
797 zone; \
798 z = next_zones_zonelist(z, highidx, nodemask, &zone)) \
751 799
752#error BITS_PER_LONG not defined 800/**
801 * for_each_zone_zonelist - helper macro to iterate over valid zones in a zonelist at or below a given zone index
802 * @zone - The current zone in the iterator
803 * @z - The current pointer within zonelist->zones being iterated
804 * @zlist - The zonelist being iterated
805 * @highidx - The zone index of the highest zone to return
806 *
807 * This iterator iterates though all zones at or below a given zone index.
808 */
809#define for_each_zone_zonelist(zone, z, zlist, highidx) \
810 for_each_zone_zonelist_nodemask(zone, z, zlist, highidx, NULL)
753 811
812#ifdef CONFIG_SPARSEMEM
813#include <asm/sparsemem.h>
754#endif 814#endif
755 815
756#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \ 816#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
757 !defined(CONFIG_ARCH_POPULATES_NODE_MAP) 817 !defined(CONFIG_ARCH_POPULATES_NODE_MAP)
758#define early_pfn_to_nid(nid) (0UL) 818static inline unsigned long early_pfn_to_nid(unsigned long pfn)
819{
820 return 0;
821}
759#endif 822#endif
760 823
761#ifdef CONFIG_FLATMEM 824#ifdef CONFIG_FLATMEM
@@ -833,6 +896,7 @@ static inline struct mem_section *__nr_to_section(unsigned long nr)
833 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; 896 return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK];
834} 897}
835extern int __section_nr(struct mem_section* ms); 898extern int __section_nr(struct mem_section* ms);
899extern unsigned long usemap_size(void);
836 900
837/* 901/*
838 * We use the lower bits of the mem_map pointer to store 902 * We use the lower bits of the mem_map pointer to store
@@ -938,6 +1002,7 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
938#define pfn_valid_within(pfn) (1) 1002#define pfn_valid_within(pfn) (1)
939#endif 1003#endif
940 1004
1005#endif /* !__GENERATING_BOUNDS.H */
941#endif /* !__ASSEMBLY__ */ 1006#endif /* !__ASSEMBLY__ */
942#endif /* __KERNEL__ */ 1007#endif /* __KERNEL__ */
943#endif /* _LINUX_MMZONE_H */ 1008#endif /* _LINUX_MMZONE_H */
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index f950921523f5..b03b27457413 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -58,7 +58,11 @@
58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ 58#define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */
59 59
60/* media of boot sector */ 60/* media of boot sector */
61#define FAT_VALID_MEDIA(x) ((0xF8 <= (x) && (x) <= 0xFF) || (x) == 0xF0) 61static inline int fat_valid_media(u8 media)
62{
63 return 0xf8 <= media || media == 0xf0;
64}
65
62#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \ 66#define FAT_FIRST_ENT(s, x) ((MSDOS_SB(s)->fat_bits == 32 ? 0x0FFFFF00 : \
63 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x)) 67 MSDOS_SB(s)->fat_bits == 16 ? 0xFF00 : 0xF00) | (x))
64 68
@@ -195,6 +199,7 @@ struct fat_mount_options {
195 char *iocharset; /* Charset used for filename input/display */ 199 char *iocharset; /* Charset used for filename input/display */
196 unsigned short shortname; /* flags for shortname display/create rule */ 200 unsigned short shortname; /* flags for shortname display/create rule */
197 unsigned char name_check; /* r = relaxed, n = normal, s = strict */ 201 unsigned char name_check; /* r = relaxed, n = normal, s = strict */
202 unsigned short allow_utime;/* permission for setting the [am]time */
198 unsigned quiet:1, /* set = fake successful chmods and chowns */ 203 unsigned quiet:1, /* set = fake successful chmods and chowns */
199 showexec:1, /* set = only set x bit for com/exe/bat */ 204 showexec:1, /* set = only set x bit for com/exe/bat */
200 sys_immutable:1, /* set = system files are immutable */ 205 sys_immutable:1, /* set = system files are immutable */
@@ -232,6 +237,7 @@ struct msdos_sb_info {
232 struct mutex fat_lock; 237 struct mutex fat_lock;
233 unsigned int prev_free; /* previously allocated cluster number */ 238 unsigned int prev_free; /* previously allocated cluster number */
234 unsigned int free_clusters; /* -1 if undefined */ 239 unsigned int free_clusters; /* -1 if undefined */
240 unsigned int free_clus_valid; /* is free_clusters valid? */
235 struct fat_mount_options options; 241 struct fat_mount_options options;
236 struct nls_table *nls_disk; /* Codepage used on disk */ 242 struct nls_table *nls_disk; /* Codepage used on disk */
237 struct nls_table *nls_io; /* Charset used for input and display */ 243 struct nls_table *nls_io; /* Charset used for input and display */
@@ -401,7 +407,7 @@ extern int fat_generic_ioctl(struct inode *inode, struct file *filp,
401 unsigned int cmd, unsigned long arg); 407 unsigned int cmd, unsigned long arg);
402extern const struct file_operations fat_file_operations; 408extern const struct file_operations fat_file_operations;
403extern const struct inode_operations fat_file_inode_operations; 409extern const struct inode_operations fat_file_inode_operations;
404extern int fat_notify_change(struct dentry * dentry, struct iattr * attr); 410extern int fat_setattr(struct dentry * dentry, struct iattr * attr);
405extern void fat_truncate(struct inode *inode); 411extern void fat_truncate(struct inode *inode);
406extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, 412extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry,
407 struct kstat *stat); 413 struct kstat *stat);
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 88766e43e121..9f2d76347f19 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -204,6 +204,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
204/* linux/fs/ncpfs/dir.c */ 204/* linux/fs/ncpfs/dir.c */
205extern const struct inode_operations ncp_dir_inode_operations; 205extern const struct inode_operations ncp_dir_inode_operations;
206extern const struct file_operations ncp_dir_operations; 206extern const struct file_operations ncp_dir_operations;
207extern struct dentry_operations ncp_root_dentry_operations;
207int ncp_conn_logged_in(struct super_block *); 208int ncp_conn_logged_in(struct super_block *);
208int ncp_date_dos2unix(__le16 time, __le16 date); 209int ncp_date_dos2unix(__le16 time, __le16 date);
209void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);
@@ -223,6 +224,12 @@ int ncp_disconnect(struct ncp_server *server);
223void ncp_lock_server(struct ncp_server *server); 224void ncp_lock_server(struct ncp_server *server);
224void ncp_unlock_server(struct ncp_server *server); 225void ncp_unlock_server(struct ncp_server *server);
225 226
227/* linux/fs/ncpfs/symlink.c */
228#if defined(CONFIG_NCPFS_EXTRAS) || defined(CONFIG_NCPFS_NFS_NS)
229extern const struct address_space_operations ncp_symlink_aops;
230int ncp_symlink(struct inode*, struct dentry*, const char*);
231#endif
232
226/* linux/fs/ncpfs/file.c */ 233/* linux/fs/ncpfs/file.c */
227extern const struct inode_operations ncp_file_inode_operations; 234extern const struct inode_operations ncp_file_inode_operations;
228extern const struct file_operations ncp_file_operations; 235extern const struct file_operations ncp_file_operations;
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
index 905e18f4b412..848025cd7087 100644
--- a/include/linux/nodemask.h
+++ b/include/linux/nodemask.h
@@ -14,6 +14,8 @@
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c. 14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
15 * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c. 15 * For details of node_remap(), see bitmap_bitremap in lib/bitmap.c.
16 * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c. 16 * For details of nodes_remap(), see bitmap_remap in lib/bitmap.c.
17 * For details of nodes_onto(), see bitmap_onto in lib/bitmap.c.
18 * For details of nodes_fold(), see bitmap_fold in lib/bitmap.c.
17 * 19 *
18 * The available nodemask operations are: 20 * The available nodemask operations are:
19 * 21 *
@@ -55,7 +57,9 @@
55 * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing 57 * int nodelist_scnprintf(buf, len, mask) Format nodemask as list for printing
56 * int nodelist_parse(buf, map) Parse ascii string as nodelist 58 * int nodelist_parse(buf, map) Parse ascii string as nodelist
57 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit) 59 * int node_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
58 * int nodes_remap(dst, src, old, new) *dst = map(old, new)(dst) 60 * void nodes_remap(dst, src, old, new) *dst = map(old, new)(src)
61 * void nodes_onto(dst, orig, relmap) *dst = orig relative to relmap
62 * void nodes_fold(dst, orig, sz) dst bits = orig bits mod sz
59 * 63 *
60 * for_each_node_mask(node, mask) for-loop node over mask 64 * for_each_node_mask(node, mask) for-loop node over mask
61 * 65 *
@@ -326,6 +330,22 @@ static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp,
326 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits); 330 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
327} 331}
328 332
333#define nodes_onto(dst, orig, relmap) \
334 __nodes_onto(&(dst), &(orig), &(relmap), MAX_NUMNODES)
335static inline void __nodes_onto(nodemask_t *dstp, const nodemask_t *origp,
336 const nodemask_t *relmapp, int nbits)
337{
338 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
339}
340
341#define nodes_fold(dst, orig, sz) \
342 __nodes_fold(&(dst), &(orig), sz, MAX_NUMNODES)
343static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,
344 int sz, int nbits)
345{
346 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
347}
348
329#if MAX_NUMNODES > 1 349#if MAX_NUMNODES > 1
330#define for_each_node_mask(node, mask) \ 350#define for_each_node_mask(node, mask) \
331 for ((node) = first_node(mask); \ 351 for ((node) = first_node(mask); \
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index f4df40038f0c..20dfed590183 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -247,6 +247,7 @@ extern struct blocking_notifier_head reboot_notifier_list;
247#define VT_DEALLOCATE 0x0002 /* Console will be deallocated */ 247#define VT_DEALLOCATE 0x0002 /* Console will be deallocated */
248#define VT_WRITE 0x0003 /* A char got output */ 248#define VT_WRITE 0x0003 /* A char got output */
249#define VT_UPDATE 0x0004 /* A bigger update occurred */ 249#define VT_UPDATE 0x0004 /* A bigger update occurred */
250#define VT_PREWRITE 0x0005 /* A char is about to be written to the console */
250 251
251#endif /* __KERNEL__ */ 252#endif /* __KERNEL__ */
252#endif /* _LINUX_NOTIFIER_H */ 253#endif /* _LINUX_NOTIFIER_H */
diff --git a/include/linux/oom.h b/include/linux/oom.h
index 3852436b652a..a7979baf1e39 100644
--- a/include/linux/oom.h
+++ b/include/linux/oom.h
@@ -23,8 +23,8 @@ enum oom_constraint {
23 CONSTRAINT_MEMORY_POLICY, 23 CONSTRAINT_MEMORY_POLICY,
24}; 24};
25 25
26extern int try_set_zone_oom(struct zonelist *zonelist); 26extern int try_set_zone_oom(struct zonelist *zonelist, gfp_t gfp_flags);
27extern void clear_zonelist_oom(struct zonelist *zonelist); 27extern void clear_zonelist_oom(struct zonelist *zonelist, gfp_t gfp_flags);
28 28
29extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order); 29extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
30extern int register_oom_notifier(struct notifier_block *nb); 30extern int register_oom_notifier(struct notifier_block *nb);
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index b5b30f1c1e59..590cff32415d 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -6,7 +6,10 @@
6#define PAGE_FLAGS_H 6#define PAGE_FLAGS_H
7 7
8#include <linux/types.h> 8#include <linux/types.h>
9#ifndef __GENERATING_BOUNDS_H
9#include <linux/mm_types.h> 10#include <linux/mm_types.h>
11#include <linux/bounds.h>
12#endif /* !__GENERATING_BOUNDS_H */
10 13
11/* 14/*
12 * Various page->flags bits: 15 * Various page->flags bits:
@@ -59,77 +62,138 @@
59 * extends from the high bits downwards. 62 * extends from the high bits downwards.
60 * 63 *
61 * | FIELD | ... | FLAGS | 64 * | FIELD | ... | FLAGS |
62 * N-1 ^ 0 65 * N-1 ^ 0
63 * (N-FLAGS_RESERVED) 66 * (NR_PAGEFLAGS)
64 * 67 *
65 * The fields area is reserved for fields mapping zone, node and SPARSEMEM 68 * The fields area is reserved for fields mapping zone, node (for NUMA) and
66 * section. The boundry between these two areas is defined by 69 * SPARSEMEM section (for variants of SPARSEMEM that require section ids like
67 * FLAGS_RESERVED which defines the width of the fields section 70 * SPARSEMEM_EXTREME with !SPARSEMEM_VMEMMAP).
68 * (see linux/mmzone.h). New flags must _not_ overlap with this area.
69 */ 71 */
70#define PG_locked 0 /* Page is locked. Don't touch. */ 72enum pageflags {
71#define PG_error 1 73 PG_locked, /* Page is locked. Don't touch. */
72#define PG_referenced 2 74 PG_error,
73#define PG_uptodate 3 75 PG_referenced,
76 PG_uptodate,
77 PG_dirty,
78 PG_lru,
79 PG_active,
80 PG_slab,
81 PG_owner_priv_1, /* Owner use. If pagecache, fs may use*/
82 PG_arch_1,
83 PG_reserved,
84 PG_private, /* If pagecache, has fs-private data */
85 PG_writeback, /* Page is under writeback */
86#ifdef CONFIG_PAGEFLAGS_EXTENDED
87 PG_head, /* A head page */
88 PG_tail, /* A tail page */
89#else
90 PG_compound, /* A compound page */
91#endif
92 PG_swapcache, /* Swap page: swp_entry_t in private */
93 PG_mappedtodisk, /* Has blocks allocated on-disk */
94 PG_reclaim, /* To be reclaimed asap */
95 PG_buddy, /* Page is free, on buddy lists */
96#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
97 PG_uncached, /* Page has been mapped as uncached */
98#endif
99 __NR_PAGEFLAGS
100};
101
102#ifndef __GENERATING_BOUNDS_H
103
104/*
105 * Macros to create function definitions for page flags
106 */
107#define TESTPAGEFLAG(uname, lname) \
108static inline int Page##uname(struct page *page) \
109 { return test_bit(PG_##lname, &page->flags); }
74 110
75#define PG_dirty 4 111#define SETPAGEFLAG(uname, lname) \
76#define PG_lru 5 112static inline void SetPage##uname(struct page *page) \
77#define PG_active 6 113 { set_bit(PG_##lname, &page->flags); }
78#define PG_slab 7 /* slab debug (Suparna wants this) */
79 114
80#define PG_owner_priv_1 8 /* Owner use. If pagecache, fs may use*/ 115#define CLEARPAGEFLAG(uname, lname) \
81#define PG_arch_1 9 116static inline void ClearPage##uname(struct page *page) \
82#define PG_reserved 10 117 { clear_bit(PG_##lname, &page->flags); }
83#define PG_private 11 /* If pagecache, has fs-private data */
84 118
85#define PG_writeback 12 /* Page is under writeback */ 119#define __SETPAGEFLAG(uname, lname) \
86#define PG_compound 14 /* Part of a compound page */ 120static inline void __SetPage##uname(struct page *page) \
87#define PG_swapcache 15 /* Swap page: swp_entry_t in private */ 121 { __set_bit(PG_##lname, &page->flags); }
88 122
89#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */ 123#define __CLEARPAGEFLAG(uname, lname) \
90#define PG_reclaim 17 /* To be reclaimed asap */ 124static inline void __ClearPage##uname(struct page *page) \
91#define PG_buddy 19 /* Page is free, on buddy lists */ 125 { __clear_bit(PG_##lname, &page->flags); }
126
127#define TESTSETFLAG(uname, lname) \
128static inline int TestSetPage##uname(struct page *page) \
129 { return test_and_set_bit(PG_##lname, &page->flags); }
130
131#define TESTCLEARFLAG(uname, lname) \
132static inline int TestClearPage##uname(struct page *page) \
133 { return test_and_clear_bit(PG_##lname, &page->flags); }
92 134
93/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
94#define PG_readahead PG_reclaim /* Reminder to do async read-ahead */
95 135
96/* PG_owner_priv_1 users should have descriptive aliases */ 136#define PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
97#define PG_checked PG_owner_priv_1 /* Used by some filesystems */ 137 SETPAGEFLAG(uname, lname) CLEARPAGEFLAG(uname, lname)
98#define PG_pinned PG_owner_priv_1 /* Xen pinned pagetable */ 138
139#define __PAGEFLAG(uname, lname) TESTPAGEFLAG(uname, lname) \
140 __SETPAGEFLAG(uname, lname) __CLEARPAGEFLAG(uname, lname)
141
142#define PAGEFLAG_FALSE(uname) \
143static inline int Page##uname(struct page *page) \
144 { return 0; }
145
146#define TESTSCFLAG(uname, lname) \
147 TESTSETFLAG(uname, lname) TESTCLEARFLAG(uname, lname)
148
149struct page; /* forward declaration */
150
151PAGEFLAG(Locked, locked) TESTSCFLAG(Locked, locked)
152PAGEFLAG(Error, error)
153PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced)
154PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
155PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru)
156PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)
157__PAGEFLAG(Slab, slab)
158PAGEFLAG(Checked, owner_priv_1) /* Used by some filesystems */
159PAGEFLAG(Pinned, owner_priv_1) TESTSCFLAG(Pinned, owner_priv_1) /* Xen */
160PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
161PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
162 __SETPAGEFLAG(Private, private)
99 163
100#if (BITS_PER_LONG > 32)
101/* 164/*
102 * 64-bit-only flags build down from bit 31 165 * Only test-and-set exist for PG_writeback. The unconditional operators are
103 * 166 * risky: they bypass page accounting.
104 * 32 bit -------------------------------| FIELDS | FLAGS |
105 * 64 bit | FIELDS | ?????? FLAGS |
106 * 63 32 0
107 */ 167 */
108#define PG_uncached 31 /* Page has been mapped as uncached */ 168TESTPAGEFLAG(Writeback, writeback) TESTSCFLAG(Writeback, writeback)
109#endif 169__PAGEFLAG(Buddy, buddy)
170PAGEFLAG(MappedToDisk, mappedtodisk)
110 171
172/* PG_readahead is only used for file reads; PG_reclaim is only for writes */
173PAGEFLAG(Reclaim, reclaim) TESTCLEARFLAG(Reclaim, reclaim)
174PAGEFLAG(Readahead, reclaim) /* Reminder to do async read-ahead */
175
176#ifdef CONFIG_HIGHMEM
111/* 177/*
112 * Manipulation of page state flags 178 * Must use a macro here due to header dependency issues. page_zone() is not
179 * available at this point.
113 */ 180 */
114#define PageLocked(page) \ 181#define PageHighMem(__p) is_highmem(page_zone(__p))
115 test_bit(PG_locked, &(page)->flags) 182#else
116#define SetPageLocked(page) \ 183PAGEFLAG_FALSE(HighMem)
117 set_bit(PG_locked, &(page)->flags) 184#endif
118#define TestSetPageLocked(page) \ 185
119 test_and_set_bit(PG_locked, &(page)->flags) 186#ifdef CONFIG_SWAP
120#define ClearPageLocked(page) \ 187PAGEFLAG(SwapCache, swapcache)
121 clear_bit(PG_locked, &(page)->flags) 188#else
122#define TestClearPageLocked(page) \ 189PAGEFLAG_FALSE(SwapCache)
123 test_and_clear_bit(PG_locked, &(page)->flags) 190#endif
124 191
125#define PageError(page) test_bit(PG_error, &(page)->flags) 192#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
126#define SetPageError(page) set_bit(PG_error, &(page)->flags) 193PAGEFLAG(Uncached, uncached)
127#define ClearPageError(page) clear_bit(PG_error, &(page)->flags) 194#else
128 195PAGEFLAG_FALSE(Uncached)
129#define PageReferenced(page) test_bit(PG_referenced, &(page)->flags) 196#endif
130#define SetPageReferenced(page) set_bit(PG_referenced, &(page)->flags)
131#define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags)
132#define TestClearPageReferenced(page) test_and_clear_bit(PG_referenced, &(page)->flags)
133 197
134static inline int PageUptodate(struct page *page) 198static inline int PageUptodate(struct page *page)
135{ 199{
@@ -177,97 +241,59 @@ static inline void SetPageUptodate(struct page *page)
177#endif 241#endif
178} 242}
179 243
180#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags) 244CLEARPAGEFLAG(Uptodate, uptodate)
181
182#define PageDirty(page) test_bit(PG_dirty, &(page)->flags)
183#define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags)
184#define TestSetPageDirty(page) test_and_set_bit(PG_dirty, &(page)->flags)
185#define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags)
186#define __ClearPageDirty(page) __clear_bit(PG_dirty, &(page)->flags)
187#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags)
188
189#define PageLRU(page) test_bit(PG_lru, &(page)->flags)
190#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags)
191#define ClearPageLRU(page) clear_bit(PG_lru, &(page)->flags)
192#define __ClearPageLRU(page) __clear_bit(PG_lru, &(page)->flags)
193
194#define PageActive(page) test_bit(PG_active, &(page)->flags)
195#define SetPageActive(page) set_bit(PG_active, &(page)->flags)
196#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags)
197#define __ClearPageActive(page) __clear_bit(PG_active, &(page)->flags)
198
199#define PageSlab(page) test_bit(PG_slab, &(page)->flags)
200#define __SetPageSlab(page) __set_bit(PG_slab, &(page)->flags)
201#define __ClearPageSlab(page) __clear_bit(PG_slab, &(page)->flags)
202
203#ifdef CONFIG_HIGHMEM
204#define PageHighMem(page) is_highmem(page_zone(page))
205#else
206#define PageHighMem(page) 0 /* needed to optimize away at compile time */
207#endif
208 245
209#define PageChecked(page) test_bit(PG_checked, &(page)->flags) 246extern void cancel_dirty_page(struct page *page, unsigned int account_size);
210#define SetPageChecked(page) set_bit(PG_checked, &(page)->flags)
211#define ClearPageChecked(page) clear_bit(PG_checked, &(page)->flags)
212
213#define PagePinned(page) test_bit(PG_pinned, &(page)->flags)
214#define SetPagePinned(page) set_bit(PG_pinned, &(page)->flags)
215#define ClearPagePinned(page) clear_bit(PG_pinned, &(page)->flags)
216 247
217#define PageReserved(page) test_bit(PG_reserved, &(page)->flags) 248int test_clear_page_writeback(struct page *page);
218#define SetPageReserved(page) set_bit(PG_reserved, &(page)->flags) 249int test_set_page_writeback(struct page *page);
219#define ClearPageReserved(page) clear_bit(PG_reserved, &(page)->flags)
220#define __ClearPageReserved(page) __clear_bit(PG_reserved, &(page)->flags)
221 250
222#define SetPagePrivate(page) set_bit(PG_private, &(page)->flags) 251static inline void set_page_writeback(struct page *page)
223#define ClearPagePrivate(page) clear_bit(PG_private, &(page)->flags) 252{
224#define PagePrivate(page) test_bit(PG_private, &(page)->flags) 253 test_set_page_writeback(page);
225#define __SetPagePrivate(page) __set_bit(PG_private, &(page)->flags) 254}
226#define __ClearPagePrivate(page) __clear_bit(PG_private, &(page)->flags)
227 255
256#ifdef CONFIG_PAGEFLAGS_EXTENDED
228/* 257/*
229 * Only test-and-set exist for PG_writeback. The unconditional operators are 258 * System with lots of page flags available. This allows separate
230 * risky: they bypass page accounting. 259 * flags for PageHead() and PageTail() checks of compound pages so that bit
260 * tests can be used in performance sensitive paths. PageCompound is
261 * generally not used in hot code paths.
231 */ 262 */
232#define PageWriteback(page) test_bit(PG_writeback, &(page)->flags) 263__PAGEFLAG(Head, head)
233#define TestSetPageWriteback(page) test_and_set_bit(PG_writeback, \ 264__PAGEFLAG(Tail, tail)
234 &(page)->flags)
235#define TestClearPageWriteback(page) test_and_clear_bit(PG_writeback, \
236 &(page)->flags)
237 265
238#define PageBuddy(page) test_bit(PG_buddy, &(page)->flags) 266static inline int PageCompound(struct page *page)
239#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags) 267{
240#define __ClearPageBuddy(page) __clear_bit(PG_buddy, &(page)->flags) 268 return page->flags & ((1L << PG_head) | (1L << PG_tail));
241
242#define PageMappedToDisk(page) test_bit(PG_mappedtodisk, &(page)->flags)
243#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags)
244#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags)
245
246#define PageReadahead(page) test_bit(PG_readahead, &(page)->flags)
247#define SetPageReadahead(page) set_bit(PG_readahead, &(page)->flags)
248#define ClearPageReadahead(page) clear_bit(PG_readahead, &(page)->flags)
249
250#define PageReclaim(page) test_bit(PG_reclaim, &(page)->flags)
251#define SetPageReclaim(page) set_bit(PG_reclaim, &(page)->flags)
252#define ClearPageReclaim(page) clear_bit(PG_reclaim, &(page)->flags)
253#define TestClearPageReclaim(page) test_and_clear_bit(PG_reclaim, &(page)->flags)
254 269
255#define PageCompound(page) test_bit(PG_compound, &(page)->flags) 270}
256#define __SetPageCompound(page) __set_bit(PG_compound, &(page)->flags) 271#else
257#define __ClearPageCompound(page) __clear_bit(PG_compound, &(page)->flags) 272/*
273 * Reduce page flag use as much as possible by overlapping
274 * compound page flags with the flags used for page cache pages. Possible
275 * because PageCompound is always set for compound pages and not for
276 * pages on the LRU and/or pagecache.
277 */
278TESTPAGEFLAG(Compound, compound)
279__PAGEFLAG(Head, compound)
258 280
259/* 281/*
260 * PG_reclaim is used in combination with PG_compound to mark the 282 * PG_reclaim is used in combination with PG_compound to mark the
261 * head and tail of a compound page 283 * head and tail of a compound page. This saves one page flag
284 * but makes it impossible to use compound pages for the page cache.
285 * The PG_reclaim bit would have to be used for reclaim or readahead
286 * if compound pages enter the page cache.
262 * 287 *
263 * PG_compound & PG_reclaim => Tail page 288 * PG_compound & PG_reclaim => Tail page
264 * PG_compound & ~PG_reclaim => Head page 289 * PG_compound & ~PG_reclaim => Head page
265 */ 290 */
266
267#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim)) 291#define PG_head_tail_mask ((1L << PG_compound) | (1L << PG_reclaim))
268 292
269#define PageTail(page) (((page)->flags & PG_head_tail_mask) \ 293static inline int PageTail(struct page *page)
270 == PG_head_tail_mask) 294{
295 return ((page->flags & PG_head_tail_mask) == PG_head_tail_mask);
296}
271 297
272static inline void __SetPageTail(struct page *page) 298static inline void __SetPageTail(struct page *page)
273{ 299{
@@ -279,33 +305,6 @@ static inline void __ClearPageTail(struct page *page)
279 page->flags &= ~PG_head_tail_mask; 305 page->flags &= ~PG_head_tail_mask;
280} 306}
281 307
282#define PageHead(page) (((page)->flags & PG_head_tail_mask) \ 308#endif /* !PAGEFLAGS_EXTENDED */
283 == (1L << PG_compound)) 309#endif /* !__GENERATING_BOUNDS_H */
284#define __SetPageHead(page) __SetPageCompound(page)
285#define __ClearPageHead(page) __ClearPageCompound(page)
286
287#ifdef CONFIG_SWAP
288#define PageSwapCache(page) test_bit(PG_swapcache, &(page)->flags)
289#define SetPageSwapCache(page) set_bit(PG_swapcache, &(page)->flags)
290#define ClearPageSwapCache(page) clear_bit(PG_swapcache, &(page)->flags)
291#else
292#define PageSwapCache(page) 0
293#endif
294
295#define PageUncached(page) test_bit(PG_uncached, &(page)->flags)
296#define SetPageUncached(page) set_bit(PG_uncached, &(page)->flags)
297#define ClearPageUncached(page) clear_bit(PG_uncached, &(page)->flags)
298
299struct page; /* forward declaration */
300
301extern void cancel_dirty_page(struct page *page, unsigned int account_size);
302
303int test_clear_page_writeback(struct page *page);
304int test_set_page_writeback(struct page *page);
305
306static inline void set_page_writeback(struct page *page)
307{
308 test_set_page_writeback(page);
309}
310
311#endif /* PAGE_FLAGS_H */ 310#endif /* PAGE_FLAGS_H */
diff --git a/include/linux/prctl.h b/include/linux/prctl.h
index 5c80b1939636..5ad79198d6f9 100644
--- a/include/linux/prctl.h
+++ b/include/linux/prctl.h
@@ -16,7 +16,8 @@
16# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */ 16# define PR_UNALIGN_NOPRINT 1 /* silently fix up unaligned user accesses */
17# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */ 17# define PR_UNALIGN_SIGBUS 2 /* generate SIGBUS on unaligned user access */
18 18
19/* Get/set whether or not to drop capabilities on setuid() away from uid 0 */ 19/* Get/set whether or not to drop capabilities on setuid() away from
20 * uid 0 (as per security/commoncap.c) */
20#define PR_GET_KEEPCAPS 7 21#define PR_GET_KEEPCAPS 7
21#define PR_SET_KEEPCAPS 8 22#define PR_SET_KEEPCAPS 8
22 23
@@ -63,7 +64,7 @@
63#define PR_GET_SECCOMP 21 64#define PR_GET_SECCOMP 21
64#define PR_SET_SECCOMP 22 65#define PR_SET_SECCOMP 22
65 66
66/* Get/set the capability bounding set */ 67/* Get/set the capability bounding set (as per security/commoncap.c) */
67#define PR_CAPBSET_READ 23 68#define PR_CAPBSET_READ 23
68#define PR_CAPBSET_DROP 24 69#define PR_CAPBSET_DROP 24
69 70
@@ -73,4 +74,8 @@
73# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */ 74# define PR_TSC_ENABLE 1 /* allow the use of the timestamp counter */
74# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */ 75# define PR_TSC_SIGSEGV 2 /* throw a SIGSEGV instead of reading the TSC */
75 76
77/* Get/set securebits (as per security/commoncap.c) */
78#define PR_GET_SECUREBITS 27
79#define PR_SET_SECUREBITS 28
80
76#endif /* _LINUX_PRCTL_H */ 81#endif /* _LINUX_PRCTL_H */
diff --git a/include/linux/quota.h b/include/linux/quota.h
index eb560d031acd..52e49dce6584 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -202,10 +202,14 @@ struct quota_format_type;
202 202
203struct mem_dqinfo { 203struct mem_dqinfo {
204 struct quota_format_type *dqi_format; 204 struct quota_format_type *dqi_format;
205 int dqi_fmt_id; /* Id of the dqi_format - used when turning
206 * quotas on after remount RW */
205 struct list_head dqi_dirty_list; /* List of dirty dquots */ 207 struct list_head dqi_dirty_list; /* List of dirty dquots */
206 unsigned long dqi_flags; 208 unsigned long dqi_flags;
207 unsigned int dqi_bgrace; 209 unsigned int dqi_bgrace;
208 unsigned int dqi_igrace; 210 unsigned int dqi_igrace;
211 qsize_t dqi_maxblimit;
212 qsize_t dqi_maxilimit;
209 union { 213 union {
210 struct v1_mem_dqinfo v1_i; 214 struct v1_mem_dqinfo v1_i;
211 struct v2_mem_dqinfo v2_i; 215 struct v2_mem_dqinfo v2_i;
@@ -296,8 +300,8 @@ struct dquot_operations {
296 300
297/* Operations handling requests from userspace */ 301/* Operations handling requests from userspace */
298struct quotactl_ops { 302struct quotactl_ops {
299 int (*quota_on)(struct super_block *, int, int, char *); 303 int (*quota_on)(struct super_block *, int, int, char *, int);
300 int (*quota_off)(struct super_block *, int); 304 int (*quota_off)(struct super_block *, int, int);
301 int (*quota_sync)(struct super_block *, int); 305 int (*quota_sync)(struct super_block *, int);
302 int (*get_info)(struct super_block *, int, struct if_dqinfo *); 306 int (*get_info)(struct super_block *, int, struct if_dqinfo *);
303 int (*set_info)(struct super_block *, int, struct if_dqinfo *); 307 int (*set_info)(struct super_block *, int, struct if_dqinfo *);
@@ -318,6 +322,10 @@ struct quota_format_type {
318 322
319#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ 323#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */
320#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ 324#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */
325#define DQUOT_USR_SUSPENDED 0x04 /* User diskquotas are off, but
326 * we have necessary info in
327 * memory to turn them on */
328#define DQUOT_GRP_SUSPENDED 0x08 /* The same for group quotas */
321 329
322struct quota_info { 330struct quota_info {
323 unsigned int flags; /* Flags for diskquotas on this device */ 331 unsigned int flags; /* Flags for diskquotas on this device */
@@ -329,17 +337,16 @@ struct quota_info {
329 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */ 337 struct quota_format_ops *ops[MAXQUOTAS]; /* Operations for each type */
330}; 338};
331 339
332/* Inline would be better but we need to dereference super_block which is not defined yet */
333int mark_dquot_dirty(struct dquot *dquot);
334
335#define dquot_dirty(dquot) test_bit(DQ_MOD_B, &(dquot)->dq_flags)
336
337#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \ 340#define sb_has_quota_enabled(sb, type) ((type)==USRQUOTA ? \
338 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED)) 341 (sb_dqopt(sb)->flags & DQUOT_USR_ENABLED) : (sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED))
339 342
340#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \ 343#define sb_any_quota_enabled(sb) (sb_has_quota_enabled(sb, USRQUOTA) | \
341 sb_has_quota_enabled(sb, GRPQUOTA)) 344 sb_has_quota_enabled(sb, GRPQUOTA))
342 345
346#define sb_has_quota_suspended(sb, type) \
347 ((type) == USRQUOTA ? (sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED) : \
348 (sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED))
349
343int register_quota_format(struct quota_format_type *fmt); 350int register_quota_format(struct quota_format_type *fmt);
344void unregister_quota_format(struct quota_format_type *fmt); 351void unregister_quota_format(struct quota_format_type *fmt);
345 352
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index 5110201a4159..f86702053853 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -37,11 +37,11 @@ extern int dquot_release(struct dquot *dquot);
37extern int dquot_commit_info(struct super_block *sb, int type); 37extern int dquot_commit_info(struct super_block *sb, int type);
38extern int dquot_mark_dquot_dirty(struct dquot *dquot); 38extern int dquot_mark_dquot_dirty(struct dquot *dquot);
39 39
40extern int vfs_quota_on(struct super_block *sb, int type, int format_id, char *path); 40extern int vfs_quota_on(struct super_block *sb, int type, int format_id,
41 char *path, int remount);
41extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 42extern int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
42 int format_id, int type); 43 int format_id, int type);
43extern int vfs_quota_off(struct super_block *sb, int type); 44extern int vfs_quota_off(struct super_block *sb, int type, int remount);
44#define vfs_quota_off_mount(sb, type) vfs_quota_off(sb, type)
45extern int vfs_quota_sync(struct super_block *sb, int type); 45extern int vfs_quota_sync(struct super_block *sb, int type);
46extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 46extern int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
47extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 47extern int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
@@ -59,7 +59,7 @@ extern struct quotactl_ops vfs_quotactl_ops;
59 59
60/* It is better to call this function outside of any transaction as it might 60/* It is better to call this function outside of any transaction as it might
61 * need a lot of space in journal for dquot structure allocation. */ 61 * need a lot of space in journal for dquot structure allocation. */
62static __inline__ void DQUOT_INIT(struct inode *inode) 62static inline void DQUOT_INIT(struct inode *inode)
63{ 63{
64 BUG_ON(!inode->i_sb); 64 BUG_ON(!inode->i_sb);
65 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) 65 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode))
@@ -67,7 +67,7 @@ static __inline__ void DQUOT_INIT(struct inode *inode)
67} 67}
68 68
69/* The same as with DQUOT_INIT */ 69/* The same as with DQUOT_INIT */
70static __inline__ void DQUOT_DROP(struct inode *inode) 70static inline void DQUOT_DROP(struct inode *inode)
71{ 71{
72 /* Here we can get arbitrary inode from clear_inode() so we have 72 /* Here we can get arbitrary inode from clear_inode() so we have
73 * to be careful. OTOH we don't need locking as quota operations 73 * to be careful. OTOH we don't need locking as quota operations
@@ -90,7 +90,7 @@ static __inline__ void DQUOT_DROP(struct inode *inode)
90 90
91/* The following allocation/freeing/transfer functions *must* be called inside 91/* The following allocation/freeing/transfer functions *must* be called inside
92 * a transaction (deadlocks possible otherwise) */ 92 * a transaction (deadlocks possible otherwise) */
93static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 93static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
94{ 94{
95 if (sb_any_quota_enabled(inode->i_sb)) { 95 if (sb_any_quota_enabled(inode->i_sb)) {
96 /* Used space is updated in alloc_space() */ 96 /* Used space is updated in alloc_space() */
@@ -102,7 +102,7 @@ static __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t
102 return 0; 102 return 0;
103} 103}
104 104
105static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr) 105static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
106{ 106{
107 int ret; 107 int ret;
108 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr))) 108 if (!(ret = DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr)))
@@ -110,7 +110,7 @@ static __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
110 return ret; 110 return ret;
111} 111}
112 112
113static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 113static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
114{ 114{
115 if (sb_any_quota_enabled(inode->i_sb)) { 115 if (sb_any_quota_enabled(inode->i_sb)) {
116 /* Used space is updated in alloc_space() */ 116 /* Used space is updated in alloc_space() */
@@ -122,7 +122,7 @@ static __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
122 return 0; 122 return 0;
123} 123}
124 124
125static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr) 125static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
126{ 126{
127 int ret; 127 int ret;
128 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr))) 128 if (!(ret = DQUOT_ALLOC_SPACE_NODIRTY(inode, nr)))
@@ -130,7 +130,7 @@ static __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
130 return ret; 130 return ret;
131} 131}
132 132
133static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode) 133static inline int DQUOT_ALLOC_INODE(struct inode *inode)
134{ 134{
135 if (sb_any_quota_enabled(inode->i_sb)) { 135 if (sb_any_quota_enabled(inode->i_sb)) {
136 DQUOT_INIT(inode); 136 DQUOT_INIT(inode);
@@ -140,7 +140,7 @@ static __inline__ int DQUOT_ALLOC_INODE(struct inode *inode)
140 return 0; 140 return 0;
141} 141}
142 142
143static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 143static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
144{ 144{
145 if (sb_any_quota_enabled(inode->i_sb)) 145 if (sb_any_quota_enabled(inode->i_sb))
146 inode->i_sb->dq_op->free_space(inode, nr); 146 inode->i_sb->dq_op->free_space(inode, nr);
@@ -148,19 +148,19 @@ static __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
148 inode_sub_bytes(inode, nr); 148 inode_sub_bytes(inode, nr);
149} 149}
150 150
151static __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr) 151static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
152{ 152{
153 DQUOT_FREE_SPACE_NODIRTY(inode, nr); 153 DQUOT_FREE_SPACE_NODIRTY(inode, nr);
154 mark_inode_dirty(inode); 154 mark_inode_dirty(inode);
155} 155}
156 156
157static __inline__ void DQUOT_FREE_INODE(struct inode *inode) 157static inline void DQUOT_FREE_INODE(struct inode *inode)
158{ 158{
159 if (sb_any_quota_enabled(inode->i_sb)) 159 if (sb_any_quota_enabled(inode->i_sb))
160 inode->i_sb->dq_op->free_inode(inode, 1); 160 inode->i_sb->dq_op->free_inode(inode, 1);
161} 161}
162 162
163static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr) 163static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
164{ 164{
165 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) { 165 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) {
166 DQUOT_INIT(inode); 166 DQUOT_INIT(inode);
@@ -171,14 +171,32 @@ static __inline__ int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
171} 171}
172 172
173/* The following two functions cannot be called inside a transaction */ 173/* The following two functions cannot be called inside a transaction */
174#define DQUOT_SYNC(sb) sync_dquots(sb, -1) 174static inline void DQUOT_SYNC(struct super_block *sb)
175{
176 sync_dquots(sb, -1);
177}
175 178
176static __inline__ int DQUOT_OFF(struct super_block *sb) 179static inline int DQUOT_OFF(struct super_block *sb, int remount)
177{ 180{
178 int ret = -ENOSYS; 181 int ret = -ENOSYS;
179 182
180 if (sb_any_quota_enabled(sb) && sb->s_qcop && sb->s_qcop->quota_off) 183 if (sb->s_qcop && sb->s_qcop->quota_off)
181 ret = sb->s_qcop->quota_off(sb, -1); 184 ret = sb->s_qcop->quota_off(sb, -1, remount);
185 return ret;
186}
187
188static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
189{
190 int cnt;
191 int ret = 0, err;
192
193 if (!sb->s_qcop || !sb->s_qcop->quota_on)
194 return -ENOSYS;
195 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
196 err = sb->s_qcop->quota_on(sb, cnt, 0, NULL, 1);
197 if (err < 0 && !ret)
198 ret = err;
199 }
182 return ret; 200 return ret;
183} 201}
184 202
@@ -189,13 +207,43 @@ static __inline__ int DQUOT_OFF(struct super_block *sb)
189 */ 207 */
190#define sb_dquot_ops (NULL) 208#define sb_dquot_ops (NULL)
191#define sb_quotactl_ops (NULL) 209#define sb_quotactl_ops (NULL)
192#define DQUOT_INIT(inode) do { } while(0) 210
193#define DQUOT_DROP(inode) do { } while(0) 211static inline void DQUOT_INIT(struct inode *inode)
194#define DQUOT_ALLOC_INODE(inode) (0) 212{
195#define DQUOT_FREE_INODE(inode) do { } while(0) 213}
196#define DQUOT_SYNC(sb) do { } while(0) 214
197#define DQUOT_OFF(sb) do { } while(0) 215static inline void DQUOT_DROP(struct inode *inode)
198#define DQUOT_TRANSFER(inode, iattr) (0) 216{
217}
218
219static inline int DQUOT_ALLOC_INODE(struct inode *inode)
220{
221 return 0;
222}
223
224static inline void DQUOT_FREE_INODE(struct inode *inode)
225{
226}
227
228static inline void DQUOT_SYNC(struct super_block *sb)
229{
230}
231
232static inline int DQUOT_OFF(struct super_block *sb, int remount)
233{
234 return 0;
235}
236
237static inline int DQUOT_ON_REMOUNT(struct super_block *sb)
238{
239 return 0;
240}
241
242static inline int DQUOT_TRANSFER(struct inode *inode, struct iattr *iattr)
243{
244 return 0;
245}
246
199static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr) 247static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
200{ 248{
201 inode_add_bytes(inode, nr); 249 inode_add_bytes(inode, nr);
@@ -235,11 +283,38 @@ static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
235 283
236#endif /* CONFIG_QUOTA */ 284#endif /* CONFIG_QUOTA */
237 285
238#define DQUOT_PREALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_PREALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 286static inline int DQUOT_PREALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
239#define DQUOT_PREALLOC_BLOCK(inode, nr) DQUOT_PREALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 287{
240#define DQUOT_ALLOC_BLOCK_NODIRTY(inode, nr) DQUOT_ALLOC_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 288 return DQUOT_PREALLOC_SPACE_NODIRTY(inode,
241#define DQUOT_ALLOC_BLOCK(inode, nr) DQUOT_ALLOC_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 289 nr << inode->i_sb->s_blocksize_bits);
242#define DQUOT_FREE_BLOCK_NODIRTY(inode, nr) DQUOT_FREE_SPACE_NODIRTY(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 290}
243#define DQUOT_FREE_BLOCK(inode, nr) DQUOT_FREE_SPACE(inode, ((qsize_t)(nr)) << (inode)->i_sb->s_blocksize_bits) 291
292static inline int DQUOT_PREALLOC_BLOCK(struct inode *inode, qsize_t nr)
293{
294 return DQUOT_PREALLOC_SPACE(inode,
295 nr << inode->i_sb->s_blocksize_bits);
296}
297
298static inline int DQUOT_ALLOC_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
299{
300 return DQUOT_ALLOC_SPACE_NODIRTY(inode,
301 nr << inode->i_sb->s_blocksize_bits);
302}
303
304static inline int DQUOT_ALLOC_BLOCK(struct inode *inode, qsize_t nr)
305{
306 return DQUOT_ALLOC_SPACE(inode,
307 nr << inode->i_sb->s_blocksize_bits);
308}
309
310static inline void DQUOT_FREE_BLOCK_NODIRTY(struct inode *inode, qsize_t nr)
311{
312 DQUOT_FREE_SPACE_NODIRTY(inode, nr << inode->i_sb->s_blocksize_bits);
313}
314
315static inline void DQUOT_FREE_BLOCK(struct inode *inode, qsize_t nr)
316{
317 DQUOT_FREE_SPACE(inode, nr << inode->i_sb->s_blocksize_bits);
318}
244 319
245#endif /* _LINUX_QUOTAOPS_ */ 320#endif /* _LINUX_QUOTAOPS_ */
diff --git a/include/linux/raid/raid5.h b/include/linux/raid/raid5.h
index 93678f57ccbe..f0827d31ae6f 100644
--- a/include/linux/raid/raid5.h
+++ b/include/linux/raid/raid5.h
@@ -252,6 +252,8 @@ struct r6_state {
252#define STRIPE_EXPANDING 9 252#define STRIPE_EXPANDING 9
253#define STRIPE_EXPAND_SOURCE 10 253#define STRIPE_EXPAND_SOURCE 10
254#define STRIPE_EXPAND_READY 11 254#define STRIPE_EXPAND_READY 11
255#define STRIPE_IO_STARTED 12 /* do not count towards 'bypass_count' */
256#define STRIPE_FULL_WRITE 13 /* all blocks are set to be overwritten */
255/* 257/*
256 * Operations flags (in issue order) 258 * Operations flags (in issue order)
257 */ 259 */
@@ -316,12 +318,17 @@ struct raid5_private_data {
316 int previous_raid_disks; 318 int previous_raid_disks;
317 319
318 struct list_head handle_list; /* stripes needing handling */ 320 struct list_head handle_list; /* stripes needing handling */
321 struct list_head hold_list; /* preread ready stripes */
319 struct list_head delayed_list; /* stripes that have plugged requests */ 322 struct list_head delayed_list; /* stripes that have plugged requests */
320 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */ 323 struct list_head bitmap_list; /* stripes delaying awaiting bitmap update */
321 struct bio *retry_read_aligned; /* currently retrying aligned bios */ 324 struct bio *retry_read_aligned; /* currently retrying aligned bios */
322 struct bio *retry_read_aligned_list; /* aligned bios retry list */ 325 struct bio *retry_read_aligned_list; /* aligned bios retry list */
323 atomic_t preread_active_stripes; /* stripes with scheduled io */ 326 atomic_t preread_active_stripes; /* stripes with scheduled io */
324 atomic_t active_aligned_reads; 327 atomic_t active_aligned_reads;
328 atomic_t pending_full_writes; /* full write backlog */
329 int bypass_count; /* bypassed prereads */
330 int bypass_threshold; /* preread nice */
331 struct list_head *last_hold; /* detect hold_list promotions */
325 332
326 atomic_t reshape_stripes; /* stripes with pending writes for reshape */ 333 atomic_t reshape_stripes; /* stripes with pending writes for reshape */
327 /* unfortunately we need two cache names as we temporarily have 334 /* unfortunately we need two cache names as we temporarily have
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 8e7eff2cd0ab..4aacaeecb56f 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -2176,6 +2176,7 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp,
2176 unsigned int cmd, unsigned long arg); 2176 unsigned int cmd, unsigned long arg);
2177long reiserfs_compat_ioctl(struct file *filp, 2177long reiserfs_compat_ioctl(struct file *filp,
2178 unsigned int cmd, unsigned long arg); 2178 unsigned int cmd, unsigned long arg);
2179int reiserfs_unpack(struct inode *inode, struct file *filp);
2179 2180
2180/* ioctl's command */ 2181/* ioctl's command */
2181#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long) 2182#define REISERFS_IOC_UNPACK _IOW(0xCD,1,long)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9a4f3e63e3bf..024d72b47a0c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -68,7 +68,6 @@ struct sched_param {
68#include <linux/smp.h> 68#include <linux/smp.h>
69#include <linux/sem.h> 69#include <linux/sem.h>
70#include <linux/signal.h> 70#include <linux/signal.h>
71#include <linux/securebits.h>
72#include <linux/fs_struct.h> 71#include <linux/fs_struct.h>
73#include <linux/compiler.h> 72#include <linux/compiler.h>
74#include <linux/completion.h> 73#include <linux/completion.h>
@@ -1133,7 +1132,7 @@ struct task_struct {
1133 gid_t gid,egid,sgid,fsgid; 1132 gid_t gid,egid,sgid,fsgid;
1134 struct group_info *group_info; 1133 struct group_info *group_info;
1135 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset; 1134 kernel_cap_t cap_effective, cap_inheritable, cap_permitted, cap_bset;
1136 unsigned keep_capabilities:1; 1135 unsigned securebits;
1137 struct user_struct *user; 1136 struct user_struct *user;
1138#ifdef CONFIG_KEYS 1137#ifdef CONFIG_KEYS
1139 struct key *request_key_auth; /* assumed request_key authority */ 1138 struct key *request_key_auth; /* assumed request_key authority */
diff --git a/include/linux/securebits.h b/include/linux/securebits.h
index 5b0617840fa4..c1f19dbceb05 100644
--- a/include/linux/securebits.h
+++ b/include/linux/securebits.h
@@ -3,28 +3,39 @@
3 3
4#define SECUREBITS_DEFAULT 0x00000000 4#define SECUREBITS_DEFAULT 0x00000000
5 5
6extern unsigned securebits;
7
8/* When set UID 0 has no special privileges. When unset, we support 6/* When set UID 0 has no special privileges. When unset, we support
9 inheritance of root-permissions and suid-root executable under 7 inheritance of root-permissions and suid-root executable under
10 compatibility mode. We raise the effective and inheritable bitmasks 8 compatibility mode. We raise the effective and inheritable bitmasks
11 *of the executable file* if the effective uid of the new process is 9 *of the executable file* if the effective uid of the new process is
12 0. If the real uid is 0, we raise the inheritable bitmask of the 10 0. If the real uid is 0, we raise the inheritable bitmask of the
13 executable file. */ 11 executable file. */
14#define SECURE_NOROOT 0 12#define SECURE_NOROOT 0
13#define SECURE_NOROOT_LOCKED 1 /* make bit-0 immutable */
15 14
16/* When set, setuid to/from uid 0 does not trigger capability-"fixes" 15/* When set, setuid to/from uid 0 does not trigger capability-"fixes"
17 to be compatible with old programs relying on set*uid to loose 16 to be compatible with old programs relying on set*uid to loose
18 privileges. When unset, setuid doesn't change privileges. */ 17 privileges. When unset, setuid doesn't change privileges. */
19#define SECURE_NO_SETUID_FIXUP 2 18#define SECURE_NO_SETUID_FIXUP 2
19#define SECURE_NO_SETUID_FIXUP_LOCKED 3 /* make bit-2 immutable */
20
21/* When set, a process can retain its capabilities even after
22 transitioning to a non-root user (the set-uid fixup suppressed by
23 bit 2). Bit-4 is cleared when a process calls exec(); setting both
24 bit 4 and 5 will create a barrier through exec that no exec()'d
25 child can use this feature again. */
26#define SECURE_KEEP_CAPS 4
27#define SECURE_KEEP_CAPS_LOCKED 5 /* make bit-4 immutable */
20 28
21/* Each securesetting is implemented using two bits. One bit specify 29/* Each securesetting is implemented using two bits. One bit specify
22 whether the setting is on or off. The other bit specify whether the 30 whether the setting is on or off. The other bit specify whether the
23 setting is fixed or not. A setting which is fixed cannot be changed 31 setting is fixed or not. A setting which is fixed cannot be changed
24 from user-level. */ 32 from user-level. */
33#define issecure_mask(X) (1 << (X))
34#define issecure(X) (issecure_mask(X) & current->securebits)
25 35
26#define issecure(X) ( (1 << (X+1)) & SECUREBITS_DEFAULT ? \ 36#define SECURE_ALL_BITS (issecure_mask(SECURE_NOROOT) | \
27 (1 << (X)) & SECUREBITS_DEFAULT : \ 37 issecure_mask(SECURE_NO_SETUID_FIXUP) | \
28 (1 << (X)) & securebits ) 38 issecure_mask(SECURE_KEEP_CAPS))
39#define SECURE_ALL_LOCKS (SECURE_ALL_BITS << 1)
29 40
30#endif /* !_LINUX_SECUREBITS_H */ 41#endif /* !_LINUX_SECUREBITS_H */
diff --git a/include/linux/security.h b/include/linux/security.h
index a90c06376eec..d0a28fd1747a 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -34,8 +34,6 @@
34#include <linux/xfrm.h> 34#include <linux/xfrm.h>
35#include <net/flow.h> 35#include <net/flow.h>
36 36
37extern unsigned securebits;
38
39/* Maximum number of letters for an LSM name string */ 37/* Maximum number of letters for an LSM name string */
40#define SECURITY_NAME_MAX 10 38#define SECURITY_NAME_MAX 10
41 39
@@ -61,6 +59,8 @@ extern int cap_inode_need_killpriv(struct dentry *dentry);
61extern int cap_inode_killpriv(struct dentry *dentry); 59extern int cap_inode_killpriv(struct dentry *dentry);
62extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags); 60extern int cap_task_post_setuid(uid_t old_ruid, uid_t old_euid, uid_t old_suid, int flags);
63extern void cap_task_reparent_to_init(struct task_struct *p); 61extern void cap_task_reparent_to_init(struct task_struct *p);
62extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
63 unsigned long arg4, unsigned long arg5, long *rc_p);
64extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); 64extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp);
65extern int cap_task_setioprio(struct task_struct *p, int ioprio); 65extern int cap_task_setioprio(struct task_struct *p, int ioprio);
66extern int cap_task_setnice(struct task_struct *p, int nice); 66extern int cap_task_setnice(struct task_struct *p, int nice);
@@ -720,7 +720,9 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
720 * @arg3 contains a argument. 720 * @arg3 contains a argument.
721 * @arg4 contains a argument. 721 * @arg4 contains a argument.
722 * @arg5 contains a argument. 722 * @arg5 contains a argument.
723 * Return 0 if permission is granted. 723 * @rc_p contains a pointer to communicate back the forced return code
724 * Return 0 if permission is granted, and non-zero if the security module
725 * has taken responsibility (setting *rc_p) for the prctl call.
724 * @task_reparent_to_init: 726 * @task_reparent_to_init:
725 * Set the security attributes in @p->security for a kernel thread that 727 * Set the security attributes in @p->security for a kernel thread that
726 * is being reparented to the init task. 728 * is being reparented to the init task.
@@ -1420,7 +1422,7 @@ struct security_operations {
1420 int (*task_wait) (struct task_struct *p); 1422 int (*task_wait) (struct task_struct *p);
1421 int (*task_prctl) (int option, unsigned long arg2, 1423 int (*task_prctl) (int option, unsigned long arg2,
1422 unsigned long arg3, unsigned long arg4, 1424 unsigned long arg3, unsigned long arg4,
1423 unsigned long arg5); 1425 unsigned long arg5, long *rc_p);
1424 void (*task_reparent_to_init) (struct task_struct *p); 1426 void (*task_reparent_to_init) (struct task_struct *p);
1425 void (*task_to_inode) (struct task_struct *p, struct inode *inode); 1427 void (*task_to_inode) (struct task_struct *p, struct inode *inode);
1426 1428
@@ -1684,7 +1686,7 @@ int security_task_kill(struct task_struct *p, struct siginfo *info,
1684 int sig, u32 secid); 1686 int sig, u32 secid);
1685int security_task_wait(struct task_struct *p); 1687int security_task_wait(struct task_struct *p);
1686int security_task_prctl(int option, unsigned long arg2, unsigned long arg3, 1688int security_task_prctl(int option, unsigned long arg2, unsigned long arg3,
1687 unsigned long arg4, unsigned long arg5); 1689 unsigned long arg4, unsigned long arg5, long *rc_p);
1688void security_task_reparent_to_init(struct task_struct *p); 1690void security_task_reparent_to_init(struct task_struct *p);
1689void security_task_to_inode(struct task_struct *p, struct inode *inode); 1691void security_task_to_inode(struct task_struct *p, struct inode *inode);
1690int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag); 1692int security_ipc_permission(struct kern_ipc_perm *ipcp, short flag);
@@ -2271,9 +2273,9 @@ static inline int security_task_wait(struct task_struct *p)
2271static inline int security_task_prctl(int option, unsigned long arg2, 2273static inline int security_task_prctl(int option, unsigned long arg2,
2272 unsigned long arg3, 2274 unsigned long arg3,
2273 unsigned long arg4, 2275 unsigned long arg4,
2274 unsigned long arg5) 2276 unsigned long arg5, long *rc_p)
2275{ 2277{
2276 return 0; 2278 return cap_task_prctl(option, arg2, arg3, arg3, arg5, rc_p);
2277} 2279}
2278 2280
2279static inline void security_task_reparent_to_init(struct task_struct *p) 2281static inline void security_task_reparent_to_init(struct task_struct *p)
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h
index 00b65c0a82ca..3d37c94abbc8 100644
--- a/include/linux/serial_8250.h
+++ b/include/linux/serial_8250.h
@@ -46,6 +46,7 @@ enum {
46 PLAT8250_DEV_HUB6, 46 PLAT8250_DEV_HUB6,
47 PLAT8250_DEV_MCA, 47 PLAT8250_DEV_MCA,
48 PLAT8250_DEV_AU1X00, 48 PLAT8250_DEV_AU1X00,
49 PLAT8250_DEV_SM501,
49}; 50};
50 51
51/* 52/*
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index 8d5fb36ea047..f2d12d5a21b8 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -34,8 +34,7 @@ struct shmem_sb_info {
34 uid_t uid; /* Mount uid for root directory */ 34 uid_t uid; /* Mount uid for root directory */
35 gid_t gid; /* Mount gid for root directory */ 35 gid_t gid; /* Mount gid for root directory */
36 mode_t mode; /* Mount mode for root directory */ 36 mode_t mode; /* Mount mode for root directory */
37 int policy; /* Default NUMA memory alloc policy */ 37 struct mempolicy *mpol; /* default memory policy for mappings */
38 nodemask_t policy_nodes; /* nodemask for preferred and bind */
39}; 38};
40 39
41static inline struct shmem_inode_info *SHMEM_I(struct inode *inode) 40static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 1d7d4c5797ee..a6977423baf7 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -12,11 +12,22 @@
12#include <asm/errno.h> 12#include <asm/errno.h>
13 13
14#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) 14#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
15extern void pm_set_vt_switch(int);
15extern int pm_prepare_console(void); 16extern int pm_prepare_console(void);
16extern void pm_restore_console(void); 17extern void pm_restore_console(void);
17#else 18#else
18static inline int pm_prepare_console(void) { return 0; } 19static inline void pm_set_vt_switch(int do_switch)
19static inline void pm_restore_console(void) {} 20{
21}
22
23static inline int pm_prepare_console(void)
24{
25 return 0;
26}
27
28static inline void pm_restore_console(void)
29{
30}
20#endif 31#endif
21 32
22typedef int __bitwise suspend_state_t; 33typedef int __bitwise suspend_state_t;
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 878459ae0454..0b3377650c85 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -177,11 +177,11 @@ extern void activate_page(struct page *);
177extern void mark_page_accessed(struct page *); 177extern void mark_page_accessed(struct page *);
178extern void lru_add_drain(void); 178extern void lru_add_drain(void);
179extern int lru_add_drain_all(void); 179extern int lru_add_drain_all(void);
180extern int rotate_reclaimable_page(struct page *page); 180extern void rotate_reclaimable_page(struct page *page);
181extern void swap_setup(void); 181extern void swap_setup(void);
182 182
183/* linux/mm/vmscan.c */ 183/* linux/mm/vmscan.c */
184extern unsigned long try_to_free_pages(struct zone **zones, int order, 184extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
185 gfp_t gfp_mask); 185 gfp_t gfp_mask);
186extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, 186extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
187 gfp_t gfp_mask); 187 gfp_t gfp_mask);
diff --git a/include/linux/synclink.h b/include/linux/synclink.h
index 5562fbf72095..45f6bc82d317 100644
--- a/include/linux/synclink.h
+++ b/include/linux/synclink.h
@@ -13,10 +13,6 @@
13#define _SYNCLINK_H_ 13#define _SYNCLINK_H_
14#define SYNCLINK_H_VERSION 3.6 14#define SYNCLINK_H_VERSION 3.6
15 15
16#define BOOLEAN int
17#define TRUE 1
18#define FALSE 0
19
20#define BIT0 0x0001 16#define BIT0 0x0001
21#define BIT1 0x0002 17#define BIT1 0x0002
22#define BIT2 0x0004 18#define BIT2 0x0004
diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index ce8e7da05807..364789aae9f3 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -31,6 +31,7 @@ struct vm_struct {
31 struct page **pages; 31 struct page **pages;
32 unsigned int nr_pages; 32 unsigned int nr_pages;
33 unsigned long phys_addr; 33 unsigned long phys_addr;
34 void *caller;
34}; 35};
35 36
36/* 37/*
@@ -66,6 +67,8 @@ static inline size_t get_vm_area_size(const struct vm_struct *area)
66} 67}
67 68
68extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags); 69extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
70extern struct vm_struct *get_vm_area_caller(unsigned long size,
71 unsigned long flags, void *caller);
69extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags, 72extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
70 unsigned long start, unsigned long end); 73 unsigned long start, unsigned long end);
71extern struct vm_struct *get_vm_area_node(unsigned long size, 74extern struct vm_struct *get_vm_area_node(unsigned long size,
@@ -87,4 +90,6 @@ extern void free_vm_area(struct vm_struct *area);
87extern rwlock_t vmlist_lock; 90extern rwlock_t vmlist_lock;
88extern struct vm_struct *vmlist; 91extern struct vm_struct *vmlist;
89 92
93extern const struct seq_operations vmalloc_op;
94
90#endif /* _LINUX_VMALLOC_H */ 95#endif /* _LINUX_VMALLOC_H */
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 9f1b4b46151e..e83b69346d23 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -25,6 +25,7 @@
25#define HIGHMEM_ZONE(xx) 25#define HIGHMEM_ZONE(xx)
26#endif 26#endif
27 27
28
28#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) , xx##_MOVABLE 29#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx) , xx##_MOVABLE
29 30
30enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, 31enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
@@ -37,6 +38,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
37 FOR_ALL_ZONES(PGSCAN_DIRECT), 38 FOR_ALL_ZONES(PGSCAN_DIRECT),
38 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL, 39 PGINODESTEAL, SLABS_SCANNED, KSWAPD_STEAL, KSWAPD_INODESTEAL,
39 PAGEOUTRUN, ALLOCSTALL, PGROTATED, 40 PAGEOUTRUN, ALLOCSTALL, PGROTATED,
41#ifdef CONFIG_HUGETLB_PAGE
42 HTLB_BUDDY_PGALLOC, HTLB_BUDDY_PGALLOC_FAIL,
43#endif
40 NR_VM_EVENT_ITEMS 44 NR_VM_EVENT_ITEMS
41}; 45};
42 46
@@ -174,7 +178,7 @@ static inline unsigned long node_page_state(int node,
174 zone_page_state(&zones[ZONE_MOVABLE], item); 178 zone_page_state(&zones[ZONE_MOVABLE], item);
175} 179}
176 180
177extern void zone_statistics(struct zonelist *, struct zone *); 181extern void zone_statistics(struct zone *, struct zone *);
178 182
179#else 183#else
180 184
diff --git a/include/net/compat.h b/include/net/compat.h
index 406db242f73a..05fa5d0254ab 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -40,4 +40,7 @@ extern int put_cmsg_compat(struct msghdr*, int, int, int, void *);
40 40
41extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); 41extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int);
42 42
43extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, int,
44 int (*)(struct sock *, int, int, char __user *, int));
45
43#endif /* NET_COMPAT_H */ 46#endif /* NET_COMPAT_H */
diff --git a/include/video/atmel_lcdc.h b/include/video/atmel_lcdc.h
index 336c20db87f8..ed64862c4e18 100644
--- a/include/video/atmel_lcdc.h
+++ b/include/video/atmel_lcdc.h
@@ -22,6 +22,15 @@
22#ifndef __ATMEL_LCDC_H__ 22#ifndef __ATMEL_LCDC_H__
23#define __ATMEL_LCDC_H__ 23#define __ATMEL_LCDC_H__
24 24
25
26/* Way LCD wires are connected to the chip:
27 * Some Atmel chips use BGR color mode (instead of standard RGB)
28 * A swapped wiring onboard can bring to RGB mode.
29 */
30#define ATMEL_LCDC_WIRING_BGR 0
31#define ATMEL_LCDC_WIRING_RGB 1
32
33
25 /* LCD Controller info data structure, stored in device platform_data */ 34 /* LCD Controller info data structure, stored in device platform_data */
26struct atmel_lcdfb_info { 35struct atmel_lcdfb_info {
27 spinlock_t lock; 36 spinlock_t lock;
@@ -39,8 +48,10 @@ struct atmel_lcdfb_info {
39 u8 bl_power; 48 u8 bl_power;
40#endif 49#endif
41 bool lcdcon_is_backlight; 50 bool lcdcon_is_backlight;
51 u8 saved_lcdcon;
42 52
43 u8 default_bpp; 53 u8 default_bpp;
54 u8 lcd_wiring_mode;
44 unsigned int default_lcdcon2; 55 unsigned int default_lcdcon2;
45 unsigned int default_dmacon; 56 unsigned int default_dmacon;
46 void (*atmel_lcdfb_power_control)(int on); 57 void (*atmel_lcdfb_power_control)(int on);
diff --git a/include/video/hecubafb.h b/include/video/hecubafb.h
new file mode 100644
index 000000000000..7b9952339762
--- /dev/null
+++ b/include/video/hecubafb.h
@@ -0,0 +1,51 @@
1/*
2 * hecubafb.h - definitions for the hecuba framebuffer driver
3 *
4 * Copyright (C) 2008 by Jaya Kumar
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
9 *
10 */
11
12#ifndef _LINUX_HECUBAFB_H_
13#define _LINUX_HECUBAFB_H_
14
15/* Apollo controller specific defines */
16#define APOLLO_START_NEW_IMG 0xA0
17#define APOLLO_STOP_IMG_DATA 0xA1
18#define APOLLO_DISPLAY_IMG 0xA2
19#define APOLLO_ERASE_DISPLAY 0xA3
20#define APOLLO_INIT_DISPLAY 0xA4
21
22/* Hecuba interface specific defines */
23#define HCB_WUP_BIT 0x01
24#define HCB_DS_BIT 0x02
25#define HCB_RW_BIT 0x04
26#define HCB_CD_BIT 0x08
27#define HCB_ACK_BIT 0x80
28
29/* struct used by hecuba. board specific stuff comes from *board */
30struct hecubafb_par {
31 struct fb_info *info;
32 struct hecuba_board *board;
33 void (*send_command)(struct hecubafb_par *, unsigned char);
34 void (*send_data)(struct hecubafb_par *, unsigned char);
35};
36
37/* board specific routines
38board drivers can implement wait_for_ack with interrupts if desired. if
39wait_for_ack is called with clear=0, then go to sleep and return when ack
40goes hi or if wait_for_ack with clear=1, then return when ack goes lo */
41struct hecuba_board {
42 struct module *owner;
43 void (*remove)(struct hecubafb_par *);
44 void (*set_ctl)(struct hecubafb_par *, unsigned char, unsigned char);
45 void (*set_data)(struct hecubafb_par *, unsigned char);
46 void (*wait_for_ack)(struct hecubafb_par *, int);
47 int (*init)(struct hecubafb_par *);
48};
49
50
51#endif
diff --git a/include/video/metronomefb.h b/include/video/metronomefb.h
new file mode 100644
index 000000000000..dab04b4fad7f
--- /dev/null
+++ b/include/video/metronomefb.h
@@ -0,0 +1,62 @@
1/*
2 * metronomefb.h - definitions for the metronome framebuffer driver
3 *
4 * Copyright (C) 2008 by Jaya Kumar
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
9 *
10 */
11
12#ifndef _LINUX_METRONOMEFB_H_
13#define _LINUX_METRONOMEFB_H_
14
15/* address and control descriptors used by metronome controller */
16struct metromem_desc {
17 u32 mFDADR0;
18 u32 mFSADR0;
19 u32 mFIDR0;
20 u32 mLDCMD0;
21};
22
23/* command structure used by metronome controller */
24struct metromem_cmd {
25 u16 opcode;
26 u16 args[((64-2)/2)];
27 u16 csum;
28};
29
30/* struct used by metronome. board specific stuff comes from *board */
31struct metronomefb_par {
32 unsigned char *metromem;
33 struct metromem_desc *metromem_desc;
34 struct metromem_cmd *metromem_cmd;
35 unsigned char *metromem_wfm;
36 unsigned char *metromem_img;
37 u16 *metromem_img_csum;
38 u16 *csum_table;
39 int metromemsize;
40 dma_addr_t metromem_dma;
41 dma_addr_t metromem_desc_dma;
42 struct fb_info *info;
43 struct metronome_board *board;
44 wait_queue_head_t waitq;
45 u8 frame_count;
46};
47
48/* board specific routines */
49struct metronome_board {
50 struct module *owner;
51 void (*free_irq)(struct fb_info *);
52 void (*init_gpio_regs)(struct metronomefb_par *);
53 void (*init_lcdc_regs)(struct metronomefb_par *);
54 void (*post_dma_setup)(struct metronomefb_par *);
55 void (*set_rst)(struct metronomefb_par *, int);
56 void (*set_stdby)(struct metronomefb_par *, int);
57 int (*met_wait_event)(struct metronomefb_par *);
58 int (*met_wait_event_intr)(struct metronomefb_par *);
59 int (*setup_irq)(struct fb_info *);
60};
61
62#endif