From patchwork Tue May 22 14:40:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10418797 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 C5D4560224 for ; Tue, 22 May 2018 14:50:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA45C28EB1 for ; Tue, 22 May 2018 14:50:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A748229004; Tue, 22 May 2018 14:50:43 +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=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E54328EB1 for ; Tue, 22 May 2018 14:50:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D74B6B0010; Tue, 22 May 2018 10:50:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6866C6B0266; Tue, 22 May 2018 10:50:18 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59DF06B0269; Tue, 22 May 2018 10:50:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f71.google.com (mail-pg0-f71.google.com [74.125.83.71]) by kanga.kvack.org (Postfix) with ESMTP id 15CE86B0010 for ; Tue, 22 May 2018 10:50:18 -0400 (EDT) Received: by mail-pg0-f71.google.com with SMTP id f5-v6so5578030pgq.19 for ; Tue, 22 May 2018 07:50:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=NdzFGYTpPhQZOTQh4sbjjUc1fyF1VVoMf1iGFI8Cbo4=; b=IgXkeQFgmY2NhSKTfwwZmjDAdSZChZIOHmIFtVJJbcG0CR1f0XC8wIl5vyJHjetnKM WgpHWF45q86fbK2EU/bl3VEh/2Au38SqA6S5ePYhXyjh9s0qgldSYrEbGuTXYl9X5iwG cAbxoRy8fxnaf6O3RHdIiuzMftCaucvvhbQlKBNkfZsdkNegJPdtbyr8rfkjZpg0UDJb wnItpZTtQ/ZqQTWllEcAViaZyXcdxfa/WH3x6VtXY2z0hAOl20Iv4JJOAlXCN5txM44o PeK6Cc4l6/7D9baUJx7V57fy2dmueia94aySEoQQJPm3t+MhEjWrsmh1vdxavKXiuLKz H3WA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: ALKqPwfP1m2VXJLkcou+du/I1mlwfaePSnBNXtx2TE2kk5xHcByt700+ QD5Hi73O/iARwSKADCYuBAz2kVrYZigjqVBtW0Bq+mP6WxcFOUts6dxpleZid77OsZRUYLvhL4j x8+wa2o+Fpqy6P3lPFvSGxWdyRs682dNDJM2RDRVQaT5wrmw34Zr7XoqX5uob6B4j+g== X-Received: by 2002:a62:ec18:: with SMTP id k24-v6mr24676828pfh.204.1527000617763; Tue, 22 May 2018 07:50:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoKx0CaUsQOdInL2U7GdCQSyuSHjQxCNyJd5aoUmRD8JR1KedkA5DBTT2KFujNO0Kyme5ca X-Received: by 2002:a62:ec18:: with SMTP id k24-v6mr24676780pfh.204.1527000616915; Tue, 22 May 2018 07:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527000616; cv=none; d=google.com; s=arc-20160816; b=pJAUy28YN2PvObeAZDmXh/eEY0ZPpdJ0ypcgLOC1hfQcHQ1qA8uuIlpbmX+3+AmW7R QJYyZo50HM/cdfj7uZOdXjfcfzr/+rJM3lfWg+wWy4FMjAsh7BLz2upRPChCyJXd7Dy2 DzQAOPANGgVptP4CfiZgSyyBkXJy45H3lnWp1SiU5bFUr+osBuGCP2OdTW1mHVwZvHsk Ft7Y8tA+zo+rfPNyeoik5PsReZBGLDjAmVw3JYamsqJypHHNmJaOQnn427EOhYhPEPT4 eWCvcELBuL7IPA+KySUcAkin+IMJ4+V/mLnsdvsQWeCxrZhcsBQpcchWXQgaI1lkAJuH OukQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject :arc-authentication-results; bh=NdzFGYTpPhQZOTQh4sbjjUc1fyF1VVoMf1iGFI8Cbo4=; b=jRPiIKQOYFsO0yPdl7fip8bApu7nLIJaUhqdYgxhbjNnzG2g943VL7bJV9tjiNDHFC LOIMGb66jkmMdvF/Rx4BvAWjk+P+ubiTSR/HmzvFI99Ed3uUYERs7djNIqXVtoR+kJB5 3bdNw40VEAk9H+phjCjZ+3qGO+ity3BfE3SB3ynfz7A8JaJZ3YyDCWk2DhBhfJb0zVjc Bux4nq5wF5/ZU/q23fiIYbJxmGBn9RHOW0T8yrXFC/9baRJBHEAKT5CuytqZEz53N5yi ueGvU0zspvq3uEDZVdMeQ+jwNphv7vhtKCa64Bkz8EW1ELSajOljCMBGh9BCkxUGLKhl 1tdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga11.intel.com (mga11.intel.com. [192.55.52.93]) by mx.google.com with ESMTPS id m4-v6si12914782pgp.336.2018.05.22.07.50.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:50:16 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.93 as permitted sender) client-ip=192.55.52.93; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2018 07:50:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,430,1520924400"; d="scan'208";a="43310129" 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; 22 May 2018 07:50:16 -0700 Subject: [PATCH 09/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, tony.luck@intel.com Date: Tue, 22 May 2018 07:40:19 -0700 Message-ID: <152700001949.24093.5303974728568066054.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <152699997165.24093.12194490924829406111.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152699997165.24093.12194490924829406111.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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. Cc: Naoya Horiguchi Signed-off-by: Dan Williams Acked-by: Naoya Horiguchi --- 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; }