~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/vmalloc.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/vmalloc.h (Architecture i386) and /include/linux/vmalloc.h (Architecture sparc64)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_VMALLOC_H                            2 #ifndef _LINUX_VMALLOC_H
  3 #define _LINUX_VMALLOC_H                            3 #define _LINUX_VMALLOC_H
  4                                                     4 
  5 #include <linux/alloc_tag.h>                        5 #include <linux/alloc_tag.h>
  6 #include <linux/sched.h>                            6 #include <linux/sched.h>
  7 #include <linux/spinlock.h>                         7 #include <linux/spinlock.h>
  8 #include <linux/init.h>                             8 #include <linux/init.h>
  9 #include <linux/list.h>                             9 #include <linux/list.h>
 10 #include <linux/llist.h>                           10 #include <linux/llist.h>
 11 #include <asm/page.h>           /* pgprot_t */     11 #include <asm/page.h>           /* pgprot_t */
 12 #include <linux/rbtree.h>                          12 #include <linux/rbtree.h>
 13 #include <linux/overflow.h>                        13 #include <linux/overflow.h>
 14                                                    14 
 15 #include <asm/vmalloc.h>                           15 #include <asm/vmalloc.h>
 16                                                    16 
 17 struct vm_area_struct;          /* vma definin     17 struct vm_area_struct;          /* vma defining user mapping in mm_types.h */
 18 struct notifier_block;          /* in notifier     18 struct notifier_block;          /* in notifier.h */
 19 struct iov_iter;                /* in uio.h */     19 struct iov_iter;                /* in uio.h */
 20                                                    20 
 21 /* bits in flags of vmalloc's vm_struct below      21 /* bits in flags of vmalloc's vm_struct below */
 22 #define VM_IOREMAP              0x00000001         22 #define VM_IOREMAP              0x00000001      /* ioremap() and friends */
 23 #define VM_ALLOC                0x00000002         23 #define VM_ALLOC                0x00000002      /* vmalloc() */
 24 #define VM_MAP                  0x00000004         24 #define VM_MAP                  0x00000004      /* vmap()ed pages */
 25 #define VM_USERMAP              0x00000008         25 #define VM_USERMAP              0x00000008      /* suitable for remap_vmalloc_range */
 26 #define VM_DMA_COHERENT         0x00000010         26 #define VM_DMA_COHERENT         0x00000010      /* dma_alloc_coherent */
 27 #define VM_UNINITIALIZED        0x00000020         27 #define VM_UNINITIALIZED        0x00000020      /* vm_struct is not fully initialized */
 28 #define VM_NO_GUARD             0x00000040         28 #define VM_NO_GUARD             0x00000040      /* ***DANGEROUS*** don't add guard page */
 29 #define VM_KASAN                0x00000080         29 #define VM_KASAN                0x00000080      /* has allocated kasan shadow memory */
 30 #define VM_FLUSH_RESET_PERMS    0x00000100         30 #define VM_FLUSH_RESET_PERMS    0x00000100      /* reset direct map and flush TLB on unmap, can't be freed in atomic context */
 31 #define VM_MAP_PUT_PAGES        0x00000200         31 #define VM_MAP_PUT_PAGES        0x00000200      /* put pages and free array in vfree */
 32 #define VM_ALLOW_HUGE_VMAP      0x00000400         32 #define VM_ALLOW_HUGE_VMAP      0x00000400      /* Allow for huge pages on archs with HAVE_ARCH_HUGE_VMALLOC */
 33                                                    33 
 34 #if (defined(CONFIG_KASAN_GENERIC) || defined(     34 #if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \
 35         !defined(CONFIG_KASAN_VMALLOC)             35         !defined(CONFIG_KASAN_VMALLOC)
 36 #define VM_DEFER_KMEMLEAK       0x00000800         36 #define VM_DEFER_KMEMLEAK       0x00000800      /* defer kmemleak object creation */
 37 #else                                              37 #else
 38 #define VM_DEFER_KMEMLEAK       0                  38 #define VM_DEFER_KMEMLEAK       0
 39 #endif                                             39 #endif
 40 #define VM_SPARSE               0x00001000         40 #define VM_SPARSE               0x00001000      /* sparse vm_area. not all pages are present. */
 41                                                    41 
 42 /* bits [20..32] reserved for arch specific io     42 /* bits [20..32] reserved for arch specific ioremap internals */
 43                                                    43 
 44 /*                                                 44 /*
 45  * Maximum alignment for ioremap() regions.        45  * Maximum alignment for ioremap() regions.
 46  * Can be overridden by arch-specific value.       46  * Can be overridden by arch-specific value.
 47  */                                                47  */
 48 #ifndef IOREMAP_MAX_ORDER                          48 #ifndef IOREMAP_MAX_ORDER
 49 #define IOREMAP_MAX_ORDER       (7 + PAGE_SHIF     49 #define IOREMAP_MAX_ORDER       (7 + PAGE_SHIFT)        /* 128 pages */
 50 #endif                                             50 #endif
 51                                                    51 
 52 struct vm_struct {                                 52 struct vm_struct {
 53         struct vm_struct        *next;             53         struct vm_struct        *next;
 54         void                    *addr;             54         void                    *addr;
 55         unsigned long           size;              55         unsigned long           size;
 56         unsigned long           flags;             56         unsigned long           flags;
 57         struct page             **pages;           57         struct page             **pages;
 58 #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC               58 #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
 59         unsigned int            page_order;        59         unsigned int            page_order;
 60 #endif                                             60 #endif
 61         unsigned int            nr_pages;          61         unsigned int            nr_pages;
 62         phys_addr_t             phys_addr;         62         phys_addr_t             phys_addr;
 63         const void              *caller;           63         const void              *caller;
 64 };                                                 64 };
 65                                                    65 
 66 struct vmap_area {                                 66 struct vmap_area {
 67         unsigned long va_start;                    67         unsigned long va_start;
 68         unsigned long va_end;                      68         unsigned long va_end;
 69                                                    69 
 70         struct rb_node rb_node;         /* add     70         struct rb_node rb_node;         /* address sorted rbtree */
 71         struct list_head list;          /* add     71         struct list_head list;          /* address sorted list */
 72                                                    72 
 73         /*                                         73         /*
 74          * The following two variables can be      74          * The following two variables can be packed, because
 75          * a vmap_area object can be either:       75          * a vmap_area object can be either:
 76          *    1) in "free" tree (root is free_     76          *    1) in "free" tree (root is free_vmap_area_root)
 77          *    2) or "busy" tree (root is vmap_     77          *    2) or "busy" tree (root is vmap_area_root)
 78          */                                        78          */
 79         union {                                    79         union {
 80                 unsigned long subtree_max_size     80                 unsigned long subtree_max_size; /* in "free" tree */
 81                 struct vm_struct *vm;              81                 struct vm_struct *vm;           /* in "busy" tree */
 82         };                                         82         };
 83         unsigned long flags; /* mark type of v     83         unsigned long flags; /* mark type of vm_map_ram area */
 84 };                                                 84 };
 85                                                    85 
 86 /* archs that select HAVE_ARCH_HUGE_VMAP shoul     86 /* archs that select HAVE_ARCH_HUGE_VMAP should override one or more of these */
 87 #ifndef arch_vmap_p4d_supported                    87 #ifndef arch_vmap_p4d_supported
 88 static inline bool arch_vmap_p4d_supported(pgp     88 static inline bool arch_vmap_p4d_supported(pgprot_t prot)
 89 {                                                  89 {
 90         return false;                              90         return false;
 91 }                                                  91 }
 92 #endif                                             92 #endif
 93                                                    93 
 94 #ifndef arch_vmap_pud_supported                    94 #ifndef arch_vmap_pud_supported
 95 static inline bool arch_vmap_pud_supported(pgp     95 static inline bool arch_vmap_pud_supported(pgprot_t prot)
 96 {                                                  96 {
 97         return false;                              97         return false;
 98 }                                                  98 }
 99 #endif                                             99 #endif
100                                                   100 
101 #ifndef arch_vmap_pmd_supported                   101 #ifndef arch_vmap_pmd_supported
102 static inline bool arch_vmap_pmd_supported(pgp    102 static inline bool arch_vmap_pmd_supported(pgprot_t prot)
103 {                                                 103 {
104         return false;                             104         return false;
105 }                                                 105 }
106 #endif                                            106 #endif
107                                                   107 
108 #ifndef arch_vmap_pte_range_map_size              108 #ifndef arch_vmap_pte_range_map_size
109 static inline unsigned long arch_vmap_pte_rang    109 static inline unsigned long arch_vmap_pte_range_map_size(unsigned long addr, unsigned long end,
110                                                   110                                                          u64 pfn, unsigned int max_page_shift)
111 {                                                 111 {
112         return PAGE_SIZE;                         112         return PAGE_SIZE;
113 }                                                 113 }
114 #endif                                            114 #endif
115                                                   115 
116 #ifndef arch_vmap_pte_supported_shift             116 #ifndef arch_vmap_pte_supported_shift
117 static inline int arch_vmap_pte_supported_shif    117 static inline int arch_vmap_pte_supported_shift(unsigned long size)
118 {                                                 118 {
119         return PAGE_SHIFT;                        119         return PAGE_SHIFT;
120 }                                                 120 }
121 #endif                                            121 #endif
122                                                   122 
123 #ifndef arch_vmap_pgprot_tagged                   123 #ifndef arch_vmap_pgprot_tagged
124 static inline pgprot_t arch_vmap_pgprot_tagged    124 static inline pgprot_t arch_vmap_pgprot_tagged(pgprot_t prot)
125 {                                                 125 {
126         return prot;                              126         return prot;
127 }                                                 127 }
128 #endif                                            128 #endif
129                                                   129 
130 /*                                                130 /*
131  *      Highlevel APIs for driver use             131  *      Highlevel APIs for driver use
132  */                                               132  */
133 extern void vm_unmap_ram(const void *mem, unsi    133 extern void vm_unmap_ram(const void *mem, unsigned int count);
134 extern void *vm_map_ram(struct page **pages, u    134 extern void *vm_map_ram(struct page **pages, unsigned int count, int node);
135 extern void vm_unmap_aliases(void);               135 extern void vm_unmap_aliases(void);
136                                                   136 
137 #ifdef CONFIG_MMU                                 137 #ifdef CONFIG_MMU
138 extern unsigned long vmalloc_nr_pages(void);      138 extern unsigned long vmalloc_nr_pages(void);
139 #else                                             139 #else
140 static inline unsigned long vmalloc_nr_pages(v    140 static inline unsigned long vmalloc_nr_pages(void) { return 0; }
141 #endif                                            141 #endif
142                                                   142 
143 extern void *vmalloc_noprof(unsigned long size    143 extern void *vmalloc_noprof(unsigned long size) __alloc_size(1);
144 #define vmalloc(...)            alloc_hooks(vm    144 #define vmalloc(...)            alloc_hooks(vmalloc_noprof(__VA_ARGS__))
145                                                   145 
146 extern void *vzalloc_noprof(unsigned long size    146 extern void *vzalloc_noprof(unsigned long size) __alloc_size(1);
147 #define vzalloc(...)            alloc_hooks(vz    147 #define vzalloc(...)            alloc_hooks(vzalloc_noprof(__VA_ARGS__))
148                                                   148 
149 extern void *vmalloc_user_noprof(unsigned long    149 extern void *vmalloc_user_noprof(unsigned long size) __alloc_size(1);
150 #define vmalloc_user(...)       alloc_hooks(vm    150 #define vmalloc_user(...)       alloc_hooks(vmalloc_user_noprof(__VA_ARGS__))
151                                                   151 
152 extern void *vmalloc_node_noprof(unsigned long    152 extern void *vmalloc_node_noprof(unsigned long size, int node) __alloc_size(1);
153 #define vmalloc_node(...)       alloc_hooks(vm    153 #define vmalloc_node(...)       alloc_hooks(vmalloc_node_noprof(__VA_ARGS__))
154                                                   154 
155 extern void *vzalloc_node_noprof(unsigned long    155 extern void *vzalloc_node_noprof(unsigned long size, int node) __alloc_size(1);
156 #define vzalloc_node(...)       alloc_hooks(vz    156 #define vzalloc_node(...)       alloc_hooks(vzalloc_node_noprof(__VA_ARGS__))
157                                                   157 
158 extern void *vmalloc_32_noprof(unsigned long s    158 extern void *vmalloc_32_noprof(unsigned long size) __alloc_size(1);
159 #define vmalloc_32(...)         alloc_hooks(vm    159 #define vmalloc_32(...)         alloc_hooks(vmalloc_32_noprof(__VA_ARGS__))
160                                                   160 
161 extern void *vmalloc_32_user_noprof(unsigned l    161 extern void *vmalloc_32_user_noprof(unsigned long size) __alloc_size(1);
162 #define vmalloc_32_user(...)    alloc_hooks(vm    162 #define vmalloc_32_user(...)    alloc_hooks(vmalloc_32_user_noprof(__VA_ARGS__))
163                                                   163 
164 extern void *__vmalloc_noprof(unsigned long si    164 extern void *__vmalloc_noprof(unsigned long size, gfp_t gfp_mask) __alloc_size(1);
165 #define __vmalloc(...)          alloc_hooks(__    165 #define __vmalloc(...)          alloc_hooks(__vmalloc_noprof(__VA_ARGS__))
166                                                   166 
167 extern void *__vmalloc_node_range_noprof(unsig    167 extern void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
168                         unsigned long start, u    168                         unsigned long start, unsigned long end, gfp_t gfp_mask,
169                         pgprot_t prot, unsigne    169                         pgprot_t prot, unsigned long vm_flags, int node,
170                         const void *caller) __    170                         const void *caller) __alloc_size(1);
171 #define __vmalloc_node_range(...)       alloc_    171 #define __vmalloc_node_range(...)       alloc_hooks(__vmalloc_node_range_noprof(__VA_ARGS__))
172                                                   172 
173 void *__vmalloc_node_noprof(unsigned long size    173 void *__vmalloc_node_noprof(unsigned long size, unsigned long align, gfp_t gfp_mask,
174                 int node, const void *caller)     174                 int node, const void *caller) __alloc_size(1);
175 #define __vmalloc_node(...)     alloc_hooks(__    175 #define __vmalloc_node(...)     alloc_hooks(__vmalloc_node_noprof(__VA_ARGS__))
176                                                   176 
177 void *vmalloc_huge_noprof(unsigned long size,     177 void *vmalloc_huge_noprof(unsigned long size, gfp_t gfp_mask) __alloc_size(1);
178 #define vmalloc_huge(...)       alloc_hooks(vm    178 #define vmalloc_huge(...)       alloc_hooks(vmalloc_huge_noprof(__VA_ARGS__))
179                                                   179 
180 extern void *__vmalloc_array_noprof(size_t n,     180 extern void *__vmalloc_array_noprof(size_t n, size_t size, gfp_t flags) __alloc_size(1, 2);
181 #define __vmalloc_array(...)    alloc_hooks(__    181 #define __vmalloc_array(...)    alloc_hooks(__vmalloc_array_noprof(__VA_ARGS__))
182                                                   182 
183 extern void *vmalloc_array_noprof(size_t n, si    183 extern void *vmalloc_array_noprof(size_t n, size_t size) __alloc_size(1, 2);
184 #define vmalloc_array(...)      alloc_hooks(vm    184 #define vmalloc_array(...)      alloc_hooks(vmalloc_array_noprof(__VA_ARGS__))
185                                                   185 
186 extern void *__vcalloc_noprof(size_t n, size_t    186 extern void *__vcalloc_noprof(size_t n, size_t size, gfp_t flags) __alloc_size(1, 2);
187 #define __vcalloc(...)          alloc_hooks(__    187 #define __vcalloc(...)          alloc_hooks(__vcalloc_noprof(__VA_ARGS__))
188                                                   188 
189 extern void *vcalloc_noprof(size_t n, size_t s    189 extern void *vcalloc_noprof(size_t n, size_t size) __alloc_size(1, 2);
190 #define vcalloc(...)            alloc_hooks(vc    190 #define vcalloc(...)            alloc_hooks(vcalloc_noprof(__VA_ARGS__))
191                                                   191 
192 void * __must_check vrealloc_noprof(const void    192 void * __must_check vrealloc_noprof(const void *p, size_t size, gfp_t flags)
193                 __realloc_size(2);                193                 __realloc_size(2);
194 #define vrealloc(...)           alloc_hooks(vr    194 #define vrealloc(...)           alloc_hooks(vrealloc_noprof(__VA_ARGS__))
195                                                   195 
196 extern void vfree(const void *addr);              196 extern void vfree(const void *addr);
197 extern void vfree_atomic(const void *addr);       197 extern void vfree_atomic(const void *addr);
198                                                   198 
199 extern void *vmap(struct page **pages, unsigne    199 extern void *vmap(struct page **pages, unsigned int count,
200                         unsigned long flags, p    200                         unsigned long flags, pgprot_t prot);
201 void *vmap_pfn(unsigned long *pfns, unsigned i    201 void *vmap_pfn(unsigned long *pfns, unsigned int count, pgprot_t prot);
202 extern void vunmap(const void *addr);             202 extern void vunmap(const void *addr);
203                                                   203 
204 extern int remap_vmalloc_range_partial(struct     204 extern int remap_vmalloc_range_partial(struct vm_area_struct *vma,
205                                        unsigne    205                                        unsigned long uaddr, void *kaddr,
206                                        unsigne    206                                        unsigned long pgoff, unsigned long size);
207                                                   207 
208 extern int remap_vmalloc_range(struct vm_area_    208 extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
209                                                   209                                                         unsigned long pgoff);
210                                                   210 
211 /*                                                211 /*
212  * Architectures can set this mask to a combin    212  * Architectures can set this mask to a combination of PGTBL_P?D_MODIFIED values
213  * and let generic vmalloc and ioremap code kn    213  * and let generic vmalloc and ioremap code know when arch_sync_kernel_mappings()
214  * needs to be called.                            214  * needs to be called.
215  */                                               215  */
216 #ifndef ARCH_PAGE_TABLE_SYNC_MASK                 216 #ifndef ARCH_PAGE_TABLE_SYNC_MASK
217 #define ARCH_PAGE_TABLE_SYNC_MASK 0               217 #define ARCH_PAGE_TABLE_SYNC_MASK 0
218 #endif                                            218 #endif
219                                                   219 
220 /*                                                220 /*
221  * There is no default implementation for arch    221  * There is no default implementation for arch_sync_kernel_mappings(). It is
222  * relied upon the compiler to optimize calls     222  * relied upon the compiler to optimize calls out if ARCH_PAGE_TABLE_SYNC_MASK
223  * is 0.                                          223  * is 0.
224  */                                               224  */
225 void arch_sync_kernel_mappings(unsigned long s    225 void arch_sync_kernel_mappings(unsigned long start, unsigned long end);
226                                                   226 
227 /*                                                227 /*
228  *      Lowlevel-APIs (not for driver use!)       228  *      Lowlevel-APIs (not for driver use!)
229  */                                               229  */
230                                                   230 
231 static inline size_t get_vm_area_size(const st    231 static inline size_t get_vm_area_size(const struct vm_struct *area)
232 {                                                 232 {
233         if (!(area->flags & VM_NO_GUARD))         233         if (!(area->flags & VM_NO_GUARD))
234                 /* return actual size without     234                 /* return actual size without guard page */
235                 return area->size - PAGE_SIZE;    235                 return area->size - PAGE_SIZE;
236         else                                      236         else
237                 return area->size;                237                 return area->size;
238                                                   238 
239 }                                                 239 }
240                                                   240 
241 extern struct vm_struct *get_vm_area(unsigned     241 extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
242 extern struct vm_struct *get_vm_area_caller(un    242 extern struct vm_struct *get_vm_area_caller(unsigned long size,
243                                         unsign    243                                         unsigned long flags, const void *caller);
244 extern struct vm_struct *__get_vm_area_caller(    244 extern struct vm_struct *__get_vm_area_caller(unsigned long size,
245                                         unsign    245                                         unsigned long flags,
246                                         unsign    246                                         unsigned long start, unsigned long end,
247                                         const     247                                         const void *caller);
248 void free_vm_area(struct vm_struct *area);        248 void free_vm_area(struct vm_struct *area);
249 extern struct vm_struct *remove_vm_area(const     249 extern struct vm_struct *remove_vm_area(const void *addr);
250 extern struct vm_struct *find_vm_area(const vo    250 extern struct vm_struct *find_vm_area(const void *addr);
251 struct vmap_area *find_vmap_area(unsigned long    251 struct vmap_area *find_vmap_area(unsigned long addr);
252                                                   252 
253 static inline bool is_vm_area_hugepages(const     253 static inline bool is_vm_area_hugepages(const void *addr)
254 {                                                 254 {
255         /*                                        255         /*
256          * This may not 100% tell if the area     256          * This may not 100% tell if the area is mapped with > PAGE_SIZE
257          * page table entries, if for some rea    257          * page table entries, if for some reason the architecture indicates
258          * larger sizes are available but deci    258          * larger sizes are available but decides not to use them, nothing
259          * prevents that. This only indicates     259          * prevents that. This only indicates the size of the physical page
260          * allocated in the vmalloc layer.        260          * allocated in the vmalloc layer.
261          */                                       261          */
262 #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC              262 #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC
263         return find_vm_area(addr)->page_order     263         return find_vm_area(addr)->page_order > 0;
264 #else                                             264 #else
265         return false;                             265         return false;
266 #endif                                            266 #endif
267 }                                                 267 }
268                                                   268 
269 #ifdef CONFIG_MMU                                 269 #ifdef CONFIG_MMU
270 int vm_area_map_pages(struct vm_struct *area,     270 int vm_area_map_pages(struct vm_struct *area, unsigned long start,
271                       unsigned long end, struc    271                       unsigned long end, struct page **pages);
272 void vm_area_unmap_pages(struct vm_struct *are    272 void vm_area_unmap_pages(struct vm_struct *area, unsigned long start,
273                          unsigned long end);      273                          unsigned long end);
274 void vunmap_range(unsigned long addr, unsigned    274 void vunmap_range(unsigned long addr, unsigned long end);
275 static inline void set_vm_flush_reset_perms(vo    275 static inline void set_vm_flush_reset_perms(void *addr)
276 {                                                 276 {
277         struct vm_struct *vm = find_vm_area(ad    277         struct vm_struct *vm = find_vm_area(addr);
278                                                   278 
279         if (vm)                                   279         if (vm)
280                 vm->flags |= VM_FLUSH_RESET_PE    280                 vm->flags |= VM_FLUSH_RESET_PERMS;
281 }                                                 281 }
282                                                   282 
283 #else                                             283 #else
284 static inline void set_vm_flush_reset_perms(vo    284 static inline void set_vm_flush_reset_perms(void *addr)
285 {                                                 285 {
286 }                                                 286 }
287 #endif                                            287 #endif
288                                                   288 
289 /* for /proc/kcore */                             289 /* for /proc/kcore */
290 extern long vread_iter(struct iov_iter *iter,     290 extern long vread_iter(struct iov_iter *iter, const char *addr, size_t count);
291                                                   291 
292 /*                                                292 /*
293  *      Internals.  Don't use..                   293  *      Internals.  Don't use..
294  */                                               294  */
295 extern __init void vm_area_add_early(struct vm    295 extern __init void vm_area_add_early(struct vm_struct *vm);
296 extern __init void vm_area_register_early(stru    296 extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
297                                                   297 
298 #ifdef CONFIG_SMP                                 298 #ifdef CONFIG_SMP
299 # ifdef CONFIG_MMU                                299 # ifdef CONFIG_MMU
300 struct vm_struct **pcpu_get_vm_areas(const uns    300 struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
301                                      const siz    301                                      const size_t *sizes, int nr_vms,
302                                      size_t al    302                                      size_t align);
303                                                   303 
304 void pcpu_free_vm_areas(struct vm_struct **vms    304 void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms);
305 # else                                            305 # else
306 static inline struct vm_struct **                 306 static inline struct vm_struct **
307 pcpu_get_vm_areas(const unsigned long *offsets    307 pcpu_get_vm_areas(const unsigned long *offsets,
308                 const size_t *sizes, int nr_vm    308                 const size_t *sizes, int nr_vms,
309                 size_t align)                     309                 size_t align)
310 {                                                 310 {
311         return NULL;                              311         return NULL;
312 }                                                 312 }
313                                                   313 
314 static inline void                                314 static inline void
315 pcpu_free_vm_areas(struct vm_struct **vms, int    315 pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
316 {                                                 316 {
317 }                                                 317 }
318 # endif                                           318 # endif
319 #endif                                            319 #endif
320                                                   320 
321 #ifdef CONFIG_MMU                                 321 #ifdef CONFIG_MMU
322 #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_S    322 #define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
323 #else                                             323 #else
324 #define VMALLOC_TOTAL 0UL                         324 #define VMALLOC_TOTAL 0UL
325 #endif                                            325 #endif
326                                                   326 
327 int register_vmap_purge_notifier(struct notifi    327 int register_vmap_purge_notifier(struct notifier_block *nb);
328 int unregister_vmap_purge_notifier(struct noti    328 int unregister_vmap_purge_notifier(struct notifier_block *nb);
329                                                   329 
330 #if defined(CONFIG_MMU) && defined(CONFIG_PRIN    330 #if defined(CONFIG_MMU) && defined(CONFIG_PRINTK)
331 bool vmalloc_dump_obj(void *object);              331 bool vmalloc_dump_obj(void *object);
332 #else                                             332 #else
333 static inline bool vmalloc_dump_obj(void *obje    333 static inline bool vmalloc_dump_obj(void *object) { return false; }
334 #endif                                            334 #endif
335                                                   335 
336 #endif /* _LINUX_VMALLOC_H */                     336 #endif /* _LINUX_VMALLOC_H */
337                                                   337 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php