History

Merge branch 'akpm' (patches from Andrew)

Merge yet more updates from Andrew Morton: - the rest of MM - various misc fixes and tweaks * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (22 commits) mm: Change return type int to vm_fault_t for fault handlers lib/fonts: convert comments to utf-8 s390: ebcdic: convert comments to UTF-8 treewide: convert ISO_8859-1 text comments to utf-8 drivers/gpu/drm/gma500/: change return type to vm_fault_t docs/core-api: mm-api: add section about GFP flags docs/mm: make GFP flags descriptions usable as kernel-doc docs/core-api: split memory management API to a separate file docs/core-api: move *{str,mem}dup* to "String Manipulation" docs/core-api: kill trailing whitespace in kernel-api.rst mm/util: add kernel-doc for kvfree mm/util: make strndup_user description a kernel-doc comment fs/proc/vmcore.c: hide vmcoredd_mmap_dumps() for nommu builds treewide: correct "differenciate" and "instanciate" typos fs/afs: use new return type vm_fault_t drivers/hwtracing/intel_th/msu.c: change return type to vm_fault_t mm: soft-offline: close the race against page allocation mm: fix race on soft-offlining free huge pages namei: allow restricted O_CREAT of FIFOs and regular files hfs: prevent crash on exit from failed search ...

Linus Torvalds committed 8 years ago

Commit 33e17872 parents d475fac 2b7403063 files · +1209 −1006Browse files

Showing the changes to include/linux (9 of 63 files). Show all

Unified · Split

9 files
  1. include/linux/fs.h +2 −0
  2. include/linux/gfp.h +154 −137
  3. include/linux/huge_mm.h +5 −4
  4. include/linux/hugetlb.h +1 −1
  5. include/linux/mm.h +7 −7
  6. include/linux/oom.h +1 −1
  7. include/linux/page-flags.h +5 −0
  8. include/linux/swapops.h +3 −12
  9. include/linux/userfaultfd_k.h +3 −2
include/linux/fs.h+2−0
@@ -74,6 +74,8 @@ extern struct inodes_stat_t inodes_stat; · 73 unmodified lines
74extern int leases_enable, lease_break_time;74extern int leases_enable, lease_break_time;
75extern int sysctl_protected_symlinks;75extern int sysctl_protected_symlinks;
76extern int sysctl_protected_hardlinks;76extern int sysctl_protected_hardlinks;
77extern int sysctl_protected_fifos;
78extern int sysctl_protected_regular;
77 79
78typedef __kernel_rwf_t rwf_t;80typedef __kernel_rwf_t rwf_t;
79 81
include/linux/gfp.h+154−137
@@ -59,29 +59,32 @@ struct vm_area_struct; · 58 unmodified lines
59#define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* ZONE_MOVABLE allowed */59#define __GFP_MOVABLE ((__force gfp_t)___GFP_MOVABLE) /* ZONE_MOVABLE allowed */
60#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)60#define GFP_ZONEMASK (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
61 61
62/*62/**
63 * DOC: Page mobility and placement hints
64 *
63 * Page mobility and placement hints65 * Page mobility and placement hints
66 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64 *67 *
65 * These flags provide hints about how mobile the page is. Pages with similar68 * These flags provide hints about how mobile the page is. Pages with similar
66 * mobility are placed within the same pageblocks to minimise problems due69 * mobility are placed within the same pageblocks to minimise problems due
67 * to external fragmentation.70 * to external fragmentation.
68 *71 *
69 * __GFP_MOVABLE (also a zone modifier) indicates that the page can be72 * %__GFP_MOVABLE (also a zone modifier) indicates that the page can be
70 * moved by page migration during memory compaction or can be reclaimed.73 * moved by page migration during memory compaction or can be reclaimed.
71 *74 *
72 * __GFP_RECLAIMABLE is used for slab allocations that specify75 * %__GFP_RECLAIMABLE is used for slab allocations that specify
73 * SLAB_RECLAIM_ACCOUNT and whose pages can be freed via shrinkers.76 * SLAB_RECLAIM_ACCOUNT and whose pages can be freed via shrinkers.
74 *77 *
75 * __GFP_WRITE indicates the caller intends to dirty the page. Where possible,78 * %__GFP_WRITE indicates the caller intends to dirty the page. Where possible,
76 * these pages will be spread between local zones to avoid all the dirty79 * these pages will be spread between local zones to avoid all the dirty
77 * pages being in one zone (fair zone allocation policy).80 * pages being in one zone (fair zone allocation policy).
78 *81 *
79 * __GFP_HARDWALL enforces the cpuset memory allocation policy.82 * %__GFP_HARDWALL enforces the cpuset memory allocation policy.
80 *83 *
81 * __GFP_THISNODE forces the allocation to be satisified from the requested84 * %__GFP_THISNODE forces the allocation to be satisified from the requested
82 * node with no fallbacks or placement policy enforcements.85 * node with no fallbacks or placement policy enforcements.
83 *86 *
84 * __GFP_ACCOUNT causes the allocation to be accounted to kmemcg.87 * %__GFP_ACCOUNT causes the allocation to be accounted to kmemcg.
85 */88 */
86#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE)89#define __GFP_RECLAIMABLE ((__force gfp_t)___GFP_RECLAIMABLE)
87#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE)90#define __GFP_WRITE ((__force gfp_t)___GFP_WRITE)
@@ -89,54 +92,60 @@ struct vm_area_struct; · 1 unmodified line
89#define __GFP_THISNODE ((__force gfp_t)___GFP_THISNODE)92#define __GFP_THISNODE ((__force gfp_t)___GFP_THISNODE)
90#define __GFP_ACCOUNT ((__force gfp_t)___GFP_ACCOUNT)93#define __GFP_ACCOUNT ((__force gfp_t)___GFP_ACCOUNT)
91 94
92/*95/**
96 * DOC: Watermark modifiers
97 *
93 * Watermark modifiers -- controls access to emergency reserves98 * Watermark modifiers -- controls access to emergency reserves
99 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94 *100 *
95 * __GFP_HIGH indicates that the caller is high-priority and that granting101 * %__GFP_HIGH indicates that the caller is high-priority and that granting
96 * the request is necessary before the system can make forward progress.102 * the request is necessary before the system can make forward progress.
97 * For example, creating an IO context to clean pages.103 * For example, creating an IO context to clean pages.
98 *104 *
99 * __GFP_ATOMIC indicates that the caller cannot reclaim or sleep and is105 * %__GFP_ATOMIC indicates that the caller cannot reclaim or sleep and is
100 * high priority. Users are typically interrupt handlers. This may be106 * high priority. Users are typically interrupt handlers. This may be
101 * used in conjunction with __GFP_HIGH107 * used in conjunction with %__GFP_HIGH
102 *108 *
103 * __GFP_MEMALLOC allows access to all memory. This should only be used when109 * %__GFP_MEMALLOC allows access to all memory. This should only be used when
104 * the caller guarantees the allocation will allow more memory to be freed110 * the caller guarantees the allocation will allow more memory to be freed
105 * very shortly e.g. process exiting or swapping. Users either should111 * very shortly e.g. process exiting or swapping. Users either should
106 * be the MM or co-ordinating closely with the VM (e.g. swap over NFS).112 * be the MM or co-ordinating closely with the VM (e.g. swap over NFS).
107 *113 *
108 * __GFP_NOMEMALLOC is used to explicitly forbid access to emergency reserves.114 * %__GFP_NOMEMALLOC is used to explicitly forbid access to emergency reserves.
109 * This takes precedence over the __GFP_MEMALLOC flag if both are set.115 * This takes precedence over the %__GFP_MEMALLOC flag if both are set.
110 */116 */
111#define __GFP_ATOMIC ((__force gfp_t)___GFP_ATOMIC)117#define __GFP_ATOMIC ((__force gfp_t)___GFP_ATOMIC)
112#define __GFP_HIGH ((__force gfp_t)___GFP_HIGH)118#define __GFP_HIGH ((__force gfp_t)___GFP_HIGH)
113#define __GFP_MEMALLOC ((__force gfp_t)___GFP_MEMALLOC)119#define __GFP_MEMALLOC ((__force gfp_t)___GFP_MEMALLOC)
114#define __GFP_NOMEMALLOC ((__force gfp_t)___GFP_NOMEMALLOC)120#define __GFP_NOMEMALLOC ((__force gfp_t)___GFP_NOMEMALLOC)
115 121
116/*122/**
123 * DOC: Reclaim modifiers
124 *
117 * Reclaim modifiers125 * Reclaim modifiers
126 * ~~~~~~~~~~~~~~~~~
118 *127 *
119 * __GFP_IO can start physical IO.128 * %__GFP_IO can start physical IO.
120 *129 *
121 * __GFP_FS can call down to the low-level FS. Clearing the flag avoids the130 * %__GFP_FS can call down to the low-level FS. Clearing the flag avoids the
122 * allocator recursing into the filesystem which might already be holding131 * allocator recursing into the filesystem which might already be holding
123 * locks.132 * locks.
124 *133 *
125 * __GFP_DIRECT_RECLAIM indicates that the caller may enter direct reclaim.134 * %__GFP_DIRECT_RECLAIM indicates that the caller may enter direct reclaim.
126 * This flag can be cleared to avoid unnecessary delays when a fallback135 * This flag can be cleared to avoid unnecessary delays when a fallback
127 * option is available.136 * option is available.
128 *137 *
129 * __GFP_KSWAPD_RECLAIM indicates that the caller wants to wake kswapd when138 * %__GFP_KSWAPD_RECLAIM indicates that the caller wants to wake kswapd when
130 * the low watermark is reached and have it reclaim pages until the high139 * the low watermark is reached and have it reclaim pages until the high
131 * watermark is reached. A caller may wish to clear this flag when fallback140 * watermark is reached. A caller may wish to clear this flag when fallback
132 * options are available and the reclaim is likely to disrupt the system. The141 * options are available and the reclaim is likely to disrupt the system. The
133 * canonical example is THP allocation where a fallback is cheap but142 * canonical example is THP allocation where a fallback is cheap but
134 * reclaim/compaction may cause indirect stalls.143 * reclaim/compaction may cause indirect stalls.
135 *144 *
136 * __GFP_RECLAIM is shorthand to allow/forbid both direct and kswapd reclaim.145 * %__GFP_RECLAIM is shorthand to allow/forbid both direct and kswapd reclaim.
137 *146 *
138 * The default allocator behavior depends on the request size. We have a concept147 * The default allocator behavior depends on the request size. We have a concept
139 * of so called costly allocations (with order > PAGE_ALLOC_COSTLY_ORDER).148 * of so called costly allocations (with order > %PAGE_ALLOC_COSTLY_ORDER).
140 * !costly allocations are too essential to fail so they are implicitly149 * !costly allocations are too essential to fail so they are implicitly
141 * non-failing by default (with some exceptions like OOM victims might fail so150 * non-failing by default (with some exceptions like OOM victims might fail so
142 * the caller still has to check for failures) while costly requests try to be151 * the caller still has to check for failures) while costly requests try to be
@@ -144,40 +153,40 @@ struct vm_area_struct; · 1 unmodified line
144 * The following three modifiers might be used to override some of these153 * The following three modifiers might be used to override some of these
145 * implicit rules154 * implicit rules
146 *155 *
147 * __GFP_NORETRY: The VM implementation will try only very lightweight156 * %__GFP_NORETRY: The VM implementation will try only very lightweight
148 * memory direct reclaim to get some memory under memory pressure (thus157 * memory direct reclaim to get some memory under memory pressure (thus
149 * it can sleep). It will avoid disruptive actions like OOM killer. The158 * it can sleep). It will avoid disruptive actions like OOM killer. The
150 * caller must handle the failure which is quite likely to happen under159 * caller must handle the failure which is quite likely to happen under
151 * heavy memory pressure. The flag is suitable when failure can easily be160 * heavy memory pressure. The flag is suitable when failure can easily be
152 * handled at small cost, such as reduced throughput161 * handled at small cost, such as reduced throughput
153 *162 *
154 * __GFP_RETRY_MAYFAIL: The VM implementation will retry memory reclaim163 * %__GFP_RETRY_MAYFAIL: The VM implementation will retry memory reclaim
155 * procedures that have previously failed if there is some indication164 * procedures that have previously failed if there is some indication
156 * that progress has been made else where. It can wait for other165 * that progress has been made else where. It can wait for other
157 * tasks to attempt high level approaches to freeing memory such as166 * tasks to attempt high level approaches to freeing memory such as
158 * compaction (which removes fragmentation) and page-out.167 * compaction (which removes fragmentation) and page-out.
159 * There is still a definite limit to the number of retries, but it is168 * There is still a definite limit to the number of retries, but it is
160 * a larger limit than with __GFP_NORETRY.169 * a larger limit than with %__GFP_NORETRY.
161 * Allocations with this flag may fail, but only when there is170 * Allocations with this flag may fail, but only when there is
162 * genuinely little unused memory. While these allocations do not171 * genuinely little unused memory. While these allocations do not
163 * directly trigger the OOM killer, their failure indicates that172 * directly trigger the OOM killer, their failure indicates that
164 * the system is likely to need to use the OOM killer soon. The173 * the system is likely to need to use the OOM killer soon. The
165 * caller must handle failure, but can reasonably do so by failing174 * caller must handle failure, but can reasonably do so by failing
166 * a higher-level request, or completing it only in a much less175 * a higher-level request, or completing it only in a much less
167 * efficient manner.176 * efficient manner.
168 * If the allocation does fail, and the caller is in a position to177 * If the allocation does fail, and the caller is in a position to
169 * free some non-essential memory, doing so could benefit the system178 * free some non-essential memory, doing so could benefit the system
170 * as a whole.179 * as a whole.
171 *180 *
172 * __GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller181 * %__GFP_NOFAIL: The VM implementation _must_ retry infinitely: the caller
173 * cannot handle allocation failures. The allocation could block182 * cannot handle allocation failures. The allocation could block
174 * indefinitely but will never return with failure. Testing for183 * indefinitely but will never return with failure. Testing for
175 * failure is pointless.184 * failure is pointless.
176 * New users should be evaluated carefully (and the flag should be185 * New users should be evaluated carefully (and the flag should be
177 * used only when there is no reasonable failure policy) but it is186 * used only when there is no reasonable failure policy) but it is
178 * definitely preferable to use the flag rather than opencode endless187 * definitely preferable to use the flag rather than opencode endless
179 * loop around allocator.188 * loop around allocator.
180 * Using this flag for costly allocations is _highly_ discouraged.189 * Using this flag for costly allocations is _highly_ discouraged.
181 */190 */
182#define __GFP_IO ((__force gfp_t)___GFP_IO)191#define __GFP_IO ((__force gfp_t)___GFP_IO)
183#define __GFP_FS ((__force gfp_t)___GFP_FS)192#define __GFP_FS ((__force gfp_t)___GFP_FS)
@@ -188,14 +197,17 @@ struct vm_area_struct; · 4 unmodified lines
188#define __GFP_NOFAIL ((__force gfp_t)___GFP_NOFAIL)197#define __GFP_NOFAIL ((__force gfp_t)___GFP_NOFAIL)
189#define __GFP_NORETRY ((__force gfp_t)___GFP_NORETRY)198#define __GFP_NORETRY ((__force gfp_t)___GFP_NORETRY)
190 199
191/*200/**
201 * DOC: Action modifiers
202 *
192 * Action modifiers203 * Action modifiers
204 * ~~~~~~~~~~~~~~~~
193 *205 *
194 * __GFP_NOWARN suppresses allocation failure reports.206 * %__GFP_NOWARN suppresses allocation failure reports.
195 *207 *
196 * __GFP_COMP address compound page metadata.208 * %__GFP_COMP address compound page metadata.
197 *209 *
198 * __GFP_ZERO returns a zeroed page on success.210 * %__GFP_ZERO returns a zeroed page on success.
199 */211 */
200#define __GFP_NOWARN ((__force gfp_t)___GFP_NOWARN)212#define __GFP_NOWARN ((__force gfp_t)___GFP_NOWARN)
201#define __GFP_COMP ((__force gfp_t)___GFP_COMP)213#define __GFP_COMP ((__force gfp_t)___GFP_COMP)
@@ -208,66 +220,71 @@ struct vm_area_struct; · 6 unmodified lines
208#define __GFP_BITS_SHIFT (23 + IS_ENABLED(CONFIG_LOCKDEP))220#define __GFP_BITS_SHIFT (23 + IS_ENABLED(CONFIG_LOCKDEP))
209#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))221#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
210 222
211/*223/**
224 * DOC: Useful GFP flag combinations
225 *
226 * Useful GFP flag combinations
227 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
228 *
212 * Useful GFP flag combinations that are commonly used. It is recommended229 * Useful GFP flag combinations that are commonly used. It is recommended
213 * that subsystems start with one of these combinations and then set/clear230 * that subsystems start with one of these combinations and then set/clear
214 * __GFP_FOO flags as necessary.231 * %__GFP_FOO flags as necessary.
215 *232 *
216 * GFP_ATOMIC users can not sleep and need the allocation to succeed. A lower233 * %GFP_ATOMIC users can not sleep and need the allocation to succeed. A lower
217 * watermark is applied to allow access to "atomic reserves"234 * watermark is applied to allow access to "atomic reserves"
218 *235 *
219 * GFP_KERNEL is typical for kernel-internal allocations. The caller requires236 * %GFP_KERNEL is typical for kernel-internal allocations. The caller requires
220 * ZONE_NORMAL or a lower zone for direct access but can direct reclaim.237 * %ZONE_NORMAL or a lower zone for direct access but can direct reclaim.
221 *238 *
222 * GFP_KERNEL_ACCOUNT is the same as GFP_KERNEL, except the allocation is239 * %GFP_KERNEL_ACCOUNT is the same as GFP_KERNEL, except the allocation is
223 * accounted to kmemcg.240 * accounted to kmemcg.
224 *241 *
225 * GFP_NOWAIT is for kernel allocations that should not stall for direct242 * %GFP_NOWAIT is for kernel allocations that should not stall for direct
226 * reclaim, start physical IO or use any filesystem callback.243 * reclaim, start physical IO or use any filesystem callback.
227 *244 *
228 * GFP_NOIO will use direct reclaim to discard clean pages or slab pages245 * %GFP_NOIO will use direct reclaim to discard clean pages or slab pages
229 * that do not require the starting of any physical IO.246 * that do not require the starting of any physical IO.
230 * Please try to avoid using this flag directly and instead use247 * Please try to avoid using this flag directly and instead use
231 * memalloc_noio_{save,restore} to mark the whole scope which cannot248 * memalloc_noio_{save,restore} to mark the whole scope which cannot
232 * perform any IO with a short explanation why. All allocation requests249 * perform any IO with a short explanation why. All allocation requests
233 * will inherit GFP_NOIO implicitly.250 * will inherit GFP_NOIO implicitly.
234 *251 *
235 * GFP_NOFS will use direct reclaim but will not use any filesystem interfaces.252 * %GFP_NOFS will use direct reclaim but will not use any filesystem interfaces.
236 * Please try to avoid using this flag directly and instead use253 * Please try to avoid using this flag directly and instead use
237 * memalloc_nofs_{save,restore} to mark the whole scope which cannot/shouldn't254 * memalloc_nofs_{save,restore} to mark the whole scope which cannot/shouldn't
238 * recurse into the FS layer with a short explanation why. All allocation255 * recurse into the FS layer with a short explanation why. All allocation
239 * requests will inherit GFP_NOFS implicitly.256 * requests will inherit GFP_NOFS implicitly.
240 *257 *
241 * GFP_USER is for userspace allocations that also need to be directly258 * %GFP_USER is for userspace allocations that also need to be directly
242 * accessibly by the kernel or hardware. It is typically used by hardware259 * accessibly by the kernel or hardware. It is typically used by hardware
243 * for buffers that are mapped to userspace (e.g. graphics) that hardware260 * for buffers that are mapped to userspace (e.g. graphics) that hardware
244 * still must DMA to. cpuset limits are enforced for these allocations.261 * still must DMA to. cpuset limits are enforced for these allocations.
245 *262 *
246 * GFP_DMA exists for historical reasons and should be avoided where possible.263 * %GFP_DMA exists for historical reasons and should be avoided where possible.
247 * The flags indicates that the caller requires that the lowest zone be264 * The flags indicates that the caller requires that the lowest zone be
248 * used (ZONE_DMA or 16M on x86-64). Ideally, this would be removed but265 * used (%ZONE_DMA or 16M on x86-64). Ideally, this would be removed but
249 * it would require careful auditing as some users really require it and266 * it would require careful auditing as some users really require it and
250 * others use the flag to avoid lowmem reserves in ZONE_DMA and treat the267 * others use the flag to avoid lowmem reserves in %ZONE_DMA and treat the
251 * lowest zone as a type of emergency reserve.268 * lowest zone as a type of emergency reserve.
252 *269 *
253 * GFP_DMA32 is similar to GFP_DMA except that the caller requires a 32-bit270 * %GFP_DMA32 is similar to %GFP_DMA except that the caller requires a 32-bit
254 * address.271 * address.
255 *272 *
256 * GFP_HIGHUSER is for userspace allocations that may be mapped to userspace,273 * %GFP_HIGHUSER is for userspace allocations that may be mapped to userspace,
257 * do not need to be directly accessible by the kernel but that cannot274 * do not need to be directly accessible by the kernel but that cannot
258 * move once in use. An example may be a hardware allocation that maps275 * move once in use. An example may be a hardware allocation that maps
259 * data directly into userspace but has no addressing limitations.276 * data directly into userspace but has no addressing limitations.
260 *277 *
261 * GFP_HIGHUSER_MOVABLE is for userspace allocations that the kernel does not278 * %GFP_HIGHUSER_MOVABLE is for userspace allocations that the kernel does not
262 * need direct access to but can use kmap() when access is required. They279 * need direct access to but can use kmap() when access is required. They
263 * are expected to be movable via page reclaim or page migration. Typically,280 * are expected to be movable via page reclaim or page migration. Typically,
264 * pages on the LRU would also be allocated with GFP_HIGHUSER_MOVABLE.281 * pages on the LRU would also be allocated with %GFP_HIGHUSER_MOVABLE.
265 *282 *
266 * GFP_TRANSHUGE and GFP_TRANSHUGE_LIGHT are used for THP allocations. They are283 * %GFP_TRANSHUGE and %GFP_TRANSHUGE_LIGHT are used for THP allocations. They
267 * compound allocations that will generally fail quickly if memory is not284 * are compound allocations that will generally fail quickly if memory is not
268 * available and will not wake kswapd/kcompactd on failure. The _LIGHT285 * available and will not wake kswapd/kcompactd on failure. The _LIGHT
269 * version does not attempt reclaim/compaction at all and is by default used286 * version does not attempt reclaim/compaction at all and is by default used
270 * in page fault path, while the non-light is used by khugepaged.287 * in page fault path, while the non-light is used by khugepaged.
271 */288 */
272#define GFP_ATOMIC (__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM)289#define GFP_ATOMIC (__GFP_HIGH|__GFP_ATOMIC|__GFP_KSWAPD_RECLAIM)
273#define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS)290#define GFP_KERNEL (__GFP_RECLAIM | __GFP_IO | __GFP_FS)
include/linux/huge_mm.h+5−4
@@ -6,7 +6,7 @@ · 5 unmodified lines
6 6
7#include <linux/fs.h> /* only for vma_is_dax() */7#include <linux/fs.h> /* only for vma_is_dax() */
8 8
9extern int do_huge_pmd_anonymous_page(struct vm_fault *vmf);9extern vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf);
10extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,10extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
11 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,11 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
12 struct vm_area_struct *vma);12 struct vm_area_struct *vma);
@@ -23,7 +23,7 @@ static inline void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud) · 10 unmodified lines
23}23}
24#endif24#endif
25 25
26extern int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);26extern vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);
27extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,27extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
28 unsigned long addr,28 unsigned long addr,
29 pmd_t *pmd,29 pmd_t *pmd,
@@ -216,7 +216,7 @@ struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr, · 186 unmodified lines
216struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,216struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,
217 pud_t *pud, int flags);217 pud_t *pud, int flags);
218 218
219extern int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);219extern vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);
220 220
221extern struct page *huge_zero_page;221extern struct page *huge_zero_page;
222 222
@@ -321,7 +321,8 @@ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, · 98 unmodified lines
321 return NULL;321 return NULL;
322}322}
323 323
324static inline int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd)324static inline vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf,
325 pmd_t orig_pmd)
325{326{
326 return 0;327 return 0;
327}328}
include/linux/hugetlb.h+1−1
@@ -105,7 +105,7 @@ void hugetlb_report_meminfo(struct seq_file *); · 104 unmodified lines
105int hugetlb_report_node_meminfo(int, char *);105int hugetlb_report_node_meminfo(int, char *);
106void hugetlb_show_meminfo(void);106void hugetlb_show_meminfo(void);
107unsigned long hugetlb_total_pages(void);107unsigned long hugetlb_total_pages(void);
108int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,108vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
109 unsigned long address, unsigned int flags);109 unsigned long address, unsigned int flags);
110int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t *dst_pte,110int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t *dst_pte,
111 struct vm_area_struct *dst_vma,111 struct vm_area_struct *dst_vma,
include/linux/mm.h+7−7
@@ -728,10 +728,10 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma) · 727 unmodified lines
728 return pte;728 return pte;
729}729}
730 730
731int alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,731vm_fault_t alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg,
732 struct page *page);732 struct page *page);
733int finish_fault(struct vm_fault *vmf);733vm_fault_t finish_fault(struct vm_fault *vmf);
734int finish_mkwrite_fault(struct vm_fault *vmf);734vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf);
735#endif735#endif
736 736
737/*737/*
@@ -1403,8 +1403,8 @@ int generic_error_remove_page(struct address_space *mapping, struct page *page); · 665 unmodified lines
1403int invalidate_inode_page(struct page *page);1403int invalidate_inode_page(struct page *page);
1404 1404
1405#ifdef CONFIG_MMU1405#ifdef CONFIG_MMU
1406extern int handle_mm_fault(struct vm_area_struct *vma, unsigned long address,1406extern vm_fault_t handle_mm_fault(struct vm_area_struct *vma,
1407 unsigned int flags);1407 unsigned long address, unsigned int flags);
1408extern int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,1408extern int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,
1409 unsigned long address, unsigned int fault_flags,1409 unsigned long address, unsigned int fault_flags,
1410 bool *unlocked);1410 bool *unlocked);
@@ -1413,7 +1413,7 @@ void unmap_mapping_pages(struct address_space *mapping, · 2 unmodified lines
1413void unmap_mapping_range(struct address_space *mapping,1413void unmap_mapping_range(struct address_space *mapping,
1414 loff_t const holebegin, loff_t const holelen, int even_cows);1414 loff_t const holebegin, loff_t const holelen, int even_cows);
1415#else1415#else
1416static inline int handle_mm_fault(struct vm_area_struct *vma,1416static inline vm_fault_t handle_mm_fault(struct vm_area_struct *vma,
1417 unsigned long address, unsigned int flags)1417 unsigned long address, unsigned int flags)
1418{1418{
1419 /* should never happen if there's no MMU */1419 /* should never happen if there's no MMU */
@@ -2563,7 +2563,7 @@ static inline struct page *follow_page(struct vm_area_struct *vma, · 1143 unmodified lines
2563#define FOLL_COW 0x4000 /* internal GUP flag */2563#define FOLL_COW 0x4000 /* internal GUP flag */
2564#define FOLL_ANON 0x8000 /* don't do file mappings */2564#define FOLL_ANON 0x8000 /* don't do file mappings */
2565 2565
2566static inline int vm_fault_to_errno(int vm_fault, int foll_flags)2566static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags)
2567{2567{
2568 if (vm_fault & VM_FAULT_OOM)2568 if (vm_fault & VM_FAULT_OOM)
2569 return -ENOMEM;2569 return -ENOMEM;
include/linux/oom.h+1−1
@@ -88,7 +88,7 @@ static inline bool mm_is_oom_victim(struct mm_struct *mm) · 87 unmodified lines
88 *88 *
89 * Return 0 when the PF is safe VM_FAULT_SIGBUS otherwise.89 * Return 0 when the PF is safe VM_FAULT_SIGBUS otherwise.
90 */90 */
91static inline int check_stable_address_space(struct mm_struct *mm)91static inline vm_fault_t check_stable_address_space(struct mm_struct *mm)
92{92{
93 if (unlikely(test_bit(MMF_UNSTABLE, &mm->flags)))93 if (unlikely(test_bit(MMF_UNSTABLE, &mm->flags)))
94 return VM_FAULT_SIGBUS;94 return VM_FAULT_SIGBUS;
include/linux/page-flags.h+5−0
@@ -369,8 +369,13 @@ PAGEFLAG_FALSE(Uncached) · 368 unmodified lines
369PAGEFLAG(HWPoison, hwpoison, PF_ANY)369PAGEFLAG(HWPoison, hwpoison, PF_ANY)
370TESTSCFLAG(HWPoison, hwpoison, PF_ANY)370TESTSCFLAG(HWPoison, hwpoison, PF_ANY)
371#define __PG_HWPOISON (1UL << PG_hwpoison)371#define __PG_HWPOISON (1UL << PG_hwpoison)
372extern bool set_hwpoison_free_buddy_page(struct page *page);
372#else373#else
373PAGEFLAG_FALSE(HWPoison)374PAGEFLAG_FALSE(HWPoison)
375static inline bool set_hwpoison_free_buddy_page(struct page *page)
376{
377 return 0;
378}
374#define __PG_HWPOISON 0379#define __PG_HWPOISON 0
375#endif380#endif
376 381
include/linux/swapops.h+3−12
@@ -4,6 +4,7 @@ · 3 unmodified lines
4 4
5#include <linux/radix-tree.h>5#include <linux/radix-tree.h>
6#include <linux/bug.h>6#include <linux/bug.h>
7#include <linux/mm_types.h>
7 8
8/*9/*
9 * swapcache pages are stored in the swapper_space radix tree. We want to10 * swapcache pages are stored in the swapper_space radix tree. We want to
@@ -134,7 +135,7 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry) · 124 unmodified lines
134 return pfn_to_page(swp_offset(entry));135 return pfn_to_page(swp_offset(entry));
135}136}
136 137
137int device_private_entry_fault(struct vm_area_struct *vma,138vm_fault_t device_private_entry_fault(struct vm_area_struct *vma,
138 unsigned long addr,139 unsigned long addr,
139 swp_entry_t entry,140 swp_entry_t entry,
140 unsigned int flags,141 unsigned int flags,
@@ -169,7 +170,7 @@ static inline struct page *device_private_entry_to_page(swp_entry_t entry) · 28 unmodified lines
169 return NULL;170 return NULL;
170}171}
171 172
172static inline int device_private_entry_fault(struct vm_area_struct *vma,173static inline vm_fault_t device_private_entry_fault(struct vm_area_struct *vma,
173 unsigned long addr,174 unsigned long addr,
174 swp_entry_t entry,175 swp_entry_t entry,
175 unsigned int flags,176 unsigned int flags,
@@ -340,11 +341,6 @@ static inline int is_hwpoison_entry(swp_entry_t entry) · 164 unmodified lines
340 return swp_type(entry) == SWP_HWPOISON;341 return swp_type(entry) == SWP_HWPOISON;
341}342}
342 343
343static inline bool test_set_page_hwpoison(struct page *page)
344{
345 return TestSetPageHWPoison(page);
346}
347
348static inline void num_poisoned_pages_inc(void)344static inline void num_poisoned_pages_inc(void)
349{345{
350 atomic_long_inc(&num_poisoned_pages);346 atomic_long_inc(&num_poisoned_pages);
@@ -367,11 +363,6 @@ static inline int is_hwpoison_entry(swp_entry_t swp) · 16 unmodified lines
367 return 0;363 return 0;
368}364}
369 365
370static inline bool test_set_page_hwpoison(struct page *page)
371{
372 return false;
373}
374
375static inline void num_poisoned_pages_inc(void)366static inline void num_poisoned_pages_inc(void)
376{367{
377}368}
include/linux/userfaultfd_k.h+3−2
@@ -28,7 +28,7 @@ · 27 unmodified lines
28#define UFFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)28#define UFFD_SHARED_FCNTL_FLAGS (O_CLOEXEC | O_NONBLOCK)
29#define UFFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS)29#define UFFD_FLAGS_SET (EFD_SHARED_FCNTL_FLAGS)
30 30
31extern int handle_userfault(struct vm_fault *vmf, unsigned long reason);31extern vm_fault_t handle_userfault(struct vm_fault *vmf, unsigned long reason);
32 32
33extern ssize_t mcopy_atomic(struct mm_struct *dst_mm, unsigned long dst_start,33extern ssize_t mcopy_atomic(struct mm_struct *dst_mm, unsigned long dst_start,
34 unsigned long src_start, unsigned long len,34 unsigned long src_start, unsigned long len,
@@ -77,7 +77,8 @@ extern void userfaultfd_unmap_complete(struct mm_struct *mm, · 42 unmodified lines
77#else /* CONFIG_USERFAULTFD */77#else /* CONFIG_USERFAULTFD */
78 78
79/* mm helpers */79/* mm helpers */
80static inline int handle_userfault(struct vm_fault *vmf, unsigned long reason)80static inline vm_fault_t handle_userfault(struct vm_fault *vmf,
81 unsigned long reason)
81{82{
82 return VM_FAULT_SIGBUS;83 return VM_FAULT_SIGBUS;
83}84}