From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932217AbcDDJHf (ORCPT ); Mon, 4 Apr 2016 05:07:35 -0400 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:46389 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754176AbcDDJHc (ORCPT ); Mon, 4 Apr 2016 05:07:32 -0400 X-Original-SENDERIP: 156.147.1.126 X-Original-MAILFROM: minchan@kernel.org X-Original-SENDERIP: 10.177.223.161 X-Original-MAILFROM: minchan@kernel.org Date: Mon, 4 Apr 2016 18:07:38 +0900 From: Minchan Kim To: Andrew Morton Cc: linux-kernel@vger.kernel.org, Vlastimil Babka , linux-mm@kvack.org, stable@vger.kernel.org, Naoya Horiguchi Subject: Re: [PATCH] mm/hwpoison: fix wrong num_poisoned_pages account Message-ID: <20160404090738.GB12898@bbox> References: <1459749992-7861-1-git-send-email-minchan@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1459749992-7861-1-git-send-email-minchan@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 04, 2016 at 03:06:32PM +0900, Minchan Kim wrote: > Currently, migration code increases 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 page as PG_HWPoison even if the migration trial > failed. It would make we cannot recover the corrupted page using > memory-failure facility. > > This patches fixes it. > > Cc: stable@vger.kernel.org > Reported-by: Vlastimil Babka > Acked-by: Naoya Horiguchi > Signed-off-by: Minchan Kim Hello Andrew, This patch will make conflict with current mmotm which has my non-lru page migration work. It's okay to drop my non-lru page migration work to apply this bug fix patch in current mmotm because I will try to support userspace mapped drvier non-lru page Vlastimil pointed out in that thread. Thanks. > --- > mm/migrate.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > 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 @@ static ICE_noinline int unmap_and_move(new_page_t get_new_page, > 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(); > -- > 1.9.1 >