diff options
author | Minchan Kim <minchan@kernel.org> | 2016-04-28 19:18:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-04-28 22:34:04 -0400 |
commit | d7e69488bd04de165667f6bc741c1c0ec6042ab9 (patch) | |
tree | b0e9a47dee4929026faac9d46ab69e4b2b03d522 | |
parent | b06bad17c7435b600a1d7a35b56eff25e1d3dbc0 (diff) |
mm/hwpoison: fix wrong num_poisoned_pages accounting
Currently, migration code increses num_poisoned_pages on *failed*
migration page as well as successfully migrated one at the trial of
memory-failure. It will make the stat wrong. As well, it marks the
page as PG_HWPoison even if the migration trial failed. It would mean
we cannot recover the corrupted page using memory-failure facility.
This patches fixes it.
Signed-off-by: Minchan Kim <minchan@kernel.org>
Reported-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/migrate.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mm/migrate.c b/mm/migrate.c index 6c822a7b27e0..f9dfb18a4eba 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -975,7 +975,13 @@ out: | |||
975 | dec_zone_page_state(page, NR_ISOLATED_ANON + | 975 | dec_zone_page_state(page, NR_ISOLATED_ANON + |
976 | page_is_file_cache(page)); | 976 | page_is_file_cache(page)); |
977 | /* Soft-offlined page shouldn't go through lru cache list */ | 977 | /* Soft-offlined page shouldn't go through lru cache list */ |
978 | if (reason == MR_MEMORY_FAILURE) { | 978 | if (reason == MR_MEMORY_FAILURE && rc == MIGRATEPAGE_SUCCESS) { |
979 | /* | ||
980 | * With this release, we free successfully migrated | ||
981 | * page and set PG_HWPoison on just freed page | ||
982 | * intentionally. Although it's rather weird, it's how | ||
983 | * HWPoison flag works at the moment. | ||
984 | */ | ||
979 | put_page(page); | 985 | put_page(page); |
980 | if (!test_set_page_hwpoison(page)) | 986 | if (!test_set_page_hwpoison(page)) |
981 | num_poisoned_pages_inc(); | 987 | num_poisoned_pages_inc(); |