diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-03-16 23:03:59 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-17 07:51:25 -0800 |
commit | 90036ee5938d89638e80f4d0d0700d0f2dbd4a6a (patch) | |
tree | de0f9275dcf8a051baf70df8574ce34b8b1f158d /mm/mempolicy.c | |
parent | e0e8eb54d8ae0c4cfd1d297f6351b08a7f635c5f (diff) | |
download | lwn-90036ee5938d89638e80f4d0d0700d0f2dbd4a6a.tar.gz lwn-90036ee5938d89638e80f4d0d0700d0f2dbd4a6a.zip |
[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>
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, int err; struct vm_area_struct *first, *vma, *prev; - /* Clear the LRU lists so pages can be isolated */ - if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) + if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) { + /* Must have swap device for migration */ + if (nr_swap_pages <= 0) + return ERR_PTR(-ENODEV); + + /* + * Clear the LRU lists so pages can be isolated. + * Note that pages may be moved off the LRU after we have + * drained them. Those pages will fail to migrate like other + * pages that may be busy. + */ lru_add_drain_all(); + } first = find_vma(mm, start); if (!first) |