Skip to content

Commit

Permalink
mm/migration: make isolate_movable_page() return int type
Browse files Browse the repository at this point in the history
Patch series "HWPOISON: soft offlining for non-lru movable page", v6.

After Minchan's commit bda807d ("mm: migrate: support non-lru
movable page migration"), some type of non-lru page like zsmalloc and
virtio-balloon page also support migration.

Therefore, we can:

1) soft offlining no-lru movable pages, which means when memory
   corrected errors occur on a non-lru movable page, we can stop to use
   it by migrating data onto another page and disable the original
   (maybe half-broken) one.

2) enable memory hotplug for non-lru movable pages, i.e. we may offline
   blocks, which include such pages, by using non-lru page migration.

This patchset is heavily dependent on non-lru movable page migration.

This patch (of 4):

Change the return type of isolate_movable_page() from bool to int.  It
will return 0 when isolate movable page successfully, and return -EBUSY
when it isolates failed.

There is no functional change within this patch but prepare for later
patch.

[[email protected]: v6]
  Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yisheng Xie <[email protected]>
Suggested-by: Michal Hocko <[email protected]>
Acked-by: Minchan Kim <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Hanjun Guo <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: Reza Arbab <[email protected]>
Cc: Taku Izumi <[email protected]>
Cc: Vitaly Kuznetsov <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Xishi Qiu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Yisheng Xie authored and torvalds committed Feb 25, 2017
1 parent 5a27aa8 commit 9e5bcd6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/linux/migrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ 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 new, free_page_t free,
unsigned long private, enum migrate_mode mode, int reason);
extern bool isolate_movable_page(struct page *page, isolate_mode_t mode);
extern int isolate_movable_page(struct page *page, isolate_mode_t mode);
extern void putback_movable_page(struct page *page);

extern int migrate_prep(void);
Expand Down
2 changes: 1 addition & 1 deletion mm/compaction.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
locked = false;
}

if (isolate_movable_page(page, isolate_mode))
if (!isolate_movable_page(page, isolate_mode))
goto isolate_success;
}

Expand Down
6 changes: 3 additions & 3 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ int migrate_prep_local(void)
return 0;
}

bool isolate_movable_page(struct page *page, isolate_mode_t mode)
int isolate_movable_page(struct page *page, isolate_mode_t mode)
{
struct address_space *mapping;

Expand Down Expand Up @@ -125,14 +125,14 @@ bool isolate_movable_page(struct page *page, isolate_mode_t mode)
__SetPageIsolated(page);
unlock_page(page);

return true;
return 0;

out_no_isolated:
unlock_page(page);
out_putpage:
put_page(page);
out:
return false;
return -EBUSY;
}

/* It should be called on page which is PG_movable */
Expand Down

0 comments on commit 9e5bcd6

Please sign in to comment.