From patchwork Fri Jun 8 23:51:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10455379 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 C14E460234 for ; Sat, 9 Jun 2018 00:01:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD6BF294FA for ; Sat, 9 Jun 2018 00:01:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1DBF29438; Sat, 9 Jun 2018 00:01:10 +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 4CA3129438 for ; Sat, 9 Jun 2018 00:01:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A6D2A6B0271; Fri, 8 Jun 2018 20:01:08 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9F30F6B0272; Fri, 8 Jun 2018 20:01:08 -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 894E06B0273; Fri, 8 Jun 2018 20:01:08 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id 417AD6B0271 for ; Fri, 8 Jun 2018 20:01:08 -0400 (EDT) Received: by mail-pf0-f200.google.com with SMTP id p29-v6so6977622pfi.19 for ; Fri, 08 Jun 2018 17:01:08 -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=AGn4HNQ2kOzfAAYJJD9LpdCdvYwRjuqSoFFWU4OnjH6+VlYR4KsIRE3WzHqKMyHcBc dIdAx1nlSPUIREmaEB7fG9yTCZBPT/QcN8krlfJ+/uwSmgYkkBYf9T4hm5Ypkp1XT+pM lAOR1zvlG7pEPSJDBQvzvWmRf9vCHFzxTOiV1Fx9QGkIffvoT1QCQ0tA0+c06fJXIBW6 KuDlueW3GJCF1/QVr4x1SgFWrgTyVY85aSj0wG1ZbhBckzSTazYCA7xo8sKyRFe3KjhR AeG0reMoxiMU63hFjRReJCFu6D0rRpTfIAvILp5eagddzGAUGatC3KUp02zpbHXzCRZc S8gA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.115 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: APt69E1s5QGpc9Nygg+yX7xOKqPuc8ikGIDNjOAZHQ0fLsJomsSbsa1d MOsfImhShpMR8nqwIzgbb1uvrQVMpwp0Z1yA1KuRbTFB3a8k4RqseVMy0VHwvhip1AGlPudFAE5 NJxv69qdATuyP73VuLKvpHtAHag03qRAGw9ZRwNW49PP5fxegv4TuysiJbZfmYOi+wA== X-Received: by 2002:a17:902:aa95:: with SMTP id d21-v6mr8498651plr.73.1528502467956; Fri, 08 Jun 2018 17:01:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKK9FtC8H2XNete7QedUNITr7jEBlk9Atn4Mb5uKISwhaEBmPh7dgyWE2FYkMHEJ+/iojjs X-Received: by 2002:a17:902:aa95:: with SMTP id d21-v6mr8498571plr.73.1528502466789; Fri, 08 Jun 2018 17:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528502466; cv=none; d=google.com; s=arc-20160816; b=yOkl1FmB6RGNEI29br5x+5I0Z5DZqFl99O4nGkroXfUf2tYa17bYLDiz48zE0yqrrB 27HklJjVvZWQJCdFPyUWvk3j3WPfQjz7a0nNoGcMPosljOIbTZehXoYJCVThds0n1scX cm3YObe97NmNk1K9oKI2hsi5rc6teOK8LdAL699PKORH8G7PRy6KodoTbmgXAVi6wncG LykFPDWy5VyA8XAy0ExRkyVzxN8K9r2Hd15R6bg0NV20oDZRHn4rL1rZm3TNtHndCtqE QewI6HFmObSC1b6Wgkeucwd/h2JOAd70tBCwuNtzgfG6fPXqQOmEFV9DKB//c1GKzeUt HUVw== 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=DvnxRVI1Mkn7r/6JmZGXUooN+oBEPHEv9NXXiJr1EwZURcqsjZawx9+d8WFSxl2apd BK8W5xPJ0ltaV/QvrTOICLAx3FkhKN7fitqan7+HRvhRpLeCWXw/P5WpycNEJiSG8puG b+bkqtyfH0hMm+6rI4RyaxBbS1eNw9BvN8QojvRJE5ZsKDuFQH+0+jb5DipnrXjFfiSI W8BLqBKH/pV6EkzZsh/VQQ7lFk6yiurq5ToYAElFPDp5y2kvbytz7pd0dNPSXpBdhETb GH3YbdrvmK9/vAniq71c0ZMsGCTA64L8RXFb4jVxmCAgkRLWwkQul+Ikho2qFcPf15w2 rW/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.115 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga14.intel.com (mga14.intel.com. [192.55.52.115]) by mx.google.com with ESMTPS id y125-v6si33385152pfb.284.2018.06.08.17.01.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jun 2018 17:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.115 as permitted sender) client-ip=192.55.52.115; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.115 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 fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jun 2018 17:01:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,492,1520924400"; d="scan'208";a="235663461" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga005.fm.intel.com with ESMTP; 08 Jun 2018 17:01:06 -0700 Subject: [PATCH v4 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: Fri, 08 Jun 2018 16:51:08 -0700 Message-ID: <152850186890.38390.5754581007005072615.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <152850182079.38390.8280340535691965744.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152850182079.38390.8280340535691965744.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; }