From patchwork Mon Jun 4 23:12:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10447479 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 EDA2C603D7 for ; Mon, 4 Jun 2018 23:22:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0A0E29222 for ; Mon, 4 Jun 2018 23:22:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D58F329227; Mon, 4 Jun 2018 23:22:27 +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 77C0B29222 for ; Mon, 4 Jun 2018 23:22:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3224B6B026F; Mon, 4 Jun 2018 19:22:26 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2D0346B0270; Mon, 4 Jun 2018 19:22:26 -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 1E7816B0271; Mon, 4 Jun 2018 19:22:26 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f69.google.com (mail-pg0-f69.google.com [74.125.83.69]) by kanga.kvack.org (Postfix) with ESMTP id D311C6B026F for ; Mon, 4 Jun 2018 19:22:25 -0400 (EDT) Received: by mail-pg0-f69.google.com with SMTP id w1-v6so98825pgr.7 for ; Mon, 04 Jun 2018 16:22:25 -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=ZuQ26JdP1rjgPhN86L0+K1nIfZmxjN68OHROnzWJ8Gg=; b=D/srjCZjIoDSNbK59Mj+uL3WDzbfkJbGIhnC0Z/xFurHK08Zktco6F1Kkq+yihhH3B EHwmw6ycVTXMVUK8Rwx0QOKyIDb+AKWBU6Pa5u3UbWjmH0FkM6gYpZq7IVvTgfDpvX1Z ZLNrvPNw5HzgqCue2j9mJzHb0dHtBW5XQXeCjFG8MSwpchPeK02RCQ1fblLsUG+CZhFp QTXMHkEgQ9upfKARvH5DuhCHFyg+bDcVo55U1lckyCvLJysBiHgbLt2xdQQgzGukY7n9 UXnPsFQKy5QscDdyFIqbF5N0c7uw09vkD3YUf0YCEXxSQTM7Gv9pXV/aTVqiCqz0TUoH Hu7A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.126 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: APt69E0hPfgVDdKyg5w5XQN/zXwNb23KXO7OF+yXWSFeMOB+y9vAjZGA Ptc7Cre8POeZX5nNLWoBdIn4JRxXKbf56+y0JAusbULPmYIkNhdxqBuu6bAyQ4eNLZeL98k+9N7 NFCpjj1iV4fXT//ayyFFGJhSqfT4kl1IzXfHpi4+7cwVHiJ3pmh1SCNkXe2ASRCtCeg== X-Received: by 2002:a62:cf44:: with SMTP id b65-v6mr10469731pfg.80.1528154545531; Mon, 04 Jun 2018 16:22:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIz5Yd/oZtVnAYGHnjjXZCoHf8LcvfZ7T3H0qYhpX/8+y8gapyTfutSh1tn5KHH6k/beC4l X-Received: by 2002:a62:cf44:: with SMTP id b65-v6mr10469674pfg.80.1528154544636; Mon, 04 Jun 2018 16:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528154544; cv=none; d=google.com; s=arc-20160816; b=vKzmirniE9pEGDoPTjx6IQKwzKd62CcJAJqFc6i6+STi67AldRqw2CjYN2D+BAdi2K P1Duup0nnXFLl6orB05hZw0GhZwelLtUu7AKUpDG9mzeAkvf4MaqQOD1WYhgjWjCCQtg hy/GfN87LSfF1XGj/scBUlDbDA6NU8YKXwZ6O8+RQhoxRFRaSFgNXemHxBJyJLGWjpp/ IDJnzyHT9obS8bXKMN2i70/gtgvM42BUYoWAkCvMg09qXyKPDDGElf8Qc6ELa1iife9W amAbt3wBqeejLBkruLLyAPl9LYOQLp/BjtCYYwvk0eWa6ZyQs96w+2fcaT2JgSE8aPtn ncuQ== 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=ZuQ26JdP1rjgPhN86L0+K1nIfZmxjN68OHROnzWJ8Gg=; b=Pv50R3ZTLlD4ZRHs974oLCNV+aFf65oqw+PisR+34WKQjnNYZJNWOC69RGqUgq44Qq fEKdp8XFUQYUqZKqDA8vyvBGWGj/CdwqE7rwmLrAxDTmvADCQbYra2D6C02lnvDxGOBg 9fLa4cXXQLpSUfGKJqHt8T9wK3fVQ+4yvtI8NQwX5HThmNTuUo33hNrLuHK2TD0ls8qL eGCnp5zbM5N9/XFfP8XtKsjiX78SIsDAigdJXBTQErwZM8Z9fpGpTGXDN7rg3K27ZV6K jnLnMQr/zdMLy5Z+f5JMEkEgeajPi1razb+EYqqdrlNwVybqXLTmFZzQuPIoG2QksImY Hc7Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.126 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga18.intel.com (mga18.intel.com. [134.134.136.126]) by mx.google.com with ESMTPS id h3-v6si10069188plt.258.2018.06.04.16.22.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 16:22:24 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.126 as permitted sender) client-ip=134.134.136.126; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.126 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 orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2018 16:22:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,477,1520924400"; d="scan'208";a="205309089" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga004.jf.intel.com with ESMTP; 04 Jun 2018 16:22:24 -0700 Subject: [PATCH v3 09/12] 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: Mon, 04 Jun 2018 16:12:27 -0700 Message-ID: <152815394736.39010.11494385796300796935.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <152815389835.39010.13253559944508110923.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152815389835.39010.13253559944508110923.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. 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; }