diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bootmem.h | 32 | ||||
-rw-r--r-- | include/linux/hugetlb.h | 13 |
2 files changed, 43 insertions, 2 deletions
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 82bd8842d11c..3b03b0b868dd 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -43,7 +43,7 @@ typedef struct bootmem_data { | |||
43 | extern unsigned long __init bootmem_bootmap_pages (unsigned long); | 43 | extern unsigned long __init bootmem_bootmap_pages (unsigned long); |
44 | extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); | 44 | extern unsigned long __init init_bootmem (unsigned long addr, unsigned long memend); |
45 | extern void __init free_bootmem (unsigned long addr, unsigned long size); | 45 | extern void __init free_bootmem (unsigned long addr, unsigned long size); |
46 | extern void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal); | 46 | extern void * __init __alloc_bootmem_limit (unsigned long size, unsigned long align, unsigned long goal, unsigned long limit); |
47 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 47 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE |
48 | extern void __init reserve_bootmem (unsigned long addr, unsigned long size); | 48 | extern void __init reserve_bootmem (unsigned long addr, unsigned long size); |
49 | #define alloc_bootmem(x) \ | 49 | #define alloc_bootmem(x) \ |
@@ -54,6 +54,16 @@ extern void __init reserve_bootmem (unsigned long addr, unsigned long size); | |||
54 | __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 54 | __alloc_bootmem((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
55 | #define alloc_bootmem_low_pages(x) \ | 55 | #define alloc_bootmem_low_pages(x) \ |
56 | __alloc_bootmem((x), PAGE_SIZE, 0) | 56 | __alloc_bootmem((x), PAGE_SIZE, 0) |
57 | |||
58 | #define alloc_bootmem_limit(x, limit) \ | ||
59 | __alloc_bootmem_limit((x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS), (limit)) | ||
60 | #define alloc_bootmem_low_limit(x, limit) \ | ||
61 | __alloc_bootmem_limit((x), SMP_CACHE_BYTES, 0, (limit)) | ||
62 | #define alloc_bootmem_pages_limit(x, limit) \ | ||
63 | __alloc_bootmem_limit((x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS), (limit)) | ||
64 | #define alloc_bootmem_low_pages_limit(x, limit) \ | ||
65 | __alloc_bootmem_limit((x), PAGE_SIZE, 0, (limit)) | ||
66 | |||
57 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | 67 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ |
58 | extern unsigned long __init free_all_bootmem (void); | 68 | extern unsigned long __init free_all_bootmem (void); |
59 | 69 | ||
@@ -61,7 +71,7 @@ extern unsigned long __init init_bootmem_node (pg_data_t *pgdat, unsigned long f | |||
61 | extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); | 71 | extern void __init reserve_bootmem_node (pg_data_t *pgdat, unsigned long physaddr, unsigned long size); |
62 | extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); | 72 | extern void __init free_bootmem_node (pg_data_t *pgdat, unsigned long addr, unsigned long size); |
63 | extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat); | 73 | extern unsigned long __init free_all_bootmem_node (pg_data_t *pgdat); |
64 | extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal); | 74 | extern void * __init __alloc_bootmem_node_limit (pg_data_t *pgdat, unsigned long size, unsigned long align, unsigned long goal, unsigned long limit); |
65 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE | 75 | #ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE |
66 | #define alloc_bootmem_node(pgdat, x) \ | 76 | #define alloc_bootmem_node(pgdat, x) \ |
67 | __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) | 77 | __alloc_bootmem_node((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS)) |
@@ -69,6 +79,14 @@ extern void * __init __alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, | |||
69 | __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) | 79 | __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS)) |
70 | #define alloc_bootmem_low_pages_node(pgdat, x) \ | 80 | #define alloc_bootmem_low_pages_node(pgdat, x) \ |
71 | __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) | 81 | __alloc_bootmem_node((pgdat), (x), PAGE_SIZE, 0) |
82 | |||
83 | #define alloc_bootmem_node_limit(pgdat, x, limit) \ | ||
84 | __alloc_bootmem_node_limit((pgdat), (x), SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS), (limit)) | ||
85 | #define alloc_bootmem_pages_node_limit(pgdat, x, limit) \ | ||
86 | __alloc_bootmem_node_limit((pgdat), (x), PAGE_SIZE, __pa(MAX_DMA_ADDRESS), (limit)) | ||
87 | #define alloc_bootmem_low_pages_node_limit(pgdat, x, limit) \ | ||
88 | __alloc_bootmem_node_limit((pgdat), (x), PAGE_SIZE, 0, (limit)) | ||
89 | |||
72 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ | 90 | #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ |
73 | 91 | ||
74 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP | 92 | #ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP |
@@ -105,5 +123,15 @@ extern void *__init alloc_large_system_hash(const char *tablename, | |||
105 | #endif | 123 | #endif |
106 | extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */ | 124 | extern int __initdata hashdist; /* Distribute hashes across NUMA nodes? */ |
107 | 125 | ||
126 | static inline void *__alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal) | ||
127 | { | ||
128 | return __alloc_bootmem_limit(size, align, goal, 0); | ||
129 | } | ||
130 | |||
131 | static inline void *__alloc_bootmem_node (pg_data_t *pgdat, unsigned long size, unsigned long align, | ||
132 | unsigned long goal) | ||
133 | { | ||
134 | return __alloc_bootmem_node_limit(pgdat, size, align, goal, 0); | ||
135 | } | ||
108 | 136 | ||
109 | #endif /* _LINUX_BOOTMEM_H */ | 137 | #endif /* _LINUX_BOOTMEM_H */ |
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index e670b0d13fe0..42cb7d70f9ac 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h | |||
@@ -155,11 +155,24 @@ static inline void set_file_hugepages(struct file *file) | |||
155 | { | 155 | { |
156 | file->f_op = &hugetlbfs_file_operations; | 156 | file->f_op = &hugetlbfs_file_operations; |
157 | } | 157 | } |
158 | |||
159 | static inline int valid_hugetlb_file_off(struct vm_area_struct *vma, | ||
160 | unsigned long address) | ||
161 | { | ||
162 | struct inode *inode = vma->vm_file->f_dentry->d_inode; | ||
163 | loff_t file_off = address - vma->vm_start; | ||
164 | |||
165 | file_off += (vma->vm_pgoff << PAGE_SHIFT); | ||
166 | |||
167 | return (file_off < inode->i_size); | ||
168 | } | ||
169 | |||
158 | #else /* !CONFIG_HUGETLBFS */ | 170 | #else /* !CONFIG_HUGETLBFS */ |
159 | 171 | ||
160 | #define is_file_hugepages(file) 0 | 172 | #define is_file_hugepages(file) 0 |
161 | #define set_file_hugepages(file) BUG() | 173 | #define set_file_hugepages(file) BUG() |
162 | #define hugetlb_zero_setup(size) ERR_PTR(-ENOSYS) | 174 | #define hugetlb_zero_setup(size) ERR_PTR(-ENOSYS) |
175 | #define valid_hugetlb_file_off(vma, address) 0 | ||
163 | 176 | ||
164 | #endif /* !CONFIG_HUGETLBFS */ | 177 | #endif /* !CONFIG_HUGETLBFS */ |
165 | 178 | ||