diff options
author | Minchan Kim <minchan@kernel.org> | 2016-04-28 16:18:44 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-05-04 14:49:10 -0700 |
commit | 1cf34a85e4a8a268a27683387caf0372e0253b99 (patch) | |
tree | d93931f95dec2ee7e28d3edcd9f2d0056571fc35 /mm | |
parent | 93de90e5d049a0f790d0b7f4b29c9d4c50a09e59 (diff) | |
download | lwn-1cf34a85e4a8a268a27683387caf0372e0253b99.tar.gz lwn-1cf34a85e4a8a268a27683387caf0372e0253b99.zip |
mm/hwpoison: fix wrong num_poisoned_pages accounting
commit d7e69488bd04de165667f6bc741c1c0ec6042ab9 upstream.
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
-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 3ad0fea5c438..625741faa068 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -967,7 +967,13 @@ out: dec_zone_page_state(page, NR_ISOLATED_ANON + page_is_file_cache(page)); /* Soft-offlined page shouldn't go through lru cache list */ - if (reason == MR_MEMORY_FAILURE) { + if (reason == MR_MEMORY_FAILURE && rc == MIGRATEPAGE_SUCCESS) { + /* + * With this release, we free successfully migrated + * page and set PG_HWPoison on just freed page + * intentionally. Although it's rather weird, it's how + * HWPoison flag works at the moment. + */ put_page(page); if (!test_set_page_hwpoison(page)) num_poisoned_pages_inc(); |