Merge tag 'backlight-next-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/lee...
[linux-2.6-microblaze.git] / mm / memory-failure.c
index fc8b517..7ef849d 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.
@@ -216,12 +213,12 @@ static int kill_proc(struct to_kill *tk, unsigned long pfn, int flags)
        short addr_lsb = tk->size_shift;
        int ret;
 
-       pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n",
+       pr_err("Memory failure: %#lx: Sending SIGBUS to %s:%d due to hardware memory corruption\n",
                pfn, t->comm, t->pid);
 
        if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) {
                ret = force_sig_mceerr(BUS_MCEERR_AR, (void __user *)tk->addr,
-                                      addr_lsb, current);
+                                      addr_lsb);
        } else {
                /*
                 * Don't use force here, it's convenient if the signal
@@ -1180,16 +1177,12 @@ static int memory_failure_dev_pagemap(unsigned long pfn, int flags,
                goto unlock;
        }
 
-       switch (pgmap->type) {
-       case MEMORY_DEVICE_PRIVATE:
-       case MEMORY_DEVICE_PUBLIC:
+       if (pgmap->type == MEMORY_DEVICE_PRIVATE) {
                /*
                 * TODO: Handle HMM pages which may need coordination
                 * with device-side memory.
                 */
                goto unlock;
-       default:
-               break;
        }
 
        /*
@@ -1733,6 +1726,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 +1852,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();