From patchwork Thu Aug 22 07:13:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zheng X-Patchwork-Id: 13772827 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 C7DBEC5321E for ; Thu, 22 Aug 2024 07:14:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C5996B0266; Thu, 22 Aug 2024 03:14:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 524076B026A; Thu, 22 Aug 2024 03:14:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 350086B026B; Thu, 22 Aug 2024 03:14:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1061E6B0266 for ; Thu, 22 Aug 2024 03:14:15 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B4A29413C7 for ; Thu, 22 Aug 2024 07:14:14 +0000 (UTC) X-FDA: 82479017628.28.0DCC216 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf26.hostedemail.com (Postfix) with ESMTP id DBE61140014 for ; Thu, 22 Aug 2024 07:14:12 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=P1k+wyfA; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf26.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724310836; a=rsa-sha256; cv=none; b=dHs9SH1SlgCpxEnsdIoqIKhpFG2OqfqRXU90pwL+ryqv6X5ID0/M7ULwxUWS/zwtyQElJk BKYJ8hL3guwUNyOTXaz34Lxq7rnYpscE5u+pFrMU4px24wBzD971Ecy6Cb1niEX8xMRYdI Mzaw99oxSa4KuNmVUWdi66x2H4Ga47E= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=P1k+wyfA; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf26.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724310836; 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=jnbwyZ8nm7OA7xAj7wrWrabgK1t5zgYyH3DelQTt/t4=; b=tyfPfyBEqYsT4noYFgMiTBZ+VKBUeQttrJKoegDBaOf//BV1ujafeTCI9VcOFEGZeF8ZoF jDHsG009RcM+1x2/yaLVwNc/wEA6lUDo6VRx3rxX9ATGQ/akh4eUALIsBO/DoPr+25Xmz0 hDU8x9irtbkVBgN6UeBPLMnmJk348+k= Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-7142a93ea9cso394257b3a.3 for ; Thu, 22 Aug 2024 00:14:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1724310851; x=1724915651; 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=jnbwyZ8nm7OA7xAj7wrWrabgK1t5zgYyH3DelQTt/t4=; b=P1k+wyfAMO9akuaG95nIZ2kM5xVyTfBEtHwRKLwgJkscCoOwfMALVLEshVGxdbx6ck yKAQsVRvBKlNyQUoJBX00+lDL/phadY68cPreaUtKV8NYP+okSnIaJGYzTdcsfbTdU3G J851DXMCK6/AR4uHPRBbI6a8cstpGw2qMzbq3YosRpzRLBXszRqHhE26CgWA4tq4m2na CwbuVCRxfN7VD/xRGTmImgJ+ix5CM0BvgXLeV+5uVRSCXLEOiufWO/7D7QycLWemzHqk cRbKjyp//tMvolNfo3aEUzlcgv+/k5M8ZGPO8g9+R/sgAafcyEKjtL4vHoBwdT/D6ZnN HHOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724310851; x=1724915651; 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=jnbwyZ8nm7OA7xAj7wrWrabgK1t5zgYyH3DelQTt/t4=; b=o76ehv4aDyixCq6TNHl/jtvDl4z16HsZepsuDXXBjBIvGw4S4EHZkznUbb7cgFHvL+ kM8NxokLDYtNJQBEQ+7DosDL5pF3lnFZvjPRCDt9yz2UzvC8RljAp1zGKqx207EQLhlZ iavHm0If2QjPIHhyUKF5jTzc42EaVlpbTLpf0m6bwDVlvDXNvXbOMIjpHcymoNPF92Nr frvsggN+FvtoouUMQPNaXPRc/5U4R6nfOwuhSqm9fi4Ph11mh7+uRVLOOXQRZ3kJGRr4 jszOE7w8M0t7R6UA9YVkyfk47u6sztt+R8zyq1wjphZNZnSyWeX7yoWdcex9MYx9o+rS X9UA== X-Forwarded-Encrypted: i=1; AJvYcCWch4dBchAPkNcDJJcQLNfDodvuvalUbGvb0v+8ZWPpEFfbrd4FfL+S3mjiWtfA/ADH4QEsLn6MVw==@kvack.org X-Gm-Message-State: AOJu0YyW9GzpLpP/Yl4hyJI7+nlp9PsDDhJ5wkxI3iTfLpiEahVff82A YyrZVtf0Hoc39HUJNRJ7CalUbKq6AhcqN5DOAvV33Mn7XXOXTPwaghMxPyUyx+U= X-Google-Smtp-Source: AGHT+IGXmNRuv+mQEijx6lEwkmYjHk6XirTogWRG+N5Gk1h3xzTz9eMzqUkZv9fzF0cNQyeHFRUhTA== X-Received: by 2002:a05:6a00:c93:b0:70d:3777:da8b with SMTP id d2e1a72fcca58-714235a5404mr6267050b3a.25.1724310851578; Thu, 22 Aug 2024 00:14:11 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([240e:473:c90:f96:d029:ea8a:4e6d:d272]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7cd9ac994a3sm695095a12.16.2024.08.22.00.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 00:14:10 -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, christophe.leroy2@cs-soprasteria.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 v2 04/14] mm: filemap: filemap_fault_recheck_pte_none() use pte_offset_map_ro_nolock() Date: Thu, 22 Aug 2024 15:13:19 +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-Queue-Id: DBE61140014 X-Rspamd-Server: rspam01 X-Stat-Signature: schomztzbcku1ke1m86b9fm7z9fcq7k3 X-HE-Tag: 1724310852-331930 X-HE-Meta: U2FsdGVkX1+w9/Dj/R0dl8eTAjFDvd3zT7SQvTXGdGAJaItAhMJUXf7HKp5dIomd7CVmhAd7DN2cLaAPRR/djW/nBQ5i+TSv3tAS1Vv6Ab5Z/ykCiztmWfAllWxspLpMOBUxFczPB91IRMCehQ4c6IjU0AqVoYv0O/Ydnhx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cXjkfZuAVuwER+Ru0MqPPLv+5p0dT+lB5efcj6MQRL3/DEIXxJTfYlpF9240UKLHwnhyUUjoJEwiaDbJ0rAXt+t7mDJv6MPOS2ccn8Tj9/Yzu9QXo7zJM11xSW4jS9xyakgIjcF+oMZPb69C95BfIlW5Fpm9JNO7qk0JT9PULJ5n4TWvV5GnLj/VSGqH4 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_ro_nolock(). Signed-off-by: Qi Zheng Acked-by: David Hildenbrand Reviewed-by: Muchun Song --- mm/filemap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 0f13126b43b08..c98da9af6b9bd 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -3234,8 +3234,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_ro_nolock(vma->vm_mm, vmf->pmd, vmf->address, + &vmf->ptl); if (unlikely(!ptep)) return VM_FAULT_NOPAGE;