Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: move vma_modify() and helpers to internal header

These are core VMA manipulation functions which invoke VMA splitting and
merging and should not be directly accessed from outside of mm/.

Link: https://lkml.kernel.org/r/5efde0c6342a8860d5ffc90b415f3989fd8ed0b2.1722251717.git.lorenzo.stoakes@oracle.com
Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Brendan Higgins <brendanhiggins@google.com>
Cc: Christian Brauner <brauner@kernel.org>
Cc: David Gow <davidgow@google.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Kees Cook <kees@kernel.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Rae Moar <rmoar@google.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Pengfei Xu <pengfei.xu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Lorenzo Stoakes and committed by
Andrew Morton
fa04c08f a17c7d8f

+61 -60
-60
include/linux/mm.h
··· 3279 3279 unsigned long addr, unsigned long len, pgoff_t pgoff, 3280 3280 bool *need_rmap_locks); 3281 3281 extern void exit_mmap(struct mm_struct *); 3282 - struct vm_area_struct *vma_modify(struct vma_iterator *vmi, 3283 - struct vm_area_struct *prev, 3284 - struct vm_area_struct *vma, 3285 - unsigned long start, unsigned long end, 3286 - unsigned long vm_flags, 3287 - struct mempolicy *policy, 3288 - struct vm_userfaultfd_ctx uffd_ctx, 3289 - struct anon_vma_name *anon_name); 3290 - 3291 - /* We are about to modify the VMA's flags. */ 3292 - static inline struct vm_area_struct 3293 - *vma_modify_flags(struct vma_iterator *vmi, 3294 - struct vm_area_struct *prev, 3295 - struct vm_area_struct *vma, 3296 - unsigned long start, unsigned long end, 3297 - unsigned long new_flags) 3298 - { 3299 - return vma_modify(vmi, prev, vma, start, end, new_flags, 3300 - vma_policy(vma), vma->vm_userfaultfd_ctx, 3301 - anon_vma_name(vma)); 3302 - } 3303 - 3304 - /* We are about to modify the VMA's flags and/or anon_name. */ 3305 - static inline struct vm_area_struct 3306 - *vma_modify_flags_name(struct vma_iterator *vmi, 3307 - struct vm_area_struct *prev, 3308 - struct vm_area_struct *vma, 3309 - unsigned long start, 3310 - unsigned long end, 3311 - unsigned long new_flags, 3312 - struct anon_vma_name *new_name) 3313 - { 3314 - return vma_modify(vmi, prev, vma, start, end, new_flags, 3315 - vma_policy(vma), vma->vm_userfaultfd_ctx, new_name); 3316 - } 3317 - 3318 - /* We are about to modify the VMA's memory policy. */ 3319 - static inline struct vm_area_struct 3320 - *vma_modify_policy(struct vma_iterator *vmi, 3321 - struct vm_area_struct *prev, 3322 - struct vm_area_struct *vma, 3323 - unsigned long start, unsigned long end, 3324 - struct mempolicy *new_pol) 3325 - { 3326 - return vma_modify(vmi, prev, vma, start, end, vma->vm_flags, 3327 - new_pol, vma->vm_userfaultfd_ctx, anon_vma_name(vma)); 3328 - } 3329 - 3330 - /* We are about to modify the VMA's flags and/or uffd context. */ 3331 - static inline struct vm_area_struct 3332 - *vma_modify_flags_uffd(struct vma_iterator *vmi, 3333 - struct vm_area_struct *prev, 3334 - struct vm_area_struct *vma, 3335 - unsigned long start, unsigned long end, 3336 - unsigned long new_flags, 3337 - struct vm_userfaultfd_ctx new_ctx) 3338 - { 3339 - return vma_modify(vmi, prev, vma, start, end, new_flags, 3340 - vma_policy(vma), new_ctx, anon_vma_name(vma)); 3341 - } 3342 3282 3343 3283 static inline int check_data_rlimit(unsigned long rlim, 3344 3284 unsigned long new,
+61
mm/internal.h
··· 1244 1244 struct vm_area_struct *vma, 1245 1245 unsigned long delta); 1246 1246 1247 + struct vm_area_struct *vma_modify(struct vma_iterator *vmi, 1248 + struct vm_area_struct *prev, 1249 + struct vm_area_struct *vma, 1250 + unsigned long start, unsigned long end, 1251 + unsigned long vm_flags, 1252 + struct mempolicy *policy, 1253 + struct vm_userfaultfd_ctx uffd_ctx, 1254 + struct anon_vma_name *anon_name); 1255 + 1256 + /* We are about to modify the VMA's flags. */ 1257 + static inline struct vm_area_struct 1258 + *vma_modify_flags(struct vma_iterator *vmi, 1259 + struct vm_area_struct *prev, 1260 + struct vm_area_struct *vma, 1261 + unsigned long start, unsigned long end, 1262 + unsigned long new_flags) 1263 + { 1264 + return vma_modify(vmi, prev, vma, start, end, new_flags, 1265 + vma_policy(vma), vma->vm_userfaultfd_ctx, 1266 + anon_vma_name(vma)); 1267 + } 1268 + 1269 + /* We are about to modify the VMA's flags and/or anon_name. */ 1270 + static inline struct vm_area_struct 1271 + *vma_modify_flags_name(struct vma_iterator *vmi, 1272 + struct vm_area_struct *prev, 1273 + struct vm_area_struct *vma, 1274 + unsigned long start, 1275 + unsigned long end, 1276 + unsigned long new_flags, 1277 + struct anon_vma_name *new_name) 1278 + { 1279 + return vma_modify(vmi, prev, vma, start, end, new_flags, 1280 + vma_policy(vma), vma->vm_userfaultfd_ctx, new_name); 1281 + } 1282 + 1283 + /* We are about to modify the VMA's memory policy. */ 1284 + static inline struct vm_area_struct 1285 + *vma_modify_policy(struct vma_iterator *vmi, 1286 + struct vm_area_struct *prev, 1287 + struct vm_area_struct *vma, 1288 + unsigned long start, unsigned long end, 1289 + struct mempolicy *new_pol) 1290 + { 1291 + return vma_modify(vmi, prev, vma, start, end, vma->vm_flags, 1292 + new_pol, vma->vm_userfaultfd_ctx, anon_vma_name(vma)); 1293 + } 1294 + 1295 + /* We are about to modify the VMA's flags and/or uffd context. */ 1296 + static inline struct vm_area_struct 1297 + *vma_modify_flags_uffd(struct vma_iterator *vmi, 1298 + struct vm_area_struct *prev, 1299 + struct vm_area_struct *vma, 1300 + unsigned long start, unsigned long end, 1301 + unsigned long new_flags, 1302 + struct vm_userfaultfd_ctx new_ctx) 1303 + { 1304 + return vma_modify(vmi, prev, vma, start, end, new_flags, 1305 + vma_policy(vma), new_ctx, anon_vma_name(vma)); 1306 + } 1307 + 1247 1308 enum { 1248 1309 /* mark page accessed */ 1249 1310 FOLL_TOUCH = 1 << 16,