From patchwork Wed Aug 21 08:18:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13770987 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 DF3ACC52D6F for ; Wed, 21 Aug 2024 08:19:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7CB3C6B00C5; Wed, 21 Aug 2024 04:19:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 77BD26B00C6; Wed, 21 Aug 2024 04:19:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5CEB46B00C7; Wed, 21 Aug 2024 04:19:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3E38F6B00C5 for ; Wed, 21 Aug 2024 04:19:56 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B7AA81C4290 for ; Wed, 21 Aug 2024 08:19:55 +0000 (UTC) X-FDA: 82475554350.12.4414C54 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) by imf14.hostedemail.com (Postfix) with ESMTP id DE8C4100007 for ; Wed, 21 Aug 2024 08:19:53 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Yv1o30tZ; spf=pass (imf14.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724228314; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GHfDnFSOmlgsN5ypR9SiqdvWOZgzK74sPfUFdgGElDM=; b=HMWeu25FnHerws328Y4eGViSV+FwJLdTx5eyvgCTgCHBXA534wAO9a60FVv3YUb+0MyI0+ M3W/mCdBErflwke4sbAobskuQUbfFk5gAkiZPGw8pxdpm+8GdlhuMBZN3LbcFa0//dH2uo fsqMSygmXdVg6CfKC8cnc9g6zShiBxI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724228314; a=rsa-sha256; cv=none; b=fRP+K35Svj66c8AeFT4ThDjEdYkt0HJy0T3fchNrv28Xg46weYGRYgmzjBWouqR6wH+h9Z j8dVYyd15IeSlpuHBwzJ4/77Dz7SMIdVIZiIyDFW3tZif7h0yXtdoCKUwuWd0zuxVHze3u Le9e3WT69wTzZ/JVvFvcMqR2e30lWlM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=Yv1o30tZ; spf=pass (imf14.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.215.178 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=quarantine) header.from=bytedance.com Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-7c6b4222fe3so3874665a12.3 for ; Wed, 21 Aug 2024 01:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1724228392; x=1724833192; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GHfDnFSOmlgsN5ypR9SiqdvWOZgzK74sPfUFdgGElDM=; b=Yv1o30tZbE9T1wicoe5EZWLHFuUh02WkwwQwWZoqQWo4cWrziWyyK7zi1K3H/rQ+lp yAUFcu9ycEHICbEWqZtCTGGHYLBZb69UWRAC/KORKsgCwfe75TKiyhrqnIAC6T1AsgGr ytWJ7kR1vQAL5f0MAOACuno6tQXjAWM8fKJ8KqPDT/bVoDzh8gozMDWPjeDbJtrS5zz7 MLyG7AKHs3WMQy3ZGU365hTeEkquODq5BkOnrxyQL0WEVrFSFXI9AWjnDAf/Q3bzkaba p58fA3SAEAFjQRUxh6MJBxIafi8mtLYXLUnzjdyn968BT4LKtRhDglM3KMLPhlD5l+xn 4Niw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724228392; x=1724833192; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GHfDnFSOmlgsN5ypR9SiqdvWOZgzK74sPfUFdgGElDM=; b=EubcKIB7Zrmx2Qg7Te0T9a4Q5Og/IzrCtYwH29py/T7d07WVP5e1djTlkiA9nLeG+g boCP1KrtlcBbGPNZw4DRWen3k+17D3JPLBxGvGxMOqqztMmVVWZ0PIPMRzLKC2dpzfuE EwKrN6u2MkmDG+uXoPgUveyT99mBKquC/T0zXWWJ5emxYvhSGFwE9VB1htKGV1K+h8Bn XBTkwxXFcBLR6ut2/7Yh840eDtVdi2xz5i1176W2hfrkEuxyB2F905BigL9TG/gMcjKZ +n4/cKleJF1ILyCSkNnh6op/f/Ta+0Jv09lRZCju+NLKElHJASuEKni3SflO+kd6Xa+z VYzw== X-Forwarded-Encrypted: i=1; AJvYcCVH7378JCPym3Stfe1+fZyNzMq81HuoGANSUAJ62785LlRWyHanR0wmUrxJz1NpSTcRa+rQdll8sA==@kvack.org X-Gm-Message-State: AOJu0YxxDVSLp69mZ/1alTuqac6bTzzwF34kZDbr5BSAdsxLcWzltDkM lT8wfLnh4UW7mpc2cPDkDieFy1alFX1V2OcfU4aU/Owy+khmL6kNY9ARJL1SuHw= X-Google-Smtp-Source: AGHT+IEDKdhDrkAt8Xw9HjhxvAn16yLBj0ykk9gzeBgjUCoqqbqdejlnt+3gntiVrRuxkT/2XR+s6w== X-Received: by 2002:a17:90a:d98e:b0:2c2:c149:ca4 with SMTP id 98e67ed59e1d1-2d5eaa9d141mr1321075a91.43.1724228392525; Wed, 21 Aug 2024 01:19:52 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([203.208.167.150]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d5eb9049b0sm1091453a91.17.2024.08.21.01.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 01:19:52 -0700 (PDT) From: Qi Zheng To: david@redhat.com, hughd@google.com, willy@infradead.org, muchun.song@linux.dev, vbabka@kernel.org, akpm@linux-foundation.org, rppt@kernel.org, vishal.moola@gmail.com, peterx@redhat.com, ryan.roberts@arm.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Qi Zheng Subject: [PATCH 04/14] mm: filemap: filemap_fault_recheck_pte_none() use pte_offset_map_readonly_nolock() Date: Wed, 21 Aug 2024 16:18:47 +0800 Message-Id: X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: DE8C4100007 X-Stat-Signature: pcjmydinfqtk6sbn4g13u7ogt1sdis34 X-HE-Tag: 1724228393-991981 X-HE-Meta: U2FsdGVkX1/3FUr/LkvRF1B0ApNePtm2s7nOglulUnz056m7e3vpj990jTrTay1btwkSo8fXyXATu56o7fZH7pLUiL7HLoQw1FrFZc5a+RzD7kZ8T6poVQDd20bqYsRvqxpWa5hYiFBNRQAeietw4hXgoHoYHlmHiVxYvY1GqhIlRJgQp0qwmcKo9/rtax2WA73IVO+vlrxQb2Kw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F1MvB82FCclziQbElIqUvTU8WKgz0tjLD+B+RYQkQ7mBzird9cASTHjE9ft9GxE2ktxZqrNJPPi0IPR0LNKpRKJ9k1ytzSSStFATmAIBnpX90ZKL6TcvkTDD0Qq8SjvF8A+S+d6n/9pvjUQNbe1MVgJk3 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: List-Subscribe: List-Unsubscribe: In filemap_fault_recheck_pte_none(), we just do pte_none() check, so convert it to using pte_offset_map_readonly_nolock(). Signed-off-by: Qi Zheng --- mm/filemap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index d87c858465962..491eb92d6db1f 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3228,8 +3228,8 @@ static vm_fault_t filemap_fault_recheck_pte_none(struct vm_fault *vmf) if (!(vmf->flags & FAULT_FLAG_ORIG_PTE_VALID)) return 0; - ptep = pte_offset_map_nolock(vma->vm_mm, vmf->pmd, vmf->address, - &vmf->ptl); + ptep = pte_offset_map_readonly_nolock(vma->vm_mm, vmf->pmd, + vmf->address, &vmf->ptl); if (unlikely(!ptep)) return VM_FAULT_NOPAGE;