From patchwork Mon Jan 29 12:46:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13535526 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 4EBA9C47422 for ; Mon, 29 Jan 2024 12:48:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D10838D0002; Mon, 29 Jan 2024 07:48:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC0368D0001; Mon, 29 Jan 2024 07:48:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3AA78D0002; Mon, 29 Jan 2024 07:48:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9FDA58D0001 for ; Mon, 29 Jan 2024 07:48:18 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 408BBA0673 for ; Mon, 29 Jan 2024 12:48:18 +0000 (UTC) X-FDA: 81732326676.27.1FCDE3B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id 93731A0019 for ; Mon, 29 Jan 2024 12:48:16 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YD0bDj4V; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf15.hostedemail.com: domain of david@redhat.com designates 170.10.129.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=1706532496; 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=cS+fj/Ib0GI5otmzNrt4qLpnZeCkiOZS5Y+GTIa0gvY=; b=JKyCHuHpHGV9rvK/7TrkxlDsvA2bT3wuNJJ5XkcAe6W1OcDw4ARGxHS07PM6lGX+k+D24G I/yR/OfVkUeH/ZrOwesG9FpMQUqQdzzCY5/YODDeJaPQgok4daHotCxQv8GBQaZUCA7zuQ tIIDww+JkM+k0qqjQRmWTme9z9qUPBM= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YD0bDj4V; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf15.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1706532496; a=rsa-sha256; cv=none; b=PY4ubrC2k9z1uCKdcR29/VE0alz7Vpa/J0admXQWE8JNpG9e7i4EOAag9tjXZ+CT2zyhVs bzA653ohEfEWP9lXCJ5ihRtEqQq0p5bv7hqQQ+ATPdc9QmKf668eNa7FZStujMrjf2Q0Yh TLwPyxq4EGelJIqwAgW15F/8/PomzVo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706532495; 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=cS+fj/Ib0GI5otmzNrt4qLpnZeCkiOZS5Y+GTIa0gvY=; b=YD0bDj4VdI4pur+YYkFRMQLfK+P76yG4GXj0kIiPIGpwIXKFY6tVuFiPbdATVSY7b7S+lC mk1YRJJYuK269tgwrHw5dDxcc/uziuKXGwe9hj9C9lo7fCMIVLuXFxa121rPLDZQf2X9Dg jMNVhJpE5bjc006hHFoYo5bsLTgVFZk= 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-639-uopDDWlrNyiX6spNRSMRFQ-1; Mon, 29 Jan 2024 07:48:10 -0500 X-MC-Unique: uopDDWlrNyiX6spNRSMRFQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 D8CA6867943; Mon, 29 Jan 2024 12:48:08 +0000 (UTC) Received: from t14s.fritz.box (unknown [10.39.194.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 99F798B; Mon, 29 Jan 2024 12:48:03 +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 v3 12/15] mm/memory: pass PTE to copy_present_pte() Date: Mon, 29 Jan 2024 13:46:46 +0100 Message-ID: <20240129124649.189745-13-david@redhat.com> In-Reply-To: <20240129124649.189745-1-david@redhat.com> References: <20240129124649.189745-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Rspamd-Queue-Id: 93731A0019 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: efq7ujx47ijeraj96ht58ayqanx5ntej X-HE-Tag: 1706532496-475401 X-HE-Meta: U2FsdGVkX1988gSES7XLXZkOktajQdRj6OKhpMHLwE+pVB14S7Uy6fHuChsu+zuMaGW9sO2ahDeyIwtwiOvUMkMA7YvGkv/2N6tyYC/CSFcHsFeIkSvlGJh3H4dZIsRlwS84wdsdvLEZWj8np/6X6bcKe34u+gnsOP1unNGAb1fO5UNZO+dgMp2TKOUEFHWgKBsCfFrxsGbzXxM6wUFF0slX1lCbx4RfidkdjKONcP7vp6TprfVnBCDpct6J+qtVoGvapZa4gjRSED3mElJ++6bw6AwP5dQV/6gQE4t3DtOOibzdpcqnTQ92gsgdpcrahdp3F+zjT7dX8VXMfBPxhADO/Qu6+O7RvrI3bart3mbChB5Rz0H7/i0nxY3GkOMv1U+PBpPd5K4LlMAD+sGsorVMtf8GFdxylAx+tWJDZfEtmsWnET2VtQvXSXH+feFTwvctOtSFIrq0Syb2n5Ix+lAHhs2MgqLIBKO/GXhAgYRA1RrO4zQHlgfOWxppMGkP1gZpNJppzYre3dS41WXyidwXZu0GFGxPrdDkk55R4AH5fQRrXCIySFWDHjIqydGuOry2+k/lY+fSZFicN17qHO9VkF8Zn4hDWJZ+4kC8Orp8UwVn8NFkK5x/DS9/trDmfA9E/W0q68WFn9U+fYYQU0enQybf+hH879hIrPYC3MY9VPrRJZPakIZVEIA/hTI7gF4H7y/IxiLbyjrK/nwu62SPiFoVowRZGZYO1LuRiucXZIe/SJ0lQLZ7Vs35Mu/adykclwY2GEHq08JSAeF0cSLsTCzGRUozfFhbD5k8x7QlqqqXrriHIdRUMKRddpzKOUM5vGmwacMK9I0NvJ53pHmGM7ZfTb2+Y8njdeLFtieryTV1WqMv9N+lRuQmWdyjmee+tWpXjkojZRcIo3GLuvKhJV116BtA53g2n8m+T6QstYzLmfymae6WMdlRzkVmF3pb7j+V2SMYcqOnozw ChiYCj8E abGYxfokz3wJw/DL9MQefL1ItDRu5F731nLGKjJ77nvy4R3dGzgKx4ieVnnoXPqbwXxefDizrpxraogMoAMBGB2qlGgP8bB19MTleT9lr3MsAMbnrWHCO9AaNwoNZzVOaTQl/1gXLbjL0ThhZKPRtuo64LGF0PhgLCtfLDREU8nYK4rCyvR55HFGxPObescWp8pvOIkRGYxbsS9HD/IL+vS7JSy43fRmFrl4nnU7Ympq7GDorJWNqmHoAxtaU+pbPxHRku/0MSilCSjznAcbqEBHpaQ== 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 Reviewed-by: Mike Rapoport (IBM) 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 a3bdb25f4c8d..41b24da5be38 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.