From patchwork Tue Mar 22 21:44:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12789195 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1CC4C433EF for ; Tue, 22 Mar 2022 21:44:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FC496B0102; Tue, 22 Mar 2022 17:44:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7A8A86B0103; Tue, 22 Mar 2022 17:44:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 670456B0104; Tue, 22 Mar 2022 17:44:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id 57B4C6B0102 for ; Tue, 22 Mar 2022 17:44:16 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 15F98121702 for ; Tue, 22 Mar 2022 21:44:16 +0000 (UTC) X-FDA: 79273350912.14.F71F6D5 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf15.hostedemail.com (Postfix) with ESMTP id 9D519A002D for ; Tue, 22 Mar 2022 21:44:15 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 86CE7B81DAF; Tue, 22 Mar 2022 21:44:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D944C340EC; Tue, 22 Mar 2022 21:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1647985453; bh=sq91+5Li+9XYqSTLeVxMzaSRvaiLl3o2S1cnLE6YEvY=; h=Date:To:From:In-Reply-To:Subject:From; b=yzYU1uJHEeHkSqKsXHaM994oYK3rj3OYSg9+9WrhT8mKGrY2vL9W1F+evskHFhuWB 6s3/hPT5vEfwMQHZq8XoMLMRE56nkaTtbZJqU7njxTlInLtuIkaCdhyhCpNIRjTVmZ 6KmU600+DSh0G/aSuXtMopDNPEQifhsiJ0mYzVM0= Date: Tue, 22 Mar 2022 14:44:12 -0700 To: naoya.horiguchi@nec.com,linmiaohe@huawei.com,akpm@linux-foundation.org,patches@lists.linux.dev,linux-mm@kvack.org,mm-commits@vger.kernel.org,torvalds@linux-foundation.org,akpm@linux-foundation.org From: Andrew Morton In-Reply-To: <20220322143803.04a5e59a07e48284f196a2f9@linux-foundation.org> Subject: [patch 112/227] mm/memory-failure.c: minor clean up for memory_failure_dev_pagemap Message-Id: <20220322214413.3D944C340EC@smtp.kernel.org> X-Rspam-User: X-Stat-Signature: twpd3dhypzncyntx9g9b3nppgj4b77ok Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=yzYU1uJH; spf=pass (imf15.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 9D519A002D X-HE-Tag: 1647985455-18679 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: From: Miaohe Lin Subject: mm/memory-failure.c: minor clean up for memory_failure_dev_pagemap Patch series "A few cleanup and fixup patches for memory failure", v3. This series contains a few patches to simplify the code logic, remove unneeded variable and remove obsolete comment. Also we fix race changing page more robustly in memory_failure. More details can be found in the respective changelogs. This patch (of 8): The flags always has MF_ACTION_REQUIRED and MF_MUST_KILL set. So we do not need to check these flags again. Link: https://lkml.kernel.org/r/20220218090118.1105-1-linmiaohe@huawei.com Link: https://lkml.kernel.org/r/20220218090118.1105-2-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Acked-by: Naoya Horiguchi Signed-off-by: Andrew Morton --- mm/memory-failure.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/memory-failure.c~mm-memory-failurec-minor-clean-up-for-memory_failure_dev_pagemap +++ a/mm/memory-failure.c @@ -1640,7 +1640,7 @@ static int memory_failure_dev_pagemap(un * SIGBUS (i.e. MF_MUST_KILL) */ flags |= MF_ACTION_REQUIRED | MF_MUST_KILL; - collect_procs(page, &tokill, flags & MF_ACTION_REQUIRED); + collect_procs(page, &tokill, true); list_for_each_entry(tk, &tokill, nd) if (tk->size_shift) @@ -1655,7 +1655,7 @@ static int memory_failure_dev_pagemap(un start = (page->index << PAGE_SHIFT) & ~(size - 1); unmap_mapping_range(page->mapping, start, size, 0); } - kill_procs(&tokill, flags & MF_MUST_KILL, false, pfn, flags); + kill_procs(&tokill, true, false, pfn, flags); rc = 0; unlock: dax_unlock_page(page, cookie);