From: Guoqing Jiang <guoqing.jiang@xxxxxxxxxxxxxxx> Subject: mm/migrate.c: call detach_page_private to cleanup code We can cleanup code a little by call detach_page_private here. [akpm@xxxxxxxxxxxxxxxxxxxx: use attach_page_private(), per Dave] http://lkml.kernel.org/r/20200521225220.GV2005@xxxxxxxxxxxxxxxxxxx [akpm@xxxxxxxxxxxxxxxxxxxx: clear PagePrivate] Link: http://lkml.kernel.org/r/20200519214049.15179-1-guoqing.jiang@xxxxxxxxxxxxxxx Signed-off-by: Guoqing Jiang <guoqing.jiang@xxxxxxxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Chao Yu <yuchao0@xxxxxxxxxx> Cc: Cong Wang <xiyou.wangcong@xxxxxxxxx> Cc: Dave Chinner <dchinner@xxxxxxxxxx> Cc: Eric Biggers <ebiggers@xxxxxxxxxx> Cc: Gao Xiang <gaoxiang25@xxxxxxxxxx> Cc: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Cc: John Hubbard <jhubbard@xxxxxxxxxx> Cc: Joseph Qi <joseph.qi@xxxxxxxxxxxxxxxxx> Cc: Junxiao Bi <junxiao.bi@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Zi Yan <ziy@xxxxxxxxxx> Cc: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> Cc: Miklos Szeredi <mszeredi@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/migrate.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) --- a/mm/migrate.c~mm-migratec-call-detach_page_private-to-cleanup-code +++ a/mm/migrate.c @@ -797,10 +797,7 @@ recheck_buffers: if (rc != MIGRATEPAGE_SUCCESS) goto unlock_buffers; - ClearPagePrivate(page); - set_page_private(newpage, page_private(page)); - set_page_private(page, 0); - put_page(page); + attach_page_private(newpage, detach_page_private(page)); get_page(newpage); bh = head; @@ -810,8 +807,6 @@ recheck_buffers: } while (bh != head); - SetPagePrivate(newpage); - if (mode != MIGRATE_SYNC_NO_COPY) migrate_page_copy(newpage, page); else _