From patchwork Thu Jan 25 19:32:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13531560 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 B2CBCC47258 for ; Thu, 25 Jan 2024 19:33:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48B4628000F; Thu, 25 Jan 2024 14:33:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 43A41280004; Thu, 25 Jan 2024 14:33:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2DB3D28000F; Thu, 25 Jan 2024 14:33:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1B3AC280004 for ; Thu, 25 Jan 2024 14:33:57 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id F0FA5A0CD6 for ; Thu, 25 Jan 2024 19:33:56 +0000 (UTC) X-FDA: 81718833672.06.60008A9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 34B1540020 for ; Thu, 25 Jan 2024 19:33:55 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DZPakjd1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1706211235; 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=Pt2Rr75nOP6cG/V8puv594TsEnpKODS5vdDUk5CMfho=; b=FUK6V2hFNEco+JCDypCRQs52bKZ3Mlqx6BmDf9phISu/k0g1BRopz8Q4QUga9dfTB7eezO GL6JBon/ipSG+4NqoEWX6Jr9Kz0nMlUdjhC6pRN4emEP8Afo7bmXUe39djSt5TEn4/D2td FV77R/cK+NQhdd5xdDO82N+1iMNRx1Q= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=DZPakjd1; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf04.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706211235; a=rsa-sha256; cv=none; b=5odxiEKgrN3uH/v582qhDT9/Yj05OU5gfX2vJdK+fArG887UuOq7CeJQYnWyYr5H2h+0w7 iES1uIVU1AzOgblccjF8r+d+Vckt+3zK9hYnVju9Zq+gH40dFa3Y37E5U3vH6U3dVdFu/s 4TdUMFveVwAMGHOe05mj1PkcAmSg0xo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706211234; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Pt2Rr75nOP6cG/V8puv594TsEnpKODS5vdDUk5CMfho=; b=DZPakjd1WPS9+Sb1nZqyLfZNwEi16YUTTBvuAkln5OS5BKe0Zgj55HiL99yztLS04O7oFU PczKdJVbzq36SVy4WeuVQwHV5mkVnNybR3pNDAElzaSAF6ZbVhPJ/Yz1fyUChCBbVjv4Dl LmDdMBvVJfeAFSKwWixYyqGVj0QOfAo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-358-Q-6aRX_IMaSNm0LLjZ787w-1; Thu, 25 Jan 2024 14:33:47 -0500 X-MC-Unique: Q-6aRX_IMaSNm0LLjZ787w-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5A3E18432A4; Thu, 25 Jan 2024 19:33:46 +0000 (UTC) Received: from t14s.redhat.com (unknown [10.39.193.154]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74AA1492BC6; Thu, 25 Jan 2024 19:33:41 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Matthew Wilcox , Ryan Roberts , Russell King , Catalin Marinas , Will Deacon , Dinh Nguyen , Michael Ellerman , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , "David S. Miller" , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org Subject: [PATCH v2 12/15] mm/memory: pass PTE to copy_present_pte() Date: Thu, 25 Jan 2024 20:32:24 +0100 Message-ID: <20240125193227.444072-13-david@redhat.com> In-Reply-To: <20240125193227.444072-1-david@redhat.com> References: <20240125193227.444072-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Rspamd-Queue-Id: 34B1540020 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: tzbqr53qg1jsx19mce1keo8fuyygs8ad X-HE-Tag: 1706211235-44297 X-HE-Meta: U2FsdGVkX18C9XPZfWq9jN8AftuAHZWOYG1MO/JMXPpjkfbOHUm0Kn1oYoyortysxg7dsSaCVGJgqf0maQFOB6mkYkUDYMz4hiSJEQp72xSWPXFEIUYjBybZ7s6ClzIWvp1l+aA0VDKtImA63lYlSWDwKtMYN5EpLcwMDYi33S1yt55GoKfEfPUZDO5tRHjFvihyEHgq9YPaHTFD/wutay1nO9Ar+ZLK9kfMr0BqEQRgljonSRkPUyewDLKHPQ0o0Oau0L26dmnvyj6lIaHm0x7gltJLAc5IX+47am+pRCLp7J+LdQEGkIKgXHO5NHSQOjgDdvsTGIdTNMHNlHWVWTv5XDtm+SeZ610jI1SQVe1O9p+cr7i+XjkYESjQI1ENFnBurI+PCt7Uxr5SZdPAmyPsNKMQQu+w13V6Ci1wOUHogW9UGJFmvtN8akkWwUgIT2NLOKy4xloJtMjdx0TcHhJcJCDdCwiKqwawAMFf1l3sh2VrhgJ/YO+taZMATiTKycVUPFgoLnRvUyt1tZgGYvmGjRSm60BsheGayMigyxBFfjPun0Qd0e6W6pXPPvTOdRuK0RfqHYrcDWsliqzXwvpfl8Ha0lfJiIhnLNocU30qj2UwuYZ+cQpTWTmTGP7g+2DMQDIAlJoM7O4xBIioPO4hYEvT6igkdyNTXZ5i139kDnOQTU1vFziVlV5VNpU03l2So38vAz2Gm4VK45CmxERU+n1yvjs0afUTLxFNwQqV2rVWcDJG/cZ5KM48w+iYA0I6lGmXK3VF4pGlVF8W5RoqTmI0m/bG799AiYHaLl6ABPtiIeNvotjli20KF4cyWF/C+tZb1IwlOJVK+Nmt41Vk8uglkn0FW5D70O91RMKl8Ph6KTB4+XzEzaWdRGhwc62d5pDNLYIjgIPCbA0b4aYKRfviEoA0bA9WUpF5cPV35TDU3mclIfdjMpdnogRAjhRmrVDBq0z9XgLUQOd vfZN4Pl/ K5QGMVU0CjlIuqRbsh+MExsWJzfJpufhDSXCLfU01VECulzOsBYNZDIrgPZ7OfnZhaMofsOeLVx6oz38iofqfnA/oRCinQga/3+8uuXtzksP+XFSNRkSM/rZHE8JqA903TU7RzuLESLO5p65Bm6cRr+XwkL9a/StKEVq08rD8UQZtb14zMWgtOHW7HqqjZu4eXzKxAYMaqairhnOUbGaT8p4sB9BVGfPw9alZRUkQJGQtS/+btpiVGyGBv9yFGMeZR/s3ZNHDRjOBFmzvW2dWdiMe3Q== 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: We already read it, let's just forward it. This patch is based on work by Ryan Roberts. Reviewed-by: Ryan Roberts Signed-off-by: David Hildenbrand --- mm/memory.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 10fc14ff8e49b..729ca4d6a820c 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -959,10 +959,9 @@ static inline void __copy_present_pte(struct vm_area_struct *dst_vma, */ static inline int copy_present_pte(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma, - pte_t *dst_pte, pte_t *src_pte, unsigned long addr, int *rss, - struct folio **prealloc) + pte_t *dst_pte, pte_t *src_pte, pte_t pte, unsigned long addr, + int *rss, struct folio **prealloc) { - pte_t pte = ptep_get(src_pte); struct page *page; struct folio *folio; @@ -1103,7 +1102,7 @@ copy_pte_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma, } /* copy_present_pte() will clear `*prealloc' if consumed */ ret = copy_present_pte(dst_vma, src_vma, dst_pte, src_pte, - addr, rss, &prealloc); + ptent, addr, rss, &prealloc); /* * If we need a pre-allocated page for this pte, drop the * locks, allocate, and try again.