Skip to content

Commit 9e5bcd6

Browse files
Yisheng Xietorvalds
authored andcommitted
mm/migration: make isolate_movable_page() return int type
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]>
1 parent 5a27aa8 commit 9e5bcd6

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

include/linux/migrate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ extern int migrate_page(struct address_space *,
3737
struct page *, struct page *, enum migrate_mode);
3838
extern int migrate_pages(struct list_head *l, new_page_t new, free_page_t free,
3939
unsigned long private, enum migrate_mode mode, int reason);
40-
extern bool isolate_movable_page(struct page *page, isolate_mode_t mode);
40+
extern int isolate_movable_page(struct page *page, isolate_mode_t mode);
4141
extern void putback_movable_page(struct page *page);
4242

4343
extern int migrate_prep(void);

mm/compaction.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
802802
locked = false;
803803
}
804804

805-
if (isolate_movable_page(page, isolate_mode))
805+
if (!isolate_movable_page(page, isolate_mode))
806806
goto isolate_success;
807807
}
808808

mm/migrate.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int migrate_prep_local(void)
7474
return 0;
7575
}
7676

77-
bool isolate_movable_page(struct page *page, isolate_mode_t mode)
77+
int isolate_movable_page(struct page *page, isolate_mode_t mode)
7878
{
7979
struct address_space *mapping;
8080

@@ -125,14 +125,14 @@ bool isolate_movable_page(struct page *page, isolate_mode_t mode)
125125
__SetPageIsolated(page);
126126
unlock_page(page);
127127

128-
return true;
128+
return 0;
129129

130130
out_no_isolated:
131131
unlock_page(page);
132132
out_putpage:
133133
put_page(page);
134134
out:
135-
return false;
135+
return -EBUSY;
136136
}
137137

138138
/* It should be called on page which is PG_movable */

0 commit comments

Comments
 (0)