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 D6DB5C04FFE for ; Wed, 8 May 2024 11:21:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6562D6B013A; Wed, 8 May 2024 07:21:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6066A6B013B; Wed, 8 May 2024 07:21:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A72B6B013C; Wed, 8 May 2024 07:21:44 -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 2E4EF6B013A for ; Wed, 8 May 2024 07:21:44 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D43041A0D75 for ; Wed, 8 May 2024 11:21:43 +0000 (UTC) X-FDA: 82094988486.14.27762E6 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by imf27.hostedemail.com (Postfix) with ESMTP id E42294001C for ; Wed, 8 May 2024 11:21:41 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=CAZMK13b; spf=pass (imf27.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.167.54 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715167302; 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=YO7yDIQr+QJFeAZFjf5GxhWsbGb5WjqA2EGZTufF1Fc=; b=yErFzmu9gOWF6d1hmXn3efJLj9FeF0ah02gCg5WL6236Bji6AUtOicpBbsI9IXSoRe4WnE PQnfe1mQvG8FYUsrF17iOV+MKJL2evRA3EfVtFQenpQ+rHFMkdRPfujvCKa0AQcp3VZIvg 825c8HktSqXuisugivAi/MLELBUTubI= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=CAZMK13b; spf=pass (imf27.hostedemail.com: domain of alexghiti@rivosinc.com designates 209.85.167.54 as permitted sender) smtp.mailfrom=alexghiti@rivosinc.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715167302; a=rsa-sha256; cv=none; b=FvsYprhqWetLfTo0RpIwt/ZFVC2s9dhhE9wbl5aSkAXNWDyf89mCf+PMJ/i1CKM2b4p6+k VtlLvcZfzsiAur5oLZvNY4fdGVHrYglm1IP9EffaVDLsQoMYiG4tWtktRJ12f3daGhTL0V hNyZT6W5aJno5hdh7VjQ/MCaLk2Crw0= Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-51f45104ef0so4603802e87.3 for ; Wed, 08 May 2024 04:21:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1715167300; x=1715772100; 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=YO7yDIQr+QJFeAZFjf5GxhWsbGb5WjqA2EGZTufF1Fc=; b=CAZMK13bC07jAhJcTtUSwXj7Q2x/u2jBc/BIRNcs/xNlTeE6qpWdg+X4eF9UA4s3/c TBJyhSX1HSEg7mNR493rlGtCncezR4hTsU92JrpKt34bnfQ0oBz8UxC17HR5T/gcSoGO OxjPCBMfd7jM3OIg9cBnVzOZGsXmsOp3F3+LpgOJ+Oqu+fC+ZA4bnv/8kARi3HwpSNnF ZC6yWETg1VS4JXpfFi+x8JWRZ/rEGL6xHKlcTek11gtd+slZCZxo+QfJHYzGZ7dNGCuY 2DrCjg+2K2QYpeFLroLuaA02B3ItQ9z1lj8dC5zisg89N4rQYA0k4t9qd6ASlpujWl8F MNJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715167300; x=1715772100; 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=YO7yDIQr+QJFeAZFjf5GxhWsbGb5WjqA2EGZTufF1Fc=; b=SEBWCpfWSZ7zOZXzoqwQCJWeOq2OK/g4d9xk/dNrnKG9S46XByy2zJ+s/Z1OfXhhct kK52NNCBhZ+xWfoDzQEBnUuH/wD5cq5tOA3WyCCeZWME6lX+AJ/2bVR1OCIoMavtFJ7D 0/B6ZEfIwZxbYhrFGS54R0baYqXAgcUNyGobxee/CLEUoNRo1av5cB5zzbFm4e4A8Lkp DeCXTCqzRb2VjP6K1xFQ/pcsP5/60srRj6kYisd6FNIezxoPWoZQguXWrwsdSGGl+Pze hUzzuwDW5zdAn1ie/9cPbZjwCuMJ7AgavG+CIp5l+oOppwLJkR6GKvIzIsGSAcZU5aSk hSKA== X-Forwarded-Encrypted: i=1; AJvYcCUvC7eFAtSPr2pomb0HD2l93lYF5u+eeCNNvpvyPM7bWt+Zo/nG1aZjEny1mNWTHaBWiuuamhQU5MwR1l/y80g0xdA= X-Gm-Message-State: AOJu0YxBMjAn1OFZ/Pxq1vX9I0/bf0a/rimmG/kGqSmpCjxWrC52iAXG mHimh0/arFbkcxitvr9LVXof18MDzTmlVc9xlZiFFMKFUyCj+CTk4G3yT2Savnc= X-Google-Smtp-Source: AGHT+IGlIF5qrXIZLx6k07SYUl4uhRcj6nfG/t1miugJV1fwoSAC2HF4MbIjFtO5Wp6+YeTrOF+Wmg== X-Received: by 2002:a05:6512:3ba6:b0:520:dc1c:3c5d with SMTP id 2adb3069b0e04-5217cc458a8mr1935422e87.42.1715167300050; Wed, 08 May 2024 04:21:40 -0700 (PDT) Received: from localhost.localdomain (amontpellier-656-1-456-62.w92-145.abo.wanadoo.fr. [92.145.124.62]) by smtp.gmail.com with ESMTPSA id h4-20020adff4c4000000b0034cee43238fsm15052972wrp.27.2024.05.08.04.21.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 04:21:39 -0700 (PDT) From: Alexandre Ghiti To: Catalin Marinas , Will Deacon , Ryan Roberts , Mark Rutland , Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Morton , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-mm@kvack.org Cc: Alexandre Ghiti Subject: [PATCH v2 3/9] mm: Use common huge_ptep_get() function for riscv/arm64 Date: Wed, 8 May 2024 13:18:23 +0200 Message-Id: <20240508111829.16891-4-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240508111829.16891-1-alexghiti@rivosinc.com> References: <20240508111829.16891-1-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: b1xg7kythfbm7wi79qaafcsjcj9ibn3g X-Rspam-User: X-Rspamd-Queue-Id: E42294001C X-Rspamd-Server: rspam05 X-HE-Tag: 1715167301-892774 X-HE-Meta: U2FsdGVkX1/dYud8IbStudpcJZXe2lE/I2TTNSyAW1pZOYGygfugUxUjj8Xr1FLnAl97Tyv5RtSVCVFYIie1ol5JceAbeFqCLq4UG7m7Dr/7+DIkzZEuzYPT5JpjQ2VI1/RqxFNmYuHvtoMCEYkNFWZI51y1HLHCguol/Ms9bAV6BxRSxLLi/DlJPF0kdcLdc8kubALWhTzoLcPsE+5Gv48NK8OwQ0E9UthumqHObV9N36vYxyd74sIW7ouFqkx2saUL48xzHuIs2EvYgcRP0/2jJeBr5C4nztW8TD3RYb9m16Hg4eWwCHKmo6zGoYrf26ZBceAqEF9mpCSsuP64d4eu7fr0VvI2QwECpx6ZWM2qTfXZcPLqKqUeoWtl+hdvYIlXne1JXwleDjtYAh4AQG/D++nHJhAyRe+G+VCJcPi8XnabBupvU82i/L7GgBSOiOFIQSJa+q0Xkcdfxtc8FCoSi75nsOM2xrIrnHjXpINNn06ErkJVhd1qzd00S89j2B9/EnjeqI7OyuqB1pbOsYNNYQDQycIHEa2LUbknQjT0KTkOBPnBGr0lrTvOVO9Jy6yQyjfjDeBEZIXEi5AciSAR5OPFMzReYbfirc62Mu/vvKu1KA1iuKu9kNIQJsYzqxgly+ylmF3QfvPSsYqV3/FCbAn2tAmGV03xRpXi6/nzek/TFQZjq+CgzgVeH4nU9B02XbQKXSIu1VI2qznyHPE5aL3H0UNS9ghdW0VYBLve6Kt07zspSaLCj0vYHGHjM6jpUkCCbURku0wTw9WD6qolCVwemAPRyLXxA51Wv9reC1dlvc5CTW4oImYYSH37gGsvRxn3tCd3Xv1PVsuOOr0IGnjEbio5oceuBJGXxDeAC82ngPXlwwLGG8gPa4ffBUrcMFaJ/MUshd2yf5xbdzjT8QDOKCNngEBfXtwgI9WVgcwdp7VwI5dyPedATbH5/lEdsx6pd/5UZ1EvvN1 ey5fpLOx 2+eEFA+ycuR6uULDYjl+P/iE7d8Vbce4nVVV1g+S7OJGJBxvI6e8VjUXMEABB8OGu3o2VWjeWhd4804EEZRnKaALn0NGZoQZbV0GLqtUFuAbeqD401QIHskQTpFsrqsShKl4kC/n0clJHv8/lpKSEBCnMXXI77PmSFuq3FQ8eHy8kAIllqsoECdFXopRbBR9FKGhsTq9QxNqr/T9NHRM4UkPsGmtg2I/V2QNJZUR1NorKADHe7NhCemiOfdVUcBNIpVxkSqax/5K2wb3VeGfJ5ulRKfGBSDsx1D4j9X1apIpJarBYxN4jqmMVznnLlSiQc8Ej39Q6y/gO2dR82dU95vvbc/lujKFLFUDoPPaIcylvauUoG5f0lvg/dQRdU57k5CENemYxLkIHeFCeF5xb9ZddemenFousGrua6ASaUMWTLVMqvBp6l1Ig4TSMRSHfua5w2DixqpdBgAuFr2224BkbkNw1RiWfhfyHZnH26G4Fimk05gkjKvwmTA== 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: For that, we need to introduce: - a new config: ARCH_HAS_CONTPTE, - a new arch specific function which returns the number of contiguous PTE in a mapping and its base page size, - a pte_cont() helper, only introduced for riscv since we keep the arm64 naming (contpte) which is more explicit than the riscv's (napot). Signed-off-by: Alexandre Ghiti --- arch/arm64/Kconfig | 1 + arch/arm64/include/asm/pgtable.h | 30 +++++++++++++++++ arch/arm64/mm/hugetlbpage.c | 55 ++------------------------------ arch/riscv/Kconfig | 1 + arch/riscv/include/asm/hugetlb.h | 2 +- arch/riscv/include/asm/pgtable.h | 6 ++-- arch/riscv/mm/hugetlbpage.c | 24 -------------- mm/Kconfig | 3 ++ mm/Makefile | 1 + mm/contpte.c | 45 ++++++++++++++++++++++++++ 10 files changed, 88 insertions(+), 80 deletions(-) create mode 100644 mm/contpte.c diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7b11c98b3e84..ac2f6d906cc3 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -20,6 +20,7 @@ config ARM64 select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE select ARCH_HAS_CACHE_LINE_SIZE + select ARCH_HAS_CONTPTE select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL select ARCH_HAS_DEBUG_VM_PGTABLE diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index afdd56d26ad7..e30149a128f2 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -1638,6 +1638,36 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma, #endif /* CONFIG_ARM64_CONTPTE */ +static inline int arch_contpte_get_num_contig(pte_t *ptep, unsigned long size, + size_t *pgsize) +{ + int contig_ptes = 0; + + *pgsize = size; + + switch (size) { +#ifndef __PAGETABLE_PMD_FOLDED + case PUD_SIZE: + if (pud_sect_supported()) + contig_ptes = 1; + break; +#endif + case PMD_SIZE: + contig_ptes = 1; + break; + case CONT_PMD_SIZE: + *pgsize = PMD_SIZE; + contig_ptes = CONT_PMDS; + break; + case CONT_PTE_SIZE: + *pgsize = PAGE_SIZE; + contig_ptes = CONT_PTES; + break; + } + + return contig_ptes; +} + #endif /* !__ASSEMBLY__ */ #endif /* __ASM_PGTABLE_H */ diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index 0f0e10bb0a95..9e9c80ec6e74 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -112,57 +112,6 @@ static int find_num_contig(struct mm_struct *mm, unsigned long addr, return CONT_PTES; } -static inline int num_contig_ptes(unsigned long size, size_t *pgsize) -{ - int contig_ptes = 0; - - *pgsize = size; - - switch (size) { -#ifndef __PAGETABLE_PMD_FOLDED - case PUD_SIZE: - if (pud_sect_supported()) - contig_ptes = 1; - break; -#endif - case PMD_SIZE: - contig_ptes = 1; - break; - case CONT_PMD_SIZE: - *pgsize = PMD_SIZE; - contig_ptes = CONT_PMDS; - break; - case CONT_PTE_SIZE: - *pgsize = PAGE_SIZE; - contig_ptes = CONT_PTES; - break; - } - - return contig_ptes; -} - -pte_t huge_ptep_get(pte_t *ptep) -{ - int ncontig, i; - size_t pgsize; - pte_t orig_pte = __ptep_get(ptep); - - if (!pte_present(orig_pte) || !pte_cont(orig_pte)) - return orig_pte; - - ncontig = num_contig_ptes(page_size(pte_page(orig_pte)), &pgsize); - for (i = 0; i < ncontig; i++, ptep++) { - pte_t pte = __ptep_get(ptep); - - if (pte_dirty(pte)) - orig_pte = pte_mkdirty(orig_pte); - - if (pte_young(pte)) - orig_pte = pte_mkyoung(orig_pte); - } - return orig_pte; -} - /* * Changing some bits of contiguous entries requires us to follow a * Break-Before-Make approach, breaking the whole contiguous set @@ -243,7 +192,7 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, unsigned long pfn, dpfn; pgprot_t hugeprot; - ncontig = num_contig_ptes(sz, &pgsize); + ncontig = arch_contpte_get_num_contig(ptep, sz, &pgsize); if (!pte_present(pte)) { for (i = 0; i < ncontig; i++, ptep++, addr += pgsize) @@ -390,7 +339,7 @@ void huge_pte_clear(struct mm_struct *mm, unsigned long addr, int i, ncontig; size_t pgsize; - ncontig = num_contig_ptes(sz, &pgsize); + ncontig = arch_contpte_get_num_contig(ptep, sz, &pgsize); for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) __pte_clear(mm, addr, ptep); diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 8a0f403432e8..38d93cf44456 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -19,6 +19,7 @@ config RISCV select ARCH_ENABLE_SPLIT_PMD_PTLOCK if PGTABLE_LEVELS > 2 select ARCH_ENABLE_THP_MIGRATION if TRANSPARENT_HUGEPAGE select ARCH_HAS_BINFMT_FLAT + select ARCH_HAS_CONTPTE if RISCV_ISA_SVNAPOT select ARCH_HAS_CURRENT_STACK_POINTER select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DEBUG_VM_PGTABLE diff --git a/arch/riscv/include/asm/hugetlb.h b/arch/riscv/include/asm/hugetlb.h index 22deb7a2a6ec..f195f611722b 100644 --- a/arch/riscv/include/asm/hugetlb.h +++ b/arch/riscv/include/asm/hugetlb.h @@ -49,7 +49,7 @@ pte_t huge_ptep_get(pte_t *ptep); pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, vm_flags_t flags); #define arch_make_huge_pte arch_make_huge_pte -#endif /*CONFIG_RISCV_ISA_SVNAPOT*/ +#endif /* CONFIG_RISCV_ISA_SVNAPOT */ #include diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 268c828f5152..66061002ff36 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -296,6 +296,7 @@ static inline unsigned long pte_napot(pte_t pte) { return pte_val(pte) & _PAGE_NAPOT; } +#define pte_cont pte_napot #define pte_valid_napot(pte) (pte_present(pte) && pte_napot(pte)) @@ -560,7 +561,7 @@ static inline int arch_contpte_get_num_contig(pte_t *ptep, unsigned long size, } #endif -static inline pte_t ptep_get(pte_t *ptep) +static inline pte_t __ptep_get(pte_t *ptep) { pte_t pte = READ_ONCE(*ptep); @@ -584,7 +585,6 @@ static inline pte_t ptep_get(pte_t *ptep) return pte; } -#define ptep_get ptep_get static inline void set_ptes(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pteval, unsigned int nr) @@ -686,6 +686,8 @@ static inline int ptep_clear_flush_young(struct vm_area_struct *vma, return ptep_test_and_clear_young(vma, address, ptep); } +#define ptep_get __ptep_get + #define pgprot_nx pgprot_nx static inline pgprot_t pgprot_nx(pgprot_t _prot) { diff --git a/arch/riscv/mm/hugetlbpage.c b/arch/riscv/mm/hugetlbpage.c index f042f5c8bdb7..be129f4f1503 100644 --- a/arch/riscv/mm/hugetlbpage.c +++ b/arch/riscv/mm/hugetlbpage.c @@ -3,30 +3,6 @@ #include #ifdef CONFIG_RISCV_ISA_SVNAPOT -pte_t huge_ptep_get(pte_t *ptep) -{ - unsigned long pte_num; - int i; - pte_t orig_pte = ptep_get(ptep); - - if (!pte_present(orig_pte) || !pte_napot(orig_pte)) - return orig_pte; - - pte_num = napot_pte_num(napot_cont_order(orig_pte)); - - for (i = 0; i < pte_num; i++, ptep++) { - pte_t pte = ptep_get(ptep); - - if (pte_dirty(pte)) - orig_pte = pte_mkdirty(orig_pte); - - if (pte_young(pte)) - orig_pte = pte_mkyoung(orig_pte); - } - - return orig_pte; -} - pte_t *huge_pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, diff --git a/mm/Kconfig b/mm/Kconfig index b1448aa81e15..c325003d6552 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -981,6 +981,9 @@ config ARCH_HAS_CPU_CACHE_ALIASING config ARCH_HAS_CACHE_LINE_SIZE bool +config ARCH_HAS_CONTPTE + bool + config ARCH_HAS_CURRENT_STACK_POINTER bool help diff --git a/mm/Makefile b/mm/Makefile index 4abb40b911ec..605ead58403b 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -89,6 +89,7 @@ obj-$(CONFIG_MIGRATION) += migrate.o obj-$(CONFIG_NUMA) += memory-tiers.o obj-$(CONFIG_DEVICE_MIGRATION) += migrate_device.o obj-$(CONFIG_TRANSPARENT_HUGEPAGE) += huge_memory.o khugepaged.o +obj-$(CONFIG_ARCH_HAS_CONTPTE) += contpte.o obj-$(CONFIG_PAGE_COUNTER) += page_counter.o obj-$(CONFIG_MEMCG) += memcontrol.o vmpressure.o ifdef CONFIG_SWAP diff --git a/mm/contpte.c b/mm/contpte.c new file mode 100644 index 000000000000..e8574051d0b9 --- /dev/null +++ b/mm/contpte.c @@ -0,0 +1,45 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2024 Rivos Inc. + */ + +#include +#include +#include + +/* + * Any arch that wants to use that needs to define: + * - __ptep_get() + * - pte_cont() + * - arch_contpte_get_num_contig() + */ + +/* + * This file implements the following contpte aware API: + * - huge_ptep_get() + */ + +pte_t huge_ptep_get(pte_t *ptep) +{ + int ncontig, i; + size_t pgsize; + pte_t orig_pte = __ptep_get(ptep); + + if (!pte_present(orig_pte) || !pte_cont(orig_pte)) + return orig_pte; + + ncontig = arch_contpte_get_num_contig(ptep, + page_size(pte_page(orig_pte)), + &pgsize); + + for (i = 0; i < ncontig; i++, ptep++) { + pte_t pte = __ptep_get(ptep); + + if (pte_dirty(pte)) + orig_pte = pte_mkdirty(orig_pte); + + if (pte_young(pte)) + orig_pte = pte_mkyoung(orig_pte); + } + return orig_pte; +} -- 2.39.2