aboutsummaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r--mm/swapfile.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 47a6812f5f8c..e3b1362372c2 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -395,6 +395,9 @@ void free_swap_and_cache(swp_entry_t entry)
395 struct swap_info_struct * p; 395 struct swap_info_struct * p;
396 struct page *page = NULL; 396 struct page *page = NULL;
397 397
398 if (is_migration_entry(entry))
399 return;
400
398 p = swap_info_get(entry); 401 p = swap_info_get(entry);
399 if (p) { 402 if (p) {
400 if (swap_entry_free(p, swp_offset(entry)) == 1) { 403 if (swap_entry_free(p, swp_offset(entry)) == 1) {
@@ -1400,19 +1403,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
1400 if (!(p->flags & SWP_USED)) 1403 if (!(p->flags & SWP_USED))
1401 break; 1404 break;
1402 error = -EPERM; 1405 error = -EPERM;
1403 /* 1406 if (type >= MAX_SWAPFILES) {
1404 * Test if adding another swap device is possible. There are
1405 * two limiting factors: 1) the number of bits for the swap
1406 * type swp_entry_t definition and 2) the number of bits for
1407 * the swap type in the swap ptes as defined by the different
1408 * architectures. To honor both limitations a swap entry
1409 * with swap offset 0 and swap type ~0UL is created, encoded
1410 * to a swap pte, decoded to a swp_entry_t again and finally
1411 * the swap type part is extracted. This will mask all bits
1412 * from the initial ~0UL that can't be encoded in either the
1413 * swp_entry_t or the architecture definition of a swap pte.
1414 */
1415 if (type > swp_type(pte_to_swp_entry(swp_entry_to_pte(swp_entry(~0UL,0))))) {
1416 spin_unlock(&swap_lock); 1407 spin_unlock(&swap_lock);
1417 goto out; 1408 goto out;
1418 } 1409 }
@@ -1702,6 +1693,9 @@ int swap_duplicate(swp_entry_t entry)
1702 unsigned long offset, type; 1693 unsigned long offset, type;
1703 int result = 0; 1694 int result = 0;
1704 1695
1696 if (is_migration_entry(entry))
1697 return 1;
1698
1705 type = swp_type(entry); 1699 type = swp_type(entry);
1706 if (type >= nr_swapfiles) 1700 if (type >= nr_swapfiles)
1707 goto bad_file; 1701 goto bad_file;