The patch titled
     Subject: mm: soft-offline: fix num_poisoned_pages counting on concurrent 
events
has been added to the -mm tree.  Its filename is
     mm-soft-offline-fix-num_poisoned_pages-counting-on-concurrent-events.patch

This patch should soon appear at
    
http://ozlabs.org/~akpm/mmots/broken-out/mm-soft-offline-fix-num_poisoned_pages-counting-on-concurrent-events.patch
and later at
    
http://ozlabs.org/~akpm/mmotm/broken-out/mm-soft-offline-fix-num_poisoned_pages-counting-on-concurrent-events.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Naoya Horiguchi <[email protected]>
Subject: mm: soft-offline: fix num_poisoned_pages counting on concurrent events

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 <[email protected]>
Cc: Dean Nelson <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: <[email protected]>    [3.14+]
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/memory-failure.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff -puN 
mm/memory-failure.c~mm-soft-offline-fix-num_poisoned_pages-counting-on-concurrent-events
 mm/memory-failure.c
--- 
a/mm/memory-failure.c~mm-soft-offline-fix-num_poisoned_pages-counting-on-concurrent-events
+++ a/mm/memory-failure.c
@@ -1777,12 +1777,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 -mm which might be from [email protected] are

origin.patch
mm-memory-failure-call-shake_page-when-error-hits-thp-tail-page.patch
mm-soft-offline-fix-num_poisoned_pages-counting-on-concurrent-events.patch
mm-hwpoison-add-comment-describing-when-to-add-new-cases.patch
page-flags-trivial-cleanup-for-pagetrans-helpers.patch
page-flags-introduce-page-flags-policies-wrt-compound-pages.patch
page-flags-define-pg_locked-behavior-on-compound-pages.patch
page-flags-define-behavior-of-fs-io-related-flags-on-compound-pages.patch
page-flags-define-behavior-of-lru-related-flags-on-compound-pages.patch
page-flags-define-behavior-slb-related-flags-on-compound-pages.patch
page-flags-define-behavior-of-xen-related-flags-on-compound-pages.patch
page-flags-define-pg_reserved-behavior-on-compound-pages.patch
page-flags-define-pg_swapbacked-behavior-on-compound-pages.patch
page-flags-define-pg_swapcache-behavior-on-compound-pages.patch
page-flags-define-pg_mlocked-behavior-on-compound-pages.patch
page-flags-define-pg_uncached-behavior-on-compound-pages.patch
page-flags-define-pg_uptodate-behavior-on-compound-pages.patch
page-flags-look-on-head-page-if-the-flag-is-encoded-in-page-mapping.patch
mm-sanitize-page-mapping-for-tail-pages.patch
do_shared_fault-check-that-mmap_sem-is-held.patch

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to