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.

[PATCH] page migration: Fail with error if swap not setup

Currently the migration of anonymous pages will silently fail if no swap is
setup. This patch makes page migration functions check for available swap
and fail with -ENODEV if no swap space is available.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Christoph Lameter and committed by
Linus Torvalds
90036ee5 e0e8eb54

+12 -2
+12 -2
mm/mempolicy.c
··· 330 330 int err; 331 331 struct vm_area_struct *first, *vma, *prev; 332 332 333 - /* Clear the LRU lists so pages can be isolated */ 334 - if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) 333 + 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 344 lru_add_drain_all(); 345 + } 336 346 337 347 first = find_vma(mm, start); 338 348 if (!first)