Skip to content

Commit

Permalink
mm: migrate: clean up migrate_prep{_local}
Browse files Browse the repository at this point in the history
The migrate_prep{_local} never fails, so it is pointless to have return
value and check the return value.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Yang Shi <[email protected]>
Reviewed-by: Zi Yan <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Song Liu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
yang-shi authored and torvalds committed Dec 15, 2020
1 parent c77c5cb commit 236c32e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions include/linux/migrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ extern struct page *alloc_migration_target(struct page *page, unsigned long priv
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);
extern int migrate_prep_local(void);
extern void migrate_prep(void);
extern void migrate_prep_local(void);
extern void migrate_page_states(struct page *newpage, struct page *page);
extern void migrate_page_copy(struct page *newpage, struct page *page);
extern int migrate_huge_page_move_mapping(struct address_space *mapping,
Expand Down
8 changes: 2 additions & 6 deletions mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1114,9 +1114,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from,
int err;
nodemask_t tmp;

err = migrate_prep();
if (err)
return err;
migrate_prep();

mmap_read_lock(mm);

Expand Down Expand Up @@ -1315,9 +1313,7 @@ static long do_mbind(unsigned long start, unsigned long len,

if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) {

err = migrate_prep();
if (err)
goto mpol_out;
migrate_prep();
}
{
NODEMASK_SCRATCH(scratch);
Expand Down
8 changes: 2 additions & 6 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
* to be migrated using isolate_lru_page(). If scheduling work on other CPUs is
* undesirable, use migrate_prep_local()
*/
int migrate_prep(void)
void migrate_prep(void)
{
/*
* Clear the LRU lists so pages can be isolated.
Expand All @@ -71,16 +71,12 @@ int migrate_prep(void)
* pages that may be busy.
*/
lru_add_drain_all();

return 0;
}

/* Do the necessary work of migrate_prep but not if it involves other CPUs */
int migrate_prep_local(void)
void migrate_prep_local(void)
{
lru_add_drain();

return 0;
}

int isolate_movable_page(struct page *page, isolate_mode_t mode)
Expand Down

0 comments on commit 236c32e

Please sign in to comment.