diff options
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r-- | mm/mempolicy.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 2a8206009422..b21869a39f0b 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -330,9 +330,19 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end, | |||
330 | int err; | 330 | int err; |
331 | struct vm_area_struct *first, *vma, *prev; | 331 | struct vm_area_struct *first, *vma, *prev; |
332 | 332 | ||
333 | /* Clear the LRU lists so pages can be isolated */ | 333 | if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) { |
334 | if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) | 334 | /* Must have swap device for migration */ |
335 | if (nr_swap_pages <= 0) | ||
336 | return ERR_PTR(-ENODEV); | ||
337 | |||
338 | /* | ||
339 | * Clear the LRU lists so pages can be isolated. | ||
340 | * Note that pages may be moved off the LRU after we have | ||
341 | * drained them. Those pages will fail to migrate like other | ||
342 | * pages that may be busy. | ||
343 | */ | ||
335 | lru_add_drain_all(); | 344 | lru_add_drain_all(); |
345 | } | ||
336 | 346 | ||
337 | first = find_vma(mm, start); | 347 | first = find_vma(mm, start); |
338 | if (!first) | 348 | if (!first) |