Message ID | 89bd1d48db1986ec83dcae228defa748f38238ff.1724226076.git.zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54096C52D7C for <linux-mm@archiver.kernel.org>; Wed, 21 Aug 2024 08:20:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9CE66B00CF; Wed, 21 Aug 2024 04:20:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4A476B00D0; Wed, 21 Aug 2024 04:20:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC3426B00D1; Wed, 21 Aug 2024 04:20:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 99B706B00CF for <linux-mm@kvack.org>; Wed, 21 Aug 2024 04:20:31 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 55ACD160AA4 for <linux-mm@kvack.org>; Wed, 21 Aug 2024 08:20:31 +0000 (UTC) X-FDA: 82475555862.20.D128463 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) by imf18.hostedemail.com (Postfix) with ESMTP id 6A2261C001E for <linux-mm@kvack.org>; Wed, 21 Aug 2024 08:20:29 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QNTuJmjb; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf18.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.175 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724228364; a=rsa-sha256; cv=none; b=7YRco554mEdIul6M217B5A3z8JrLICPSvKhU2hPwKI+gScdKG9S8pIGA16MkN/2R8yCWTI DTLyduUhrVd2korgv3emIZn8qjm3hOgAv0XjDwaBPTrXqXh8lRH3vl7/7VPNO1TaZmI4IA 69FBqDunHuhENFo464PTUmHgBYW4XwY= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b=QNTuJmjb; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf18.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.214.175 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=1724228364; 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=6wf5h3KMWWmEe6/3TeJpf55VgCdFHsYKNAkaT296AWg=; b=XIgzqTCYbtU+Xmg5zEeExzoddVzt5Y1JZrxvSLjipnCe0LbKsUXIAb6FiwXWUQuXB17eaT WWduxKDGyFZFHBWSt7BMlnPnHlCuFppUxDFwXnujSGoDRcPK8Kf7a+9T3OqUWXUflE4rAk /RtpyNwEo4PRO1N/dzcZQrPkuK8SPNc= Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2023dd9b86aso25747925ad.1 for <linux-mm@kvack.org>; Wed, 21 Aug 2024 01:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1724228428; x=1724833228; 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=6wf5h3KMWWmEe6/3TeJpf55VgCdFHsYKNAkaT296AWg=; b=QNTuJmjb9Vf20LkYSKSo1UKC3Yidm7QSIUKO/Kc9WE51HUToFRQ0bTYIpLbeKvP79X 7Nd/+HIbYx+WrA3Pf/rSpPMHeru7d6rV6PYgg97cSSiAZA/T3ykcxnNLz3Vzd95Y5nUw yCqSMijUpmWWOnZ2DxnF3YWuPtDXkxye7416CjvYk7in8xDOSpel1vAAeYNjUxUdapnS WrxiG74ajIXRt/qKdE8JXUA1CMW8GVzozJIWCxd6MrDAPzQwoftmJsjias1DadyA90rv kCAXNXSMlvbIPXv/FIZ55ChfEIj3onSvoq46Nl5fEFFhcYyEE14LXWjJHljNI0sbpV8C gImQ== 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=hRgeq8Ffhbf1duS5TvOK4O/3gWkaxNNlrAVZcPSSqUtJp0VG4vAxto6+uKiiGzC8bW 6YRVZfLFNk0DQV0Y/0rzfRFzyhQ0NuJJZvyaU6gcmn0QONzTqHQnPze8KS3I43UGXCuT vG2ubN6ZIuX8E62zkzqvjTeiZKLIkz4WQwp1lAgmUwD/KASA2lMGzzLb6HISN3t86aND RYRy7lg2iq5a6qL4Gag+R21lrktjuvVn+QaXTB79x/SC5QOIrOX15Z5dTdVIxExH/Xqf oUjH3XwzIq3BPWDJ/C9Y7NVWOO7oCljqyyrRhplA7165ZI0W4UX49H15nyzRH98+DkOG 2wZA== X-Forwarded-Encrypted: i=1; AJvYcCUOeH8oiL9dcoJ8NhxLfn+JElie4dmUmrXdckdMm5SEI2+ivywo24C9O5DEbBJRaDojNUR4nWIk5A==@kvack.org X-Gm-Message-State: AOJu0YymZRXNa1OqPu0sP88ldtOhFSZBHHNu+Wmr/q/mmp49E8npbUWm 8CQSqJ9n+nXELbd3See3vNcKISUYH/4bOOEcgTqCLbqhvbiUYfA6z0DM9f+YRi8= 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-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 6A2261C001E X-Stat-Signature: nrjxyx4zniqoo9w19izbh3wjpiin47yq X-Rspam-User: X-HE-Tag: 1724228429-575899 X-HE-Meta: U2Fs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tRDpvWDWR9BA2EFYlsyUcX7EQaHC3U/+hSZZ/Q3Cs70KLSCb9bheCB8SAmQq7Nd/90IOOswW+nfEe3DjUeT00KmTS+Fegq/XOIxrQ+fhyXeNVTmYCDIQMlc1OulNYZ2yz593f0C8cotmLnsS8vTq018kQTvDqtoPeHjb585jK1J4s/U9KHSzlEvI/VyrFa/3p4+WffQYu5z/V4w3wZAuD/rD0x+FdSRIFuLE4JTtQyVIfGs1BlB+qrhh3jZOWrye51o8VcO/YXZ686mcV6E1zdsUcNZQwIZf76ee+POz0sr99lB3lqEiQA0AdG/t0nYojEQ7ZvE3Dy7Ayh9KDViS 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.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(-)