Commit 6aeff241 authored by Yang Shi's avatar Yang Shi Committed by Linus Torvalds

mm/migrate.c: migrate PG_readahead flag

Currently the migration code doesn't migrate PG_readahead flag.
Theoretically this would incur slight performance loss as the application
might have to ramp its readahead back up again.  Even though such problem
happens, it might be hidden by something else since migration is typically
triggered by compaction and NUMA balancing, any of which should be more
noticeable.

Migrate the flag after end_page_writeback() since it may clear PG_reclaim
flag, which is the same bit as PG_readahead, for the new page.

[akpm@linux-foundation.org: tweak comment]
Signed-off-by: default avatarYang Shi <yang.shi@linux.alibaba.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Link: http://lkml.kernel.org/r/1581640185-95731-1-git-send-email-yang.shi@linux.alibaba.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent d08221a0
...@@ -647,6 +647,14 @@ void migrate_page_states(struct page *newpage, struct page *page) ...@@ -647,6 +647,14 @@ void migrate_page_states(struct page *newpage, struct page *page)
if (PageWriteback(newpage)) if (PageWriteback(newpage))
end_page_writeback(newpage); end_page_writeback(newpage);
/*
* PG_readahead shares the same bit with PG_reclaim. The above
* end_page_writeback() may clear PG_readahead mistakenly, so set the
* bit after that.
*/
if (PageReadahead(page))
SetPageReadahead(newpage);
copy_page_owner(page, newpage); copy_page_owner(page, newpage);
mem_cgroup_migrate(page, newpage); mem_cgroup_migrate(page, newpage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment