From patchwork Sun Jun 3 05:23:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10445193 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 613A660234 for ; Sun, 3 Jun 2018 05:33:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 512C427E63 for ; Sun, 3 Jun 2018 05:33:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 461F9289E4; Sun, 3 Jun 2018 05:33:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5D1A27E63 for ; Sun, 3 Jun 2018 05:33:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751091AbeFCFdX (ORCPT ); Sun, 3 Jun 2018 01:33:23 -0400 Received: from mga09.intel.com ([134.134.136.24]:32057 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751048AbeFCFdX (ORCPT ); Sun, 3 Jun 2018 01:33:23 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jun 2018 22:33:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,472,1520924400"; d="scan'208";a="46338081" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga008.jf.intel.com with ESMTP; 02 Jun 2018 22:33:22 -0700 Subject: [PATCH v2 08/11] mm, memory_failure: Pass page size to kill_proc() From: Dan Williams To: linux-nvdimm@lists.01.org Cc: Naoya Horiguchi , hch@lst.de, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, jack@suse.cz Date: Sat, 02 Jun 2018 22:23:26 -0700 Message-ID: <152800340597.17112.168294239903562357.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <152800336321.17112.3300876636370683279.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152800336321.17112.3300876636370683279.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Given that ZONE_DEVICE / dev_pagemap pages are never assembled into compound pages, the size determination logic in kill_proc() needs updating for the dev_pagemap case. In preparation for dev_pagemap support rework memory_failure() and kill_proc() to pass / consume the page size explicitly. Acked-by: Naoya Horiguchi Signed-off-by: Dan Williams --- mm/memory-failure.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 9d142b9b86dc..42a193ee14d3 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -179,18 +179,16 @@ EXPORT_SYMBOL_GPL(hwpoison_filter); * ``action required'' if error happened in current execution context */ static int kill_proc(struct task_struct *t, unsigned long addr, - unsigned long pfn, struct page *page, int flags) + unsigned long pfn, unsigned size_shift, int flags) { - short addr_lsb; int ret; pr_err("Memory failure: %#lx: Killing %s:%d due to hardware memory corruption\n", pfn, t->comm, t->pid); - addr_lsb = compound_order(compound_head(page)) + PAGE_SHIFT; if ((flags & MF_ACTION_REQUIRED) && t->mm == current->mm) { ret = force_sig_mceerr(BUS_MCEERR_AR, (void __user *)addr, - addr_lsb, current); + size_shift, current); } else { /* * Don't use force here, it's convenient if the signal @@ -199,7 +197,7 @@ static int kill_proc(struct task_struct *t, unsigned long addr, * to SIG_IGN, but hopefully no one will do that? */ ret = send_sig_mceerr(BUS_MCEERR_AO, (void __user *)addr, - addr_lsb, t); /* synchronous? */ + size_shift, t); /* synchronous? */ } if (ret < 0) pr_info("Memory failure: Error sending signal to %s:%d: %d\n", @@ -318,7 +316,7 @@ static void add_to_kill(struct task_struct *tsk, struct page *p, * wrong earlier. */ static void kill_procs(struct list_head *to_kill, int forcekill, - bool fail, struct page *page, unsigned long pfn, + bool fail, unsigned size_shift, unsigned long pfn, int flags) { struct to_kill *tk, *next; @@ -343,7 +341,7 @@ static void kill_procs(struct list_head *to_kill, int forcekill, * process anyways. */ else if (kill_proc(tk->tsk, tk->addr, - pfn, page, flags) < 0) + pfn, size_shift, flags) < 0) pr_err("Memory failure: %#lx: Cannot send advisory machine check signal to %s:%d\n", pfn, tk->tsk->comm, tk->tsk->pid); } @@ -928,6 +926,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, struct address_space *mapping; LIST_HEAD(tokill); bool unmap_success; + unsigned size_shift; int kill = 1, forcekill; struct page *hpage = *hpagep; bool mlocked = PageMlocked(hpage); @@ -1012,7 +1011,8 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, * any accesses to the poisoned memory. */ forcekill = PageDirty(hpage) || (flags & MF_MUST_KILL); - kill_procs(&tokill, forcekill, !unmap_success, p, pfn, flags); + size_shift = compound_order(compound_head(p)) + PAGE_SHIFT; + kill_procs(&tokill, forcekill, !unmap_success, size_shift, pfn, flags); return unmap_success; }