linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dean Nelson <dnelson@redhat.com>
To: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andi Kleen <andi@firstfloor.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: soft-offline: fix num_poisoned_pages counting on concurrent events
Date: Thu, 23 Apr 2015 19:42:49 -0500	[thread overview]
Message-ID: <55399189.5030608@redhat.com> (raw)
In-Reply-To: <1429589902-2765-1-git-send-email-n-horiguchi@ah.jp.nec.com>

On 04/20/2015 11:18 PM, Naoya Horiguchi wrote:
> If multiple soft offline events hit one free page/hugepage concurrently,
> soft_offline_page() can handle the free page/hugepage multiple times,
> which makes num_poisoned_pages counter increased more than once.
> This patch fixes this wrong counting by checking TestSetPageHWPoison for
> normal papes and by checking the return value of dequeue_hwpoisoned_huge_page()
> for hugepages.
> 
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Acked-by: Dean Nelson <dnelson@redhat.com>


> Cc: stable@vger.kernel.org  # v3.14+
> ---
> # This problem might happen before 3.14, but it's rare and non-critical,
> # so I want this patch to be backported to stable trees only if the patch
> # cleanly applies (i.e. v3.14+).
> ---
>   mm/memory-failure.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git v4.0.orig/mm/memory-failure.c v4.0/mm/memory-failure.c
> index 2cc1d578144b..72a5224c8084 100644
> --- v4.0.orig/mm/memory-failure.c
> +++ v4.0/mm/memory-failure.c
> @@ -1721,12 +1721,12 @@ int soft_offline_page(struct page *page, int flags)
>   	} else if (ret == 0) { /* for free pages */
>   		if (PageHuge(page)) {
>   			set_page_hwpoison_huge_page(hpage);
> -			dequeue_hwpoisoned_huge_page(hpage);
> -			atomic_long_add(1 << compound_order(hpage),
> +			if (!dequeue_hwpoisoned_huge_page(hpage))
> +				atomic_long_add(1 << compound_order(hpage),
>   					&num_poisoned_pages);
>   		} else {
> -			SetPageHWPoison(page);
> -			atomic_long_inc(&num_poisoned_pages);
> +			if (!TestSetPageHWPoison(page))
> +				atomic_long_inc(&num_poisoned_pages);
>   		}
>   	}
>   	unset_migratetype_isolate(page, MIGRATE_MOVABLE);
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2015-04-24  0:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-21  4:18 [PATCH] mm: soft-offline: fix num_poisoned_pages counting on concurrent events Naoya Horiguchi
2015-04-24  0:42 ` Dean Nelson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55399189.5030608@redhat.com \
    --to=dnelson@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=n-horiguchi@ah.jp.nec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).