Root/
1 | #ifndef _LINUX_MMAN_H |
2 | #define _LINUX_MMAN_H |
3 | |
4 | #include <linux/mm.h> |
5 | #include <linux/percpu_counter.h> |
6 | |
7 | #include <linux/atomic.h> |
8 | #include <uapi/linux/mman.h> |
9 | |
10 | extern int sysctl_overcommit_memory; |
11 | extern int sysctl_overcommit_ratio; |
12 | extern struct percpu_counter vm_committed_as; |
13 | |
14 | #ifdef CONFIG_SMP |
15 | extern s32 vm_committed_as_batch; |
16 | #else |
17 | #define vm_committed_as_batch 0 |
18 | #endif |
19 | |
20 | unsigned long vm_memory_committed(void); |
21 | |
22 | static inline void vm_acct_memory(long pages) |
23 | { |
24 | __percpu_counter_add(&vm_committed_as, pages, vm_committed_as_batch); |
25 | } |
26 | |
27 | static inline void vm_unacct_memory(long pages) |
28 | { |
29 | vm_acct_memory(-pages); |
30 | } |
31 | |
32 | /* |
33 | * Allow architectures to handle additional protection bits |
34 | */ |
35 | |
36 | #ifndef arch_calc_vm_prot_bits |
37 | #define arch_calc_vm_prot_bits(prot) 0 |
38 | #endif |
39 | |
40 | #ifndef arch_vm_get_page_prot |
41 | #define arch_vm_get_page_prot(vm_flags) __pgprot(0) |
42 | #endif |
43 | |
44 | #ifndef arch_validate_prot |
45 | /* |
46 | * This is called from mprotect(). PROT_GROWSDOWN and PROT_GROWSUP have |
47 | * already been masked out. |
48 | * |
49 | * Returns true if the prot flags are valid |
50 | */ |
51 | static inline int arch_validate_prot(unsigned long prot) |
52 | { |
53 | return (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM)) == 0; |
54 | } |
55 | #define arch_validate_prot arch_validate_prot |
56 | #endif |
57 | |
58 | /* |
59 | * Optimisation macro. It is equivalent to: |
60 | * (x & bit1) ? bit2 : 0 |
61 | * but this version is faster. |
62 | * ("bit1" and "bit2" must be single bits) |
63 | */ |
64 | #define _calc_vm_trans(x, bit1, bit2) \ |
65 | ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \ |
66 | : ((x) & (bit1)) / ((bit1) / (bit2))) |
67 | |
68 | /* |
69 | * Combine the mmap "prot" argument into "vm_flags" used internally. |
70 | */ |
71 | static inline unsigned long |
72 | calc_vm_prot_bits(unsigned long prot) |
73 | { |
74 | return _calc_vm_trans(prot, PROT_READ, VM_READ ) | |
75 | _calc_vm_trans(prot, PROT_WRITE, VM_WRITE) | |
76 | _calc_vm_trans(prot, PROT_EXEC, VM_EXEC) | |
77 | arch_calc_vm_prot_bits(prot); |
78 | } |
79 | |
80 | /* |
81 | * Combine the mmap "flags" argument into "vm_flags" used internally. |
82 | */ |
83 | static inline unsigned long |
84 | calc_vm_flag_bits(unsigned long flags) |
85 | { |
86 | return _calc_vm_trans(flags, MAP_GROWSDOWN, VM_GROWSDOWN ) | |
87 | _calc_vm_trans(flags, MAP_DENYWRITE, VM_DENYWRITE ) | |
88 | _calc_vm_trans(flags, MAP_LOCKED, VM_LOCKED ); |
89 | } |
90 | |
91 | unsigned long vm_commit_limit(void); |
92 | #endif /* _LINUX_MMAN_H */ |
93 |
Branches:
ben-wpan
ben-wpan-stefan
javiroman/ks7010
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9