From mboxrd@z Thu Jan 1 00:00:00 1970 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 31893C04FFE for ; Wed, 8 May 2024 19:31:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC3D56B007B; Wed, 8 May 2024 15:31:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B73E86B00AA; Wed, 8 May 2024 15:31:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A15BF6B00AB; Wed, 8 May 2024 15:31:53 -0400 (EDT) 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 836C36B007B for ; Wed, 8 May 2024 15:31:53 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3FCE581262 for ; Wed, 8 May 2024 19:31:53 +0000 (UTC) X-FDA: 82096223706.30.0F43D50 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by imf18.hostedemail.com (Postfix) with ESMTP id 57E011C0007 for ; Wed, 8 May 2024 19:31:51 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=lKgxP6Ym; dmarc=none; spf=pass (imf18.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715196711; 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=3Mj4lZQ0sNzizek27x00kn2/PQ3ffbB6QFBBUZYNyzk=; b=q8E22F0KcV1/dSj1DEonFX86RCLPfu+pqc71ach0CfQUOMiBP7wsLxRBm6JYz6Zb8ZhSxP Syro4At/FxkchA4/TYQgaW+6mO7A8x2OsGjMY2Ec8sNQBxG9TjcIIxIZwGXoMu5NDzDJcS CfZq1CLjZbhexs1y4N8sAqLsNrowKMg= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=lKgxP6Ym; dmarc=none; spf=pass (imf18.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.221.41 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715196711; a=rsa-sha256; cv=none; b=UgU6p55e/Z3O/LT8WXnp6EgJb3tEguy2pe8zXV/xtiaxNDYja3pLEsDFlPmAYDky034jrn 2RXFk7lx/D4gXrxnjWyO6wD0g53bhl7kehgHGAvaYkatmiHzVTSPX0T5W5HWryZMGeJQPC xTMX4cXEDDqqpK/zUsm2mUdu3TSlI1k= Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-34e0d8b737eso741277f8f.1 for ; Wed, 08 May 2024 12:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715196710; x=1715801510; 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=3Mj4lZQ0sNzizek27x00kn2/PQ3ffbB6QFBBUZYNyzk=; b=lKgxP6YmDDYi1mGvohMkp/yQ8tRr7lPgLp3JrzPHCluw5Yb9MBqLRz99wlh3lX+UOK hKg3+HtQXhhiPzCO8f1+vTW7N8Hii77c4Pm7jYsMt0pWZrnwcHIG8klou0bIgEMjVwCY LG2RJ1zK4O1eXyFH1dO5l4MVB18ee7FuTY+mj0eTJz1N5zoZKbvsybBqi3TqpTeizVEv jaG5nXz0DRPBCPfRrUfOHn+XgdZ8ewZPrC5RfP7txaiyw29fabx/0oQmHFRir5RbAfGl nzez8D6rW+v+/Mov0+qxsZfMXVTRJ5Ff9KIBddC+wXACKcwA99R07GOursQXnvdppnZ/ QLLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715196710; x=1715801510; 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=3Mj4lZQ0sNzizek27x00kn2/PQ3ffbB6QFBBUZYNyzk=; b=LVcaGx+3t8OP6p2Jxq5RwG7+yTcx6gO+skrg8zBbyH287JsTZNP/+eLbdwOZBx0mUy f3/EoIei6i3mCT7Gn/Q0Gl1xLe5QD7AjwCu/y705pT1Cz+nvgmD4mcCxu4tcbyxteKfu 18bldWpJbEwRvU3jl1K8jSF9MluuzkFgUhn/pr3IsRKQlquhHPY5HqBidfAJWnwEJgZe jlydQRlhuL8RBlLS9w+IRQ5E6T9HbP5Jinq9ctVjCXepT7xZIWnshz3RRCeHQr4xNIJ4 4ctbeVilTuDw4JVEXwd/db7P6QuT7rzMYdUcATsBOLxrejzAuzVU/aYyM2o0OFvC5n5a tiZA== X-Forwarded-Encrypted: i=1; AJvYcCXFj2vNUyOSGwv9HPKrRkkS4iS/AVfgLRYJMyRXgxZx0wlnFgSEiXu8/ZZiV/BKl+wGN3fXahkFohXUDSX6AiVBri4= X-Gm-Message-State: AOJu0YzH7jTS94Dt+Fjg4BJ7Z6bMey9wmGObjqqyllgs0C3kSigtBo50 Rnw3eY6BzNDkgIoOaWlVyalSKzZY80A81UhhWVF8VMCYWOQqGfWNXOhNdlnblTk= X-Google-Smtp-Source: AGHT+IGynnks5bQyXkefndTUc8PNt1+uZJK8w5+sVciCnroxfstzlHH5YDMjCv7Za3kPs8Z2dwdXzA== X-Received: by 2002:adf:fe8a:0:b0:34c:fd92:3359 with SMTP id ffacd0b85a97d-350185d57e7mr489056f8f.21.1715196709811; Wed, 08 May 2024 12:31:49 -0700 (PDT) Received: from alex-rivos.ba.rivosinc.com (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id s2-20020a5d4242000000b003472489d26fsm15924162wrr.19.2024.05.08.12.31.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 12:31:49 -0700 (PDT) From: Alexandre Ghiti To: Ryan Roberts , Catalin Marinas , Will Deacon , Alexander Potapenko , Marco Elver , Dmitry Vyukov , Paul Walmsley , Palmer Dabbelt , Albert Ou , Ard Biesheuvel , Anup Patel , Atish Patra , Andrey Ryabinin , Andrey Konovalov , Vincenzo Frascino , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-riscv@lists.infradead.org, linux-efi@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-mm@kvack.org Cc: Alexandre Ghiti Subject: [PATCH 12/12] mm, riscv, arm64: Use common get_and_clear_full_ptes()/clear_full_ptes() functions Date: Wed, 8 May 2024 21:19:31 +0200 Message-Id: <20240508191931.46060-13-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240508191931.46060-1-alexghiti@rivosinc.com> References: <20240508191931.46060-1-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam01 X-Stat-Signature: 88iknhdx1mwg7sn4mpoak3jy5h8ptyyh X-Rspam-User: X-Rspamd-Queue-Id: 57E011C0007 X-HE-Tag: 1715196711-634698 X-HE-Meta: U2FsdGVkX1+XU4oL6JpSzI8twtbHlk8756U8h/MZoOEOgeE177rzRAR2t5P26PdUHnfx2aHG+1eCaEluWG5n7i7PXHg94v+QS6h9BZQhvJZKsXb8XH0mLslCNXA2JovxlYkg7wX6NRew4OHUxdghTBW8RA9xkMXEDS7y0Q96P+N9So7tEPPTVuvuVVfaxb6SwFigubYQM5sLMTeCK1mV5rQ+X3qZSrmHyCadObJLfAYecMqOdoVBY2l+QXZEFBUw2H1308pXZk9BmXz65Y1Um2TG2ZzQw382ifuWvBpCfOKk9L0HRU7dwadbIiQPXUijQGVIsTzeHrGLy3hFyRYZgUMuXW2yygbQYmflrAhNKtZ5T2joCfORa98GqbB/2OERXuykosOG121L/ySUiSP4qdOj3fi5W3KvWdEx7BTZzY9waED1rOS9ESntgl5uvLljMMdX54G00Oljp7bQULD2fmD0G/wdrNuUImMlMFEZqgujQCPDj/w7kiMrTH31L+GQtp12oIbcv9SkKWZ/uwk6f4LUviMm8wZwXTwAxINbee0vBSf1cF2R/um3g3CRHeKiw1+Z3MoWyA0aCce+YkKjXEx+jn9TE8T1QAhqoVewlgyJMHj0kAo480zm31QCm1dtai/qN8lYXN9OgDvYObbaa/MEWHkoAFIkCeFLWdV1Ictcb59JAlX32v0PRMx9U4QUlT8QI4QLwp0rK4W4g0r5NxBSkWsAAvQJD0JAHCAxBijosgegT30R+/U0RDs0NFrLnhXQZ1IlfcVq9A5S7RE9V+pZfDoJi06dq22bT94umBLTlPc6cMfe3YdrVUZAO8/Ile5tUVyHRp2LbLsQdif88y3OroBMzU445/FQ3sB8VTJuCtrYCLlOABDE+CwY4EM/GWK9OLppfVgTO2mo9f7mnoDGV+rzu3wvZkBRKnjeh0BcB7kPRq7qWFnh+jP2Vu2P32PBTTAeJOR3DYHzslw rwAmuvyl JtDPFzgeBcTvyLq5hnLPyALnrvZerLjjn5yHU8nPjpqvk4ckjNdRbSc3rLqySkxB7uzDmO7MOYdWvtCq56WV2Yp4Eu4izEmXbIseM9flruhHV5Lk44esBfN/bbv0gULpmH1c3RvcEts9sXFEXeNRBY3nQm5gbNybeZmY/VHe0b1BAZCdY2kowPDA8ds9DHx0EeHvfsBPC7Zd1uj6OFHTTpxS0CusYkW9sybTvFbu5xcokNWP+6r0aVQ5ywkb+8Z+PZOPx5uPHDtsUI+MBjOajh7ZPfDrRIyFbG+unfmK2Nhb6RLEp/WPSDFIOWGBR/ZF2ie+V5kvmepOYn0evAmPGu4b/72caedbMZ7IifIamlYHbdB/OgZMipCy+BnJnOo3h6dOcR/4KFv4V84RSCmRpw7t+TkeCzettth+IPGBc7L5e7cypbKpF8ecynMhL04iL8k2LcZd9+ZfipOYWZOFTuWCO0B7SXVJRZY45LVfp3JmkKcLOn4JNSFhwVVEdQiR+dTlWkT2+XWGVkuzYIkr8iV3nk+/Kte0PhOpgHkIko5TxN/Rh88oeAhpHrjDMiassWJZg 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: Make riscv use the contpte aware get_and_clear_full_ptes()/clear_full_ptes() function from arm64. Signed-off-by: Alexandre Ghiti --- arch/arm64/include/asm/pgtable.h | 41 ++++------------------------ arch/arm64/mm/Makefile | 1 - arch/arm64/mm/contpte.c | 46 ------------------------------- arch/riscv/include/asm/pgtable.h | 39 ++++++++++++++++++++++++++ include/linux/contpte.h | 5 ++++ mm/contpte.c | 47 ++++++++++++++++++++++++++++++++ 6 files changed, 96 insertions(+), 83 deletions(-) delete mode 100644 arch/arm64/mm/contpte.c diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 162efd9647dd..f8a3159f9df0 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1373,17 +1373,6 @@ extern void ptep_modify_prot_commit(struct vm_area_struct *vma, #ifdef CONFIG_THP_CONTPTE -/* - * The contpte APIs are used to transparently manage the contiguous bit in ptes - * where it is possible and makes sense to do so. The PTE_CONT bit is considered - * a private implementation detail of the public ptep API (see below). - */ -extern void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, unsigned int nr, int full); -extern pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm, - unsigned long addr, pte_t *ptep, - unsigned int nr, int full); - #define pte_batch_hint pte_batch_hint static inline unsigned int pte_batch_hint(pte_t *ptep, pte_t pte) { @@ -1428,34 +1417,14 @@ extern void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep); #define pte_clear pte_clear +extern void clear_full_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, unsigned int nr, int full); #define clear_full_ptes clear_full_ptes -static inline void clear_full_ptes(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, unsigned int nr, int full) -{ - if (likely(nr == 1)) { - contpte_try_unfold(mm, addr, ptep, __ptep_get(ptep)); - __clear_full_ptes(mm, addr, ptep, nr, full); - } else { - contpte_clear_full_ptes(mm, addr, ptep, nr, full); - } -} +extern pte_t get_and_clear_full_ptes(struct mm_struct *mm, + unsigned long addr, pte_t *ptep, + unsigned int nr, int full); #define get_and_clear_full_ptes get_and_clear_full_ptes -static inline pte_t get_and_clear_full_ptes(struct mm_struct *mm, - unsigned long addr, pte_t *ptep, - unsigned int nr, int full) -{ - pte_t pte; - - if (likely(nr == 1)) { - contpte_try_unfold(mm, addr, ptep, __ptep_get(ptep)); - pte = __get_and_clear_full_ptes(mm, addr, ptep, nr, full); - } else { - pte = contpte_get_and_clear_full_ptes(mm, addr, ptep, nr, full); - } - - return pte; -} #define __HAVE_ARCH_PTEP_GET_AND_CLEAR extern pte_t ptep_get_and_clear(struct mm_struct *mm, diff --git a/arch/arm64/mm/Makefile b/arch/arm64/mm/Makefile index 52a1b2082627..dbd1bc95967d 100644 --- a/arch/arm64/mm/Makefile +++ b/arch/arm64/mm/Makefile @@ -3,7 +3,6 @@ obj-y := dma-mapping.o extable.o fault.o init.o \ cache.o copypage.o flush.o \ ioremap.o mmap.o pgd.o mmu.o \ context.o proc.o pageattr.o fixmap.o -obj-$(CONFIG_THP_CONTPTE) += contpte.o obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o obj-$(CONFIG_PTDUMP_CORE) += ptdump.o obj-$(CONFIG_PTDUMP_DEBUGFS) += ptdump_debugfs.o diff --git a/arch/arm64/mm/contpte.c b/arch/arm64/mm/contpte.c deleted file mode 100644 index 1cef93b15d6e..000000000000 --- a/arch/arm64/mm/contpte.c +++ /dev/null @@ -1,46 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (C) 2023 ARM Ltd. - */ - -#include -#include -#include -#include - -static void contpte_try_unfold_partial(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, unsigned int nr) -{ - /* - * Unfold any partially covered contpte block at the beginning and end - * of the range. - */ - - if (ptep != arch_contpte_align_down(ptep) || nr < CONT_PTES) - contpte_try_unfold(mm, addr, ptep, __ptep_get(ptep)); - - if (ptep + nr != arch_contpte_align_down(ptep + nr)) { - unsigned long last_addr = addr + PAGE_SIZE * (nr - 1); - pte_t *last_ptep = ptep + nr - 1; - - contpte_try_unfold(mm, last_addr, last_ptep, - __ptep_get(last_ptep)); - } -} - -void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, unsigned int nr, int full) -{ - contpte_try_unfold_partial(mm, addr, ptep, nr); - __clear_full_ptes(mm, addr, ptep, nr, full); -} -EXPORT_SYMBOL_GPL(contpte_clear_full_ptes); - -pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm, - unsigned long addr, pte_t *ptep, - unsigned int nr, int full) -{ - contpte_try_unfold_partial(mm, addr, ptep, nr); - return __get_and_clear_full_ptes(mm, addr, ptep, nr, full); -} -EXPORT_SYMBOL_GPL(contpte_get_and_clear_full_ptes); diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 728f31da5e6a..a4843bdfdb37 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -754,6 +754,37 @@ static inline pte_t __ptep_get_and_clear(struct mm_struct *mm, return pte; } +static inline void __clear_full_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, unsigned int nr, int full) +{ + for (;;) { + __ptep_get_and_clear(mm, addr, ptep); + if (--nr == 0) + break; + ptep++; + addr += PAGE_SIZE; + } +} + +static inline pte_t __get_and_clear_full_ptes(struct mm_struct *mm, + unsigned long addr, pte_t *ptep, + unsigned int nr, int full) +{ + pte_t pte, tmp_pte; + + pte = __ptep_get_and_clear(mm, addr, ptep); + while (--nr) { + ptep++; + addr += PAGE_SIZE; + tmp_pte = __ptep_get_and_clear(mm, addr, ptep); + if (pte_dirty(tmp_pte)) + pte = pte_mkdirty(pte); + if (pte_young(tmp_pte)) + pte = pte_mkyoung(pte); + } + return pte; +} + static inline void __ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep, pte_t pte) @@ -823,6 +854,13 @@ extern void ptep_set_wrprotect(struct mm_struct *mm, extern void wrprotect_ptes(struct mm_struct *mm, unsigned long addr, pte_t *ptep, unsigned int nr); #define wrprotect_ptes wrprotect_ptes +extern void clear_full_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, unsigned int nr, int full); +#define clear_full_ptes clear_full_ptes +extern pte_t get_and_clear_full_ptes(struct mm_struct *mm, + unsigned long addr, pte_t *ptep, + unsigned int nr, int full); +#define get_and_clear_full_ptes get_and_clear_full_ptes #else /* CONFIG_THP_CONTPTE */ @@ -842,6 +880,7 @@ extern void wrprotect_ptes(struct mm_struct *mm, unsigned long addr, #define ptep_set_wrprotect(mm, addr, ptep) \ __ptep_set_wrprotect(mm, addr, ptep, __ptep_get(ptep)) #define wrprotect_ptes __wrprotect_ptes +#define clear_full_ptes __clear_full_ptes #endif /* CONFIG_THP_CONTPTE */ diff --git a/include/linux/contpte.h b/include/linux/contpte.h index d1439db1706c..b24554ebca41 100644 --- a/include/linux/contpte.h +++ b/include/linux/contpte.h @@ -28,5 +28,10 @@ int contpte_ptep_set_access_flags(struct vm_area_struct *vma, pte_t entry, int dirty); void contpte_wrprotect_ptes(struct mm_struct *mm, unsigned long addr, pte_t *ptep, unsigned int nr); +void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, unsigned int nr, int full); +pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm, + unsigned long addr, pte_t *ptep, + unsigned int nr, int full); #endif /* _LINUX_CONTPTE_H */ diff --git a/mm/contpte.c b/mm/contpte.c index fe36b6b1d20a..677344e0e3c3 100644 --- a/mm/contpte.c +++ b/mm/contpte.c @@ -51,6 +51,8 @@ * - ptep_clear_flush_young() * - wrprotect_ptes() * - ptep_set_wrprotect() + * - clear_full_ptes() + * - get_and_clear_full_ptes() */ pte_t huge_ptep_get(pte_t *ptep) @@ -905,4 +907,49 @@ __always_inline void ptep_set_wrprotect(struct mm_struct *mm, { wrprotect_ptes(mm, addr, ptep, 1); } + +void contpte_clear_full_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, unsigned int nr, int full) +{ + contpte_try_unfold_partial(mm, addr, ptep, nr); + __clear_full_ptes(mm, addr, ptep, nr, full); +} +EXPORT_SYMBOL_GPL(contpte_clear_full_ptes); + +pte_t contpte_get_and_clear_full_ptes(struct mm_struct *mm, + unsigned long addr, pte_t *ptep, + unsigned int nr, int full) +{ + contpte_try_unfold_partial(mm, addr, ptep, nr); + return __get_and_clear_full_ptes(mm, addr, ptep, nr, full); +} +EXPORT_SYMBOL_GPL(contpte_get_and_clear_full_ptes); + +__always_inline void clear_full_ptes(struct mm_struct *mm, unsigned long addr, + pte_t *ptep, unsigned int nr, int full) +{ + if (likely(nr == 1)) { + contpte_try_unfold(mm, addr, ptep, __ptep_get(ptep)); + __clear_full_ptes(mm, addr, ptep, nr, full); + } else { + contpte_clear_full_ptes(mm, addr, ptep, nr, full); + } +} + +__always_inline pte_t get_and_clear_full_ptes(struct mm_struct *mm, + unsigned long addr, pte_t *ptep, + unsigned int nr, int full) +{ + pte_t pte; + + if (likely(nr == 1)) { + contpte_try_unfold(mm, addr, ptep, __ptep_get(ptep)); + pte = __get_and_clear_full_ptes(mm, addr, ptep, nr, full); + } else { + pte = contpte_get_and_clear_full_ptes(mm, addr, ptep, nr, full); + } + + return pte; +} + #endif /* CONFIG_THP_CONTPTE */ -- 2.39.2