From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:53935 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422936AbbEOCEb (ORCPT ); Thu, 14 May 2015 22:04:31 -0400 Subject: Patch "mm: soft-offline: fix num_poisoned_pages counting on concurrent events" has been added to the 4.0-stable tree To: n-horiguchi@ah.jp.nec.com, akpm@linux-foundation.org, andi@firstfloor.org, dnelson@redhat.com, gregkh@linuxfoundation.org, torvalds@linux-foundation.org Cc: , From: Date: Thu, 14 May 2015 19:04:30 -0700 Message-ID: <143165547018462@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled mm: soft-offline: fix num_poisoned_pages counting on concurrent events to the 4.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mm-soft-offline-fix-num_poisoned_pages-counting-on-concurrent-events.patch and it can be found in the queue-4.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From 602498f9aa43d4951eece3fd6ad95a6d0a78d537 Mon Sep 17 00:00:00 2001 From: Naoya Horiguchi Date: Tue, 5 May 2015 16:23:46 -0700 Subject: mm: soft-offline: fix num_poisoned_pages counting on concurrent events From: Naoya Horiguchi commit 602498f9aa43d4951eece3fd6ad95a6d0a78d537 upstream. 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 Acked-by: Dean Nelson Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/memory-failure.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1721,12 +1721,12 @@ int soft_offline_page(struct page *page, } 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); Patches currently in stable-queue which might be from n-horiguchi@ah.jp.nec.com are queue-4.0/mm-soft-offline-fix-num_poisoned_pages-counting-on-concurrent-events.patch queue-4.0/mm-memory-failure-call-shake_page-when-error-hits-thp-tail-page.patch