From patchwork Tue Aug 30 12:36:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12959264 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 C1787ECAAA1 for ; Tue, 30 Aug 2022 12:36:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 384566B0073; Tue, 30 Aug 2022 08:36:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3262D6B0078; Tue, 30 Aug 2022 08:36:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C5F6940007; Tue, 30 Aug 2022 08:36:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0620D6B0073 for ; Tue, 30 Aug 2022 08:36:39 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id DBADB1A1136 for ; Tue, 30 Aug 2022 12:36:38 +0000 (UTC) X-FDA: 79856207676.03.8FBCEDD Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf09.hostedemail.com (Postfix) with ESMTP id 266F6140050 for ; Tue, 30 Aug 2022 12:36:37 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MH6Fj29qJzHnVZ; Tue, 30 Aug 2022 20:34:49 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 30 Aug 2022 20:36:35 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH 4/6] mm, hwpoison: avoid unneeded page_mapped_in_vma() overhead in collect_procs_anon() Date: Tue, 30 Aug 2022 20:36:02 +0800 Message-ID: <20220830123604.25763-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220830123604.25763-1-linmiaohe@huawei.com> References: <20220830123604.25763-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661862998; a=rsa-sha256; cv=none; b=UU7lGrLKZnVy7f6+OFXW0+ihnWJWwCwx17mD1mXtABr5UyaW88qYBhJBKXGj6E17vUgTv9 41SadaH3ngl4WpNdm/DsdIBmKVhsnfZCBdsOHe9TrQdyML8UENOVqVmgVtvQlPecLO5VYA obhTvrblmniQ1npw8eQxKSmx4hj0hLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661862998; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dK6CV2X06mZNvQjmKnfLI9JARRAkiesBdiNMs7+r5Tk=; b=oX2nxlL9xqLbyrkEDoxAmD9AqP2zipDBVOlrZOIEQWtHXfIK2Q/gzCoII/GOvntoFYpXsj rpl8L/ehBH+vuhWyirNMARW3UdFNxT5n/ZQfqGVw8Wl57XcISEo5rUYFVW68+BtCFjzgGK kX8QLyTIu5bZil3EtEiahEv4CV7wlpI= Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam06 X-Rspam-User: X-Stat-Signature: ddji8x8omjbg31ruzo4q7hyj5jshn9j9 X-Rspamd-Queue-Id: 266F6140050 X-HE-Tag: 1661862997-680521 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: If vma->vm_mm != t->mm, there's no need to call page_mapped_in_vma() as add_to_kill() won't be called in this case. Move up the mm check to avoid possible unneeded calling to page_mapped_in_vma(). Signed-off-by: Miaohe Lin Acked-by: Naoya Horiguchi --- mm/memory-failure.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 69c4d1b48ad6..904c2b6284a4 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -521,11 +521,11 @@ static void collect_procs_anon(struct page *page, struct list_head *to_kill, anon_vma_interval_tree_foreach(vmac, &av->rb_root, pgoff, pgoff) { vma = vmac->vma; + if (vma->vm_mm != t->mm) + continue; if (!page_mapped_in_vma(page, vma)) continue; - if (vma->vm_mm == t->mm) - add_to_kill(t, page, FSDAX_INVALID_PGOFF, vma, - to_kill); + add_to_kill(t, page, FSDAX_INVALID_PGOFF, vma, to_kill); } } read_unlock(&tasklist_lock);