Message ID | 89bd1d48db1986ec83dcae228defa748f38238ff.1724226076.git.zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 109E0C52D7C for <linux-arm-kernel@archiver.kernel.org>; Wed, 21 Aug 2024 08:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=6wf5h3KMWWmEe6/3TeJpf55VgCdFHsYKNAkaT296AWg=; b=VxVhHlyJGdrJXnVIcsoFx/IIcX mYwSK+uq7EOlcEwECIN90hQqVBBAiKQBxarowvIc4iguZW8cXmsJGMaVt+P17dtZzLimV7O6ITnpu 5A3UP5BoInsZYenPHZQWhYW70s4bQFz1XBFURxA2EBWhQkssHRBUt/7qB2DdzKAszjbTTl2UXT77M veUQ8i498STIa1Z85C4ZZCKbx1LJhn4kKKGvHd0N+WrdjYxaOM8Zwx1Rae3du6sjS7oDYcPxf/is3 MJV5i3+L8kt/cweDsRFFploZsYvR437YI00B/U09dByEWcVvtMh5VOMYgFBsIjSLmETBZ8uDLXx2k AFKtzrxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgggb-000000083aO-3Dm8; Wed, 21 Aug 2024 08:27:21 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sggZw-0000000825o-4ApU for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 08:20:30 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-201f7fb09f6so46451875ad.2 for <linux-arm-kernel@lists.infradead.org>; Wed, 21 Aug 2024 01:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1724228428; x=1724833228; darn=lists.infradead.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=6wf5h3KMWWmEe6/3TeJpf55VgCdFHsYKNAkaT296AWg=; b=Dhws4CPNo1AM6BZi9bloW0HDTRL9pU1EK2LyR7JmnnKsieKb610UBTLh6ff9kqBWd2 voy13N03kmoZnXKRdXSPfpm4KRq1PTzTemPoCn+Xm+QsaW6aOthWgO7UYMcqpRpSn2AZ UjUqu6X2LiuvOgA0Q9Ug1C/4jpAtlGgH7WuXSf7IbQc9aN/AAGrWK2rEPjI/jaMF8/QO T8iuJEyDxC8ypGWQXtNxB3G9G3e5g6d2yHih8BllDKi2WYj6udlL3+gnFwuR2FN6tSna ZTvBU5/rN9jERa/EswcdHtxj9gq4uUUyDURLyWOMdsI4bNsAHU4fdpuSJ8BuuW9msZ7T X8dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724228428; x=1724833228; 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=6wf5h3KMWWmEe6/3TeJpf55VgCdFHsYKNAkaT296AWg=; b=Swu5xGvEOU7UrmEP7/4I6c48rxzTAT9DLxHy9NUV0a2+v6mAQXlDahX8iKTrt0oZrY fcz8PDCqbjw+DlUebyJNyRnGsydePeEVE0TGd+uob+HXpveILuwopZSe6LI8nUyfyu9r 2fB3PzbNb2/ANTvpSJAMQweUGTdemP1/kg53kTnocVO+bYtS3/siLJo8Plo/61po9Fc7 aBHLhdecwm0apGFkvqMxdSw5ZxkJc6fT1pZgZ3C2cyqavX2TWJ5ZzZfw82HrE3MJGuf3 hxiTb4a7q5XFCDcOiYWnOAKiks4ceeQ6yJzAVEc6wmSLAkihrcRYn9sj6jNRt07PO0zN KsPQ== X-Forwarded-Encrypted: i=1; AJvYcCVyGzF8bbXxLV5XrUUn+b399deQY3IoNDr2M5P2VBpXCU2eLodElvKmW55nwwW3lVX6HYp9G+GZQA/4XnK43ROA@lists.infradead.org X-Gm-Message-State: AOJu0YyhzdF56cT2jPhCpXMAc+PDpY2kk4/MIgSb5bb88kHZpJCJ6npF F2QuP1uFsQDq7f5lzm42Xk8gnJIeWmuWlpShTDqHvEi/3bdnxXUuEvEZ3Cw7bKIC6hEgQhZTFG5 6 X-Google-Smtp-Source: AGHT+IGct1lfg7s+Av92JTuFI7wGr/k4q1ybIYiVEVcgmdImld0nRYlRbV5Vh9eNiEYSyV0nSbS/hA== X-Received: by 2002:a17:90a:7893:b0:2c9:635b:7271 with SMTP id 98e67ed59e1d1-2d5e9a24ea2mr1616047a91.21.1724228428100; Wed, 21 Aug 2024 01:20:28 -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.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Aug 2024 01:20:27 -0700 (PDT) From: Qi Zheng <zhengqi.arch@bytedance.com> 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 <zhengqi.arch@bytedance.com> Subject: [PATCH 09/14] mm: mremap: move_ptes() use pte_offset_map_maywrite_nolock() Date: Wed, 21 Aug 2024 16:18:52 +0800 Message-Id: <89bd1d48db1986ec83dcae228defa748f38238ff.1724226076.git.zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <cover.1724226076.git.zhengqi.arch@bytedance.com> References: <cover.1724226076.git.zhengqi.arch@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_012029_063459_386713AD X-CRM114-Status: GOOD ( 11.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
introduce pte_offset_map_{readonly|maywrite}_nolock()
|
expand
|
diff --git a/mm/mremap.c b/mm/mremap.c index e7ae140fc6409..33a0ccf79c32d 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -175,7 +175,12 @@ static int move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, err = -EAGAIN; goto out; } - new_pte = pte_offset_map_nolock(mm, new_pmd, new_addr, &new_ptl); + /* + * Use the maywrite version to indicate that new_pte will be modified, + * but since we hold the exclusive mmap_lock, there is no need to + * recheck pmd_same() after acquiring the new_ptl. + */ + new_pte = pte_offset_map_maywrite_nolock(mm, new_pmd, new_addr, NULL, &new_ptl); if (!new_pte) { pte_unmap_unlock(old_pte, old_ptl); err = -EAGAIN;
In move_ptes(), we may modify the new_pte after acquiring the new_ptl, so convert it to using pte_offset_map_maywrite_nolock(). But since we already hold the exclusive mmap_lock, there is no need to get pmdval to do pmd_same() check, just pass NULL to pmdvalp parameter. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- mm/mremap.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)