]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - mm/memory-failure.c
mm: hugetlb: soft-offline: dissolve_free_huge_page() return zero on !PageHuge
[linux.git] / mm / memory-failure.c
index fc8b51744579c8fee5c588ee26164027f05c2a5d..d9cc6606f4097e13175a2dd3eb08523a184e1968 100644 (file)
@@ -1,11 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2008, 2009 Intel Corporation
  * Authors: Andi Kleen, Fengguang Wu
  *
- * This software may be redistributed and/or modified under the terms of
- * the GNU General Public License ("GPL") version 2 only as published by the
- * Free Software Foundation.
- *
  * High level machine check handler. Handles pages reported by the
  * hardware as being corrupted usually due to a multi-bit ECC memory or cache
  * failure.
@@ -1733,6 +1730,8 @@ static int soft_offline_huge_page(struct page *page, int flags)
                if (!ret) {
                        if (set_hwpoison_free_buddy_page(page))
                                num_poisoned_pages_inc();
+                       else
+                               ret = -EBUSY;
                }
        }
        return ret;
@@ -1857,11 +1856,8 @@ static int soft_offline_in_use_page(struct page *page, int flags)
 
 static int soft_offline_free_page(struct page *page)
 {
-       int rc = 0;
-       struct page *head = compound_head(page);
+       int rc = dissolve_free_huge_page(page);
 
-       if (PageHuge(head))
-               rc = dissolve_free_huge_page(page);
        if (!rc) {
                if (set_hwpoison_free_buddy_page(page))
                        num_poisoned_pages_inc();