vma.h (14611508cb5bf031f85bae58704c9218681d8e07) | vma.h (c4d91e225ff3c9821c85ac6efd8e02c0025c0190) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * vma.h 4 * 5 * Core VMA manipulation API implemented in vma.c. 6 */ 7#ifndef __MM_VMA_H 8#define __MM_VMA_H --- 45 unchanged lines hidden (view full) --- 54 55enum vma_merge_state { 56 VMA_MERGE_START, 57 VMA_MERGE_ERROR_NOMEM, 58 VMA_MERGE_NOMERGE, 59 VMA_MERGE_SUCCESS, 60}; 61 | 1/* SPDX-License-Identifier: GPL-2.0-or-later */ 2/* 3 * vma.h 4 * 5 * Core VMA manipulation API implemented in vma.c. 6 */ 7#ifndef __MM_VMA_H 8#define __MM_VMA_H --- 45 unchanged lines hidden (view full) --- 54 55enum vma_merge_state { 56 VMA_MERGE_START, 57 VMA_MERGE_ERROR_NOMEM, 58 VMA_MERGE_NOMERGE, 59 VMA_MERGE_SUCCESS, 60}; 61 |
62enum vma_merge_flags { 63 VMG_FLAG_DEFAULT = 0, 64 /* 65 * If we can expand, simply do so. We know there is nothing to merge to 66 * the right. Does not reset state upon failure to merge. The VMA 67 * iterator is assumed to be positioned at the previous VMA, rather than 68 * at the gap. 69 */ 70 VMG_FLAG_JUST_EXPAND = 1 << 0, 71}; 72 |
|
62/* Represents a VMA merge operation. */ 63struct vma_merge_struct { 64 struct mm_struct *mm; 65 struct vma_iterator *vmi; 66 pgoff_t pgoff; 67 struct vm_area_struct *prev; 68 struct vm_area_struct *next; /* Modified by vma_merge(). */ 69 struct vm_area_struct *vma; /* Either a new VMA or the one being modified. */ 70 unsigned long start; 71 unsigned long end; 72 unsigned long flags; 73 struct file *file; 74 struct anon_vma *anon_vma; 75 struct mempolicy *policy; 76 struct vm_userfaultfd_ctx uffd_ctx; 77 struct anon_vma_name *anon_name; | 73/* Represents a VMA merge operation. */ 74struct vma_merge_struct { 75 struct mm_struct *mm; 76 struct vma_iterator *vmi; 77 pgoff_t pgoff; 78 struct vm_area_struct *prev; 79 struct vm_area_struct *next; /* Modified by vma_merge(). */ 80 struct vm_area_struct *vma; /* Either a new VMA or the one being modified. */ 81 unsigned long start; 82 unsigned long end; 83 unsigned long flags; 84 struct file *file; 85 struct anon_vma *anon_vma; 86 struct mempolicy *policy; 87 struct vm_userfaultfd_ctx uffd_ctx; 88 struct anon_vma_name *anon_name; |
89 enum vma_merge_flags merge_flags; |
|
78 enum vma_merge_state state; 79}; 80 81static inline bool vmg_nomem(struct vma_merge_struct *vmg) 82{ 83 return vmg->state == VMA_MERGE_ERROR_NOMEM; 84} 85 --- 8 unchanged lines hidden (view full) --- 94 struct vma_merge_struct name = { \ 95 .mm = mm_, \ 96 .vmi = vmi_, \ 97 .start = start_, \ 98 .end = end_, \ 99 .flags = flags_, \ 100 .pgoff = pgoff_, \ 101 .state = VMA_MERGE_START, \ | 90 enum vma_merge_state state; 91}; 92 93static inline bool vmg_nomem(struct vma_merge_struct *vmg) 94{ 95 return vmg->state == VMA_MERGE_ERROR_NOMEM; 96} 97 --- 8 unchanged lines hidden (view full) --- 106 struct vma_merge_struct name = { \ 107 .mm = mm_, \ 108 .vmi = vmi_, \ 109 .start = start_, \ 110 .end = end_, \ 111 .flags = flags_, \ 112 .pgoff = pgoff_, \ 113 .state = VMA_MERGE_START, \ |
114 .merge_flags = VMG_FLAG_DEFAULT, \ |
|
102 } 103 104#define VMG_VMA_STATE(name, vmi_, prev_, vma_, start_, end_) \ 105 struct vma_merge_struct name = { \ 106 .mm = vma_->vm_mm, \ 107 .vmi = vmi_, \ 108 .prev = prev_, \ 109 .next = NULL, \ 110 .vma = vma_, \ 111 .start = start_, \ 112 .end = end_, \ 113 .flags = vma_->vm_flags, \ 114 .pgoff = vma_pgoff_offset(vma_, start_), \ 115 .file = vma_->vm_file, \ 116 .anon_vma = vma_->anon_vma, \ 117 .policy = vma_policy(vma_), \ 118 .uffd_ctx = vma_->vm_userfaultfd_ctx, \ 119 .anon_name = anon_vma_name(vma_), \ 120 .state = VMA_MERGE_START, \ | 115 } 116 117#define VMG_VMA_STATE(name, vmi_, prev_, vma_, start_, end_) \ 118 struct vma_merge_struct name = { \ 119 .mm = vma_->vm_mm, \ 120 .vmi = vmi_, \ 121 .prev = prev_, \ 122 .next = NULL, \ 123 .vma = vma_, \ 124 .start = start_, \ 125 .end = end_, \ 126 .flags = vma_->vm_flags, \ 127 .pgoff = vma_pgoff_offset(vma_, start_), \ 128 .file = vma_->vm_file, \ 129 .anon_vma = vma_->anon_vma, \ 130 .policy = vma_policy(vma_), \ 131 .uffd_ctx = vma_->vm_userfaultfd_ctx, \ 132 .anon_name = anon_vma_name(vma_), \ 133 .state = VMA_MERGE_START, \ |
134 .merge_flags = VMG_FLAG_DEFAULT, \ |
|
121 } 122 123#ifdef CONFIG_DEBUG_VM_MAPLE_TREE 124void validate_mm(struct mm_struct *mm); 125#else 126#define validate_mm(mm) do { } while (0) 127#endif 128 --- 424 unchanged lines hidden --- | 135 } 136 137#ifdef CONFIG_DEBUG_VM_MAPLE_TREE 138void validate_mm(struct mm_struct *mm); 139#else 140#define validate_mm(mm) do { } while (0) 141#endif 142 --- 424 unchanged lines hidden --- |