Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 338776
b: refs/heads/master
c: 5733c7d
h: refs/heads/master
v: v3
  • Loading branch information
Rafael Aquini authored and Linus Torvalds committed Dec 12, 2012
1 parent c502693 commit 9e82bd0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 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: e22504296d4f64fbbbd741602ab47ee874649c18
refs/heads/master: 5733c7d11dff44e98d2ca16617886a78086b354f
2 changes: 2 additions & 0 deletions trunk/include/linux/migrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **);
#ifdef CONFIG_MIGRATION

extern void putback_lru_pages(struct list_head *l);
extern void putback_movable_pages(struct list_head *l);
extern int migrate_page(struct address_space *,
struct page *, struct page *, enum migrate_mode);
extern int migrate_pages(struct list_head *l, new_page_t x,
Expand All @@ -50,6 +51,7 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
#else

static inline void putback_lru_pages(struct list_head *l) {}
static inline void putback_movable_pages(struct list_head *l) {}
static inline int migrate_pages(struct list_head *l, new_page_t x,
unsigned long private, bool offlining,
enum migrate_mode mode) { return -ENOSYS; }
Expand Down
6 changes: 3 additions & 3 deletions trunk/mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
switch (isolate_migratepages(zone, cc)) {
case ISOLATE_ABORT:
ret = COMPACT_PARTIAL;
putback_lru_pages(&cc->migratepages);
putback_movable_pages(&cc->migratepages);
cc->nr_migratepages = 0;
goto out;
case ISOLATE_NONE:
Expand All @@ -1026,9 +1026,9 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
trace_mm_compaction_migratepages(nr_migrate - nr_remaining,
nr_remaining);

/* Release LRU pages not migrated */
/* Release isolated pages not migrated */
if (err) {
putback_lru_pages(&cc->migratepages);
putback_movable_pages(&cc->migratepages);
cc->nr_migratepages = 0;
if (err == -ENOMEM) {
ret = COMPACT_PARTIAL;
Expand Down
20 changes: 20 additions & 0 deletions trunk/mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,26 @@ void putback_lru_pages(struct list_head *l)
struct page *page;
struct page *page2;

list_for_each_entry_safe(page, page2, l, lru) {
list_del(&page->lru);
dec_zone_page_state(page, NR_ISOLATED_ANON +
page_is_file_cache(page));
putback_lru_page(page);
}
}

/*
* Put previously isolated pages back onto the appropriate lists
* from where they were once taken off for compaction/migration.
*
* This function shall be used instead of putback_lru_pages(),
* whenever the isolated pageset has been built by isolate_migratepages_range()
*/
void putback_movable_pages(struct list_head *l)
{
struct page *page;
struct page *page2;

list_for_each_entry_safe(page, page2, l, lru) {
list_del(&page->lru);
dec_zone_page_state(page, NR_ISOLATED_ANON +
Expand Down
2 changes: 1 addition & 1 deletion trunk/mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5761,7 +5761,7 @@ static int __alloc_contig_migrate_range(struct compact_control *cc,
0, false, MIGRATE_SYNC);
}

putback_lru_pages(&cc->migratepages);
putback_movable_pages(&cc->migratepages);
return ret > 0 ? 0 : ret;
}

Expand Down

0 comments on commit 9e82bd0

Please sign in to comment.