Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338771
b: refs/heads/master
c: 78bd520
h: refs/heads/master
i:
  338769: 9472e90
  338767: 4e27648
v: v3
  • Loading branch information
Rafael Aquini authored and Linus Torvalds committed Dec 12, 2012
1 parent b1b71b4 commit b7c1321
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 748ba883ba2818890a73461ef7dde1eed17ad89f
refs/heads/master: 78bd52097d04205a33a8014a1b8ac01cf1ae9d06
4 changes: 2 additions & 2 deletions trunk/fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,11 @@ static int hugetlbfs_migrate_page(struct address_space *mapping,
int rc;

rc = migrate_huge_page_move_mapping(mapping, newpage, page);
if (rc)
if (rc != MIGRATEPAGE_SUCCESS)
return rc;
migrate_page_copy(newpage, page);

return 0;
return MIGRATEPAGE_SUCCESS;
}

static int hugetlbfs_statfs(struct dentry *dentry, struct kstatfs *buf)
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/migrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@

typedef struct page *new_page_t(struct page *, unsigned long private, int **);

/*
* Return values from addresss_space_operations.migratepage():
* - negative errno on page migration failure;
* - zero on page migration success;
*/
#define MIGRATEPAGE_SUCCESS 0

#ifdef CONFIG_MIGRATION

extern void putback_lru_pages(struct list_head *l);
Expand Down
33 changes: 15 additions & 18 deletions trunk/mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,
/* Anonymous page without mapping */
if (page_count(page) != 1)
return -EAGAIN;
return 0;
return MIGRATEPAGE_SUCCESS;
}

spin_lock_irq(&mapping->tree_lock);
Expand Down Expand Up @@ -346,7 +346,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,
}
spin_unlock_irq(&mapping->tree_lock);

return 0;
return MIGRATEPAGE_SUCCESS;
}

/*
Expand All @@ -362,7 +362,7 @@ int migrate_huge_page_move_mapping(struct address_space *mapping,
if (!mapping) {
if (page_count(page) != 1)
return -EAGAIN;
return 0;
return MIGRATEPAGE_SUCCESS;
}

spin_lock_irq(&mapping->tree_lock);
Expand All @@ -389,7 +389,7 @@ int migrate_huge_page_move_mapping(struct address_space *mapping,
page_unfreeze_refs(page, expected_count - 1);

spin_unlock_irq(&mapping->tree_lock);
return 0;
return MIGRATEPAGE_SUCCESS;
}

/*
Expand Down Expand Up @@ -476,11 +476,11 @@ int migrate_page(struct address_space *mapping,

rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode);

if (rc)
if (rc != MIGRATEPAGE_SUCCESS)
return rc;

migrate_page_copy(newpage, page);
return 0;
return MIGRATEPAGE_SUCCESS;
}
EXPORT_SYMBOL(migrate_page);

Expand All @@ -503,7 +503,7 @@ int buffer_migrate_page(struct address_space *mapping,

rc = migrate_page_move_mapping(mapping, newpage, page, head, mode);

if (rc)
if (rc != MIGRATEPAGE_SUCCESS)
return rc;

/*
Expand Down Expand Up @@ -539,7 +539,7 @@ int buffer_migrate_page(struct address_space *mapping,

} while (bh != head);

return 0;
return MIGRATEPAGE_SUCCESS;
}
EXPORT_SYMBOL(buffer_migrate_page);
#endif
Expand Down Expand Up @@ -618,7 +618,7 @@ static int fallback_migrate_page(struct address_space *mapping,
*
* Return value:
* < 0 - error code
* == 0 - success
* MIGRATEPAGE_SUCCESS - success
*/
static int move_to_new_page(struct page *newpage, struct page *page,
int remap_swapcache, enum migrate_mode mode)
Expand Down Expand Up @@ -655,7 +655,7 @@ static int move_to_new_page(struct page *newpage, struct page *page,
else
rc = fallback_migrate_page(mapping, newpage, page, mode);

if (rc) {
if (rc != MIGRATEPAGE_SUCCESS) {
newpage->mapping = NULL;
} else {
if (remap_swapcache)
Expand Down Expand Up @@ -804,7 +804,7 @@ static int __unmap_and_move(struct page *page, struct page *newpage,
put_anon_vma(anon_vma);

uncharge:
mem_cgroup_end_migration(mem, page, newpage, rc == 0);
mem_cgroup_end_migration(mem, page, newpage, rc == MIGRATEPAGE_SUCCESS);
unlock:
unlock_page(page);
out:
Expand Down Expand Up @@ -977,7 +977,7 @@ int migrate_pages(struct list_head *from,
case -EAGAIN:
retry++;
break;
case 0:
case MIGRATEPAGE_SUCCESS:
break;
default:
/* Permanent failure */
Expand All @@ -986,15 +986,12 @@ int migrate_pages(struct list_head *from,
}
}
}
rc = 0;
rc = nr_failed + retry;
out:
if (!swapwrite)
current->flags &= ~PF_SWAPWRITE;

if (rc)
return rc;

return nr_failed + retry;
return rc;
}

int migrate_huge_page(struct page *hpage, new_page_t get_new_page,
Expand All @@ -1014,7 +1011,7 @@ int migrate_huge_page(struct page *hpage, new_page_t get_new_page,
/* try again */
cond_resched();
break;
case 0:
case MIGRATEPAGE_SUCCESS:
goto out;
default:
rc = -EIO;
Expand Down

0 comments on commit b7c1321

Please sign in to comment.