2 * PPC Huge TLB Page Support for Kernel.
4 * Copyright (C) 2003 David Gibson, IBM Corporation.
5 * Copyright (C) 2011 Becky Bruce, Freescale Semiconductor
7 * Based on the IA-32 version:
13 #include <linux/slab.h>
14 #include <linux/hugetlb.h>
15 #include <linux/export.h>
16 #include <linux/of_fdt.h>
17 #include <linux/memblock.h>
18 #include <linux/moduleparam.h>
19 #include <linux/swap.h>
20 #include <linux/swapops.h>
21 #include <linux/kmemleak.h>
22 #include <asm/pgtable.h>
23 #include <asm/pgalloc.h>
25 #include <asm/setup.h>
26 #include <asm/hugetlb.h>
27 #include <asm/pte-walk.h>
30 #ifdef CONFIG_HUGETLB_PAGE
32 #define PAGE_SHIFT_64K 16
33 #define PAGE_SHIFT_512K 19
34 #define PAGE_SHIFT_8M 23
35 #define PAGE_SHIFT_16M 24
36 #define PAGE_SHIFT_16G 34
38 bool hugetlb_disabled = false;
40 unsigned int HPAGE_SHIFT;
41 EXPORT_SYMBOL(HPAGE_SHIFT);
43 #define hugepd_none(hpd) (hpd_val(hpd) == 0)
45 #define PTE_T_ORDER (__builtin_ffs(sizeof(pte_t)) - __builtin_ffs(sizeof(void *)))
47 pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, unsigned long sz)
50 * Only called for hugetlbfs pages, hence can ignore THP and the
53 return __find_linux_pte(mm->pgd, addr, NULL, NULL);
56 static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
57 unsigned long address, unsigned int pdshift,
58 unsigned int pshift, spinlock_t *ptl)
60 struct kmem_cache *cachep;
65 if (pshift >= pdshift) {
66 cachep = PGT_CACHE(PTE_T_ORDER);
67 num_hugepd = 1 << (pshift - pdshift);
68 } else if (IS_ENABLED(CONFIG_PPC_8xx)) {
69 cachep = PGT_CACHE(PTE_INDEX_SIZE);
72 cachep = PGT_CACHE(pdshift - pshift);
76 new = kmem_cache_alloc(cachep, pgtable_gfp_flags(mm, GFP_KERNEL));
78 BUG_ON(pshift > HUGEPD_SHIFT_MASK);
79 BUG_ON((unsigned long)new & HUGEPD_SHIFT_MASK);
85 * Make sure other cpus find the hugepd set only after a
86 * properly initialized page table is visible to them.
87 * For more details look for comment in __pte_alloc().
93 * We have multiple higher-level entries that point to the same
94 * actual pte location. Fill in each as we go and backtrack on error.
95 * We need all of these so the DTLB pgtable walk code can find the
96 * right higher-level entry without knowing if it's a hugepage or not.
98 for (i = 0; i < num_hugepd; i++, hpdp++) {
99 if (unlikely(!hugepd_none(*hpdp)))
102 #ifdef CONFIG_PPC_BOOK3S_64
103 *hpdp = __hugepd(__pa(new) | HUGEPD_VAL_BITS |
104 (shift_to_mmu_psize(pshift) << 2));
105 #elif defined(CONFIG_PPC_8xx)
106 *hpdp = __hugepd(__pa(new) | _PMD_USER |
107 (pshift == PAGE_SHIFT_8M ? _PMD_PAGE_8M :
108 _PMD_PAGE_512K) | _PMD_PRESENT);
110 /* We use the old format for PPC_FSL_BOOK3E */
111 *hpdp = __hugepd(((unsigned long)new & ~PD_HUGE) | pshift);
115 /* If we bailed from the for loop early, an error occurred, clean up */
116 if (i < num_hugepd) {
117 for (i = i - 1 ; i >= 0; i--, hpdp--)
119 kmem_cache_free(cachep, new);
121 kmemleak_ignore(new);
128 * At this point we do the placement change only for BOOK3S 64. This would
129 * possibly work on other subarchs.
131 pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz)
136 hugepd_t *hpdp = NULL;
137 unsigned pshift = __ffs(sz);
138 unsigned pdshift = PGDIR_SHIFT;
142 pg = pgd_offset(mm, addr);
144 #ifdef CONFIG_PPC_BOOK3S_64
145 if (pshift == PGDIR_SHIFT)
148 else if (pshift > PUD_SHIFT) {
150 * We need to use hugepd table
152 ptl = &mm->page_table_lock;
153 hpdp = (hugepd_t *)pg;
156 pu = pud_alloc(mm, pg, addr);
157 if (pshift == PUD_SHIFT)
159 else if (pshift > PMD_SHIFT) {
160 ptl = pud_lockptr(mm, pu);
161 hpdp = (hugepd_t *)pu;
164 pm = pmd_alloc(mm, pu, addr);
165 if (pshift == PMD_SHIFT)
169 ptl = pmd_lockptr(mm, pm);
170 hpdp = (hugepd_t *)pm;
175 if (pshift >= PGDIR_SHIFT) {
176 ptl = &mm->page_table_lock;
177 hpdp = (hugepd_t *)pg;
180 pu = pud_alloc(mm, pg, addr);
181 if (pshift >= PUD_SHIFT) {
182 ptl = pud_lockptr(mm, pu);
183 hpdp = (hugepd_t *)pu;
186 pm = pmd_alloc(mm, pu, addr);
187 ptl = pmd_lockptr(mm, pm);
188 hpdp = (hugepd_t *)pm;
195 BUG_ON(!hugepd_none(*hpdp) && !hugepd_ok(*hpdp));
197 if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr,
198 pdshift, pshift, ptl))
201 return hugepte_offset(*hpdp, addr, pdshift);
204 #ifdef CONFIG_PPC_BOOK3S_64
206 * Tracks gpages after the device tree is scanned and before the
207 * huge_boot_pages list is ready on pseries.
209 #define MAX_NUMBER_GPAGES 1024
210 __initdata static u64 gpage_freearray[MAX_NUMBER_GPAGES];
211 __initdata static unsigned nr_gpages;
214 * Build list of addresses of gigantic pages. This function is used in early
215 * boot before the buddy allocator is setup.
217 void __init pseries_add_gpage(u64 addr, u64 page_size, unsigned long number_of_pages)
221 while (number_of_pages > 0) {
222 gpage_freearray[nr_gpages] = addr;
229 int __init pseries_alloc_bootmem_huge_page(struct hstate *hstate)
231 struct huge_bootmem_page *m;
234 m = phys_to_virt(gpage_freearray[--nr_gpages]);
235 gpage_freearray[nr_gpages] = 0;
236 list_add(&m->list, &huge_boot_pages);
243 int __init alloc_bootmem_huge_page(struct hstate *h)
246 #ifdef CONFIG_PPC_BOOK3S_64
247 if (firmware_has_feature(FW_FEATURE_LPAR) && !radix_enabled())
248 return pseries_alloc_bootmem_huge_page(h);
250 return __alloc_bootmem_huge_page(h);
253 #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx)
254 #define HUGEPD_FREELIST_SIZE \
255 ((PAGE_SIZE - sizeof(struct hugepd_freelist)) / sizeof(pte_t))
257 struct hugepd_freelist {
263 static DEFINE_PER_CPU(struct hugepd_freelist *, hugepd_freelist_cur);
265 static void hugepd_free_rcu_callback(struct rcu_head *head)
267 struct hugepd_freelist *batch =
268 container_of(head, struct hugepd_freelist, rcu);
271 for (i = 0; i < batch->index; i++)
272 kmem_cache_free(PGT_CACHE(PTE_T_ORDER), batch->ptes[i]);
274 free_page((unsigned long)batch);
277 static void hugepd_free(struct mmu_gather *tlb, void *hugepte)
279 struct hugepd_freelist **batchp;
281 batchp = &get_cpu_var(hugepd_freelist_cur);
283 if (atomic_read(&tlb->mm->mm_users) < 2 ||
284 mm_is_thread_local(tlb->mm)) {
285 kmem_cache_free(PGT_CACHE(PTE_T_ORDER), hugepte);
286 put_cpu_var(hugepd_freelist_cur);
290 if (*batchp == NULL) {
291 *batchp = (struct hugepd_freelist *)__get_free_page(GFP_ATOMIC);
292 (*batchp)->index = 0;
295 (*batchp)->ptes[(*batchp)->index++] = hugepte;
296 if ((*batchp)->index == HUGEPD_FREELIST_SIZE) {
297 call_rcu(&(*batchp)->rcu, hugepd_free_rcu_callback);
300 put_cpu_var(hugepd_freelist_cur);
303 static inline void hugepd_free(struct mmu_gather *tlb, void *hugepte) {}
306 static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshift,
307 unsigned long start, unsigned long end,
308 unsigned long floor, unsigned long ceiling)
310 pte_t *hugepte = hugepd_page(*hpdp);
313 unsigned long pdmask = ~((1UL << pdshift) - 1);
314 unsigned int num_hugepd = 1;
315 unsigned int shift = hugepd_shift(*hpdp);
317 /* Note: On fsl the hpdp may be the first of several */
319 num_hugepd = 1 << (shift - pdshift);
329 if (end - 1 > ceiling - 1)
332 for (i = 0; i < num_hugepd; i++, hpdp++)
335 if (shift >= pdshift)
336 hugepd_free(tlb, hugepte);
337 else if (IS_ENABLED(CONFIG_PPC_8xx))
338 pgtable_free_tlb(tlb, hugepte,
339 get_hugepd_cache_index(PTE_INDEX_SIZE));
341 pgtable_free_tlb(tlb, hugepte,
342 get_hugepd_cache_index(pdshift - shift));
345 static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
346 unsigned long addr, unsigned long end,
347 unsigned long floor, unsigned long ceiling)
357 pmd = pmd_offset(pud, addr);
358 next = pmd_addr_end(addr, end);
359 if (!is_hugepd(__hugepd(pmd_val(*pmd)))) {
361 * if it is not hugepd pointer, we should already find
364 WARN_ON(!pmd_none_or_clear_bad(pmd));
368 * Increment next by the size of the huge mapping since
369 * there may be more than one entry at this level for a
370 * single hugepage, but all of them point to
371 * the same kmem cache that holds the hugepte.
373 more = addr + (1 << hugepd_shift(*(hugepd_t *)pmd));
377 free_hugepd_range(tlb, (hugepd_t *)pmd, PMD_SHIFT,
378 addr, next, floor, ceiling);
379 } while (addr = next, addr != end);
389 if (end - 1 > ceiling - 1)
392 pmd = pmd_offset(pud, start);
394 pmd_free_tlb(tlb, pmd, start);
395 mm_dec_nr_pmds(tlb->mm);
398 static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
399 unsigned long addr, unsigned long end,
400 unsigned long floor, unsigned long ceiling)
408 pud = pud_offset(pgd, addr);
409 next = pud_addr_end(addr, end);
410 if (!is_hugepd(__hugepd(pud_val(*pud)))) {
411 if (pud_none_or_clear_bad(pud))
413 hugetlb_free_pmd_range(tlb, pud, addr, next, floor,
418 * Increment next by the size of the huge mapping since
419 * there may be more than one entry at this level for a
420 * single hugepage, but all of them point to
421 * the same kmem cache that holds the hugepte.
423 more = addr + (1 << hugepd_shift(*(hugepd_t *)pud));
427 free_hugepd_range(tlb, (hugepd_t *)pud, PUD_SHIFT,
428 addr, next, floor, ceiling);
430 } while (addr = next, addr != end);
436 ceiling &= PGDIR_MASK;
440 if (end - 1 > ceiling - 1)
443 pud = pud_offset(pgd, start);
445 pud_free_tlb(tlb, pud, start);
446 mm_dec_nr_puds(tlb->mm);
450 * This function frees user-level page tables of a process.
452 void hugetlb_free_pgd_range(struct mmu_gather *tlb,
453 unsigned long addr, unsigned long end,
454 unsigned long floor, unsigned long ceiling)
460 * Because there are a number of different possible pagetable
461 * layouts for hugepage ranges, we limit knowledge of how
462 * things should be laid out to the allocation path
463 * (huge_pte_alloc(), above). Everything else works out the
464 * structure as it goes from information in the hugepd
465 * pointers. That means that we can't here use the
466 * optimization used in the normal page free_pgd_range(), of
467 * checking whether we're actually covering a large enough
468 * range to have to do anything at the top level of the walk
469 * instead of at the bottom.
471 * To make sense of this, you should probably go read the big
472 * block comment at the top of the normal free_pgd_range(),
477 next = pgd_addr_end(addr, end);
478 pgd = pgd_offset(tlb->mm, addr);
479 if (!is_hugepd(__hugepd(pgd_val(*pgd)))) {
480 if (pgd_none_or_clear_bad(pgd))
482 hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling);
486 * Increment next by the size of the huge mapping since
487 * there may be more than one entry at the pgd level
488 * for a single hugepage, but all of them point to the
489 * same kmem cache that holds the hugepte.
491 more = addr + (1 << hugepd_shift(*(hugepd_t *)pgd));
495 free_hugepd_range(tlb, (hugepd_t *)pgd, PGDIR_SHIFT,
496 addr, next, floor, ceiling);
498 } while (addr = next, addr != end);
501 struct page *follow_huge_pd(struct vm_area_struct *vma,
502 unsigned long address, hugepd_t hpd,
503 int flags, int pdshift)
507 struct page *page = NULL;
509 int shift = hugepd_shift(hpd);
510 struct mm_struct *mm = vma->vm_mm;
514 * hugepage directory entries are protected by mm->page_table_lock
515 * Use this instead of huge_pte_lockptr
517 ptl = &mm->page_table_lock;
520 ptep = hugepte_offset(hpd, address, pdshift);
521 if (pte_present(*ptep)) {
522 mask = (1UL << shift) - 1;
523 page = pte_page(*ptep);
524 page += ((address & mask) >> PAGE_SHIFT);
525 if (flags & FOLL_GET)
528 if (is_hugetlb_entry_migration(*ptep)) {
530 __migration_entry_wait(mm, ptep, ptl);
538 static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end,
541 unsigned long __boundary = (addr + sz) & ~(sz-1);
542 return (__boundary - 1 < end - 1) ? __boundary : end;
545 int gup_huge_pd(hugepd_t hugepd, unsigned long addr, unsigned pdshift,
546 unsigned long end, int write, struct page **pages, int *nr)
549 unsigned long sz = 1UL << hugepd_shift(hugepd);
552 ptep = hugepte_offset(hugepd, addr, pdshift);
554 next = hugepte_addr_end(addr, end, sz);
555 if (!gup_hugepte(ptep, sz, addr, end, write, pages, nr))
557 } while (ptep++, addr = next, addr != end);
562 #ifdef CONFIG_PPC_MM_SLICES
563 unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
564 unsigned long len, unsigned long pgoff,
567 struct hstate *hstate = hstate_file(file);
568 int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate));
570 #ifdef CONFIG_PPC_RADIX_MMU
572 return radix__hugetlb_get_unmapped_area(file, addr, len,
575 return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1);
579 unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
581 #ifdef CONFIG_PPC_MM_SLICES
582 /* With radix we don't use slice, so derive it from vma*/
583 if (!radix_enabled()) {
584 unsigned int psize = get_slice_psize(vma->vm_mm, vma->vm_start);
586 return 1UL << mmu_psize_to_shift(psize);
589 return vma_kernel_pagesize(vma);
592 static inline bool is_power_of_4(unsigned long x)
594 if (is_power_of_2(x))
595 return (__ilog2(x) % 2) ? false : true;
599 static int __init add_huge_page_size(unsigned long long size)
601 int shift = __ffs(size);
604 /* Check that it is a page size supported by the hardware and
605 * that it fits within pagetable and slice limits. */
606 if (size <= PAGE_SIZE)
608 #if defined(CONFIG_PPC_FSL_BOOK3E)
609 if (!is_power_of_4(size))
611 #elif !defined(CONFIG_PPC_8xx)
612 if (!is_power_of_2(size) || (shift > SLICE_HIGH_SHIFT))
616 if ((mmu_psize = shift_to_mmu_psize(shift)) < 0)
619 #ifdef CONFIG_PPC_BOOK3S_64
621 * We need to make sure that for different page sizes reported by
622 * firmware we only add hugetlb support for page sizes that can be
623 * supported by linux page table layout.
628 if (radix_enabled()) {
629 if (mmu_psize != MMU_PAGE_2M && mmu_psize != MMU_PAGE_1G)
632 if (mmu_psize != MMU_PAGE_16M && mmu_psize != MMU_PAGE_16G)
637 BUG_ON(mmu_psize_defs[mmu_psize].shift != shift);
639 /* Return if huge page size has already been setup */
640 if (size_to_hstate(size))
643 hugetlb_add_hstate(shift - PAGE_SHIFT);
648 static int __init hugepage_setup_sz(char *str)
650 unsigned long long size;
652 size = memparse(str, &str);
654 if (add_huge_page_size(size) != 0) {
656 pr_err("Invalid huge page size specified(%llu)\n", size);
661 __setup("hugepagesz=", hugepage_setup_sz);
663 static int __init hugetlbpage_init(void)
667 if (hugetlb_disabled) {
668 pr_info("HugeTLB support is disabled!\n");
672 #if !defined(CONFIG_PPC_FSL_BOOK3E) && !defined(CONFIG_PPC_8xx)
673 if (!radix_enabled() && !mmu_has_feature(MMU_FTR_16M_PAGE))
676 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
680 if (!mmu_psize_defs[psize].shift)
683 shift = mmu_psize_to_shift(psize);
685 #ifdef CONFIG_PPC_BOOK3S_64
686 if (shift > PGDIR_SHIFT)
688 else if (shift > PUD_SHIFT)
689 pdshift = PGDIR_SHIFT;
690 else if (shift > PMD_SHIFT)
695 if (shift < PUD_SHIFT)
697 else if (shift < PGDIR_SHIFT)
700 pdshift = PGDIR_SHIFT;
703 if (add_huge_page_size(1ULL << shift) < 0)
706 * if we have pdshift and shift value same, we don't
707 * use pgt cache for hugepd.
709 if (pdshift > shift && IS_ENABLED(CONFIG_PPC_8xx))
710 pgtable_cache_add(PTE_INDEX_SIZE);
711 else if (pdshift > shift)
712 pgtable_cache_add(pdshift - shift);
713 #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx)
715 pgtable_cache_add(PTE_T_ORDER);
719 #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_8xx)
720 /* Default hpage size = 4M on FSL_BOOK3E and 512k on 8xx */
721 if (mmu_psize_defs[MMU_PAGE_4M].shift)
722 HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_4M].shift;
723 else if (mmu_psize_defs[MMU_PAGE_512K].shift)
724 HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_512K].shift;
726 /* Set default large page size. Currently, we pick 16M or 1M
727 * depending on what is available
729 if (mmu_psize_defs[MMU_PAGE_16M].shift)
730 HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_16M].shift;
731 else if (mmu_psize_defs[MMU_PAGE_1M].shift)
732 HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_1M].shift;
733 else if (mmu_psize_defs[MMU_PAGE_2M].shift)
734 HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_2M].shift;
739 arch_initcall(hugetlbpage_init);
741 void flush_dcache_icache_hugepage(struct page *page)
746 BUG_ON(!PageCompound(page));
748 for (i = 0; i < (1UL << compound_order(page)); i++) {
749 if (!PageHighMem(page)) {
750 __flush_dcache_icache(page_address(page+i));
752 start = kmap_atomic(page+i);
753 __flush_dcache_icache(start);
754 kunmap_atomic(start);
759 #endif /* CONFIG_HUGETLB_PAGE */
762 * We have 4 cases for pgds and pmds:
763 * (1) invalid (all zeroes)
764 * (2) pointer to next table, as normal; bottom 6 bits == 0
765 * (3) leaf pte for huge page _PAGE_PTE set
766 * (4) hugepd pointer, _PAGE_PTE = 0 and bits [2..6] indicate size of table
768 * So long as we atomically load page table pointers we are safe against teardown,
769 * we can follow the address down to the the page and take a ref on it.
770 * This function need to be called with interrupts disabled. We use this variant
771 * when we have MSR[EE] = 0 but the paca->irq_soft_mask = IRQS_ENABLED
773 pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea,
774 bool *is_thp, unsigned *hpage_shift)
780 hugepd_t *hpdp = NULL;
781 unsigned pdshift = PGDIR_SHIFT;
789 pgdp = pgdir + pgd_index(ea);
790 pgd = READ_ONCE(*pgdp);
792 * Always operate on the local stack value. This make sure the
793 * value don't get updated by a parallel THP split/collapse,
794 * page fault or a page unmap. The return pte_t * is still not
795 * stable. So should be checked there for above conditions.
799 else if (pgd_huge(pgd)) {
800 ret_pte = (pte_t *) pgdp;
802 } else if (is_hugepd(__hugepd(pgd_val(pgd))))
803 hpdp = (hugepd_t *)&pgd;
806 * Even if we end up with an unmap, the pgtable will not
807 * be freed, because we do an rcu free and here we are
811 pudp = pud_offset(&pgd, ea);
812 pud = READ_ONCE(*pudp);
816 else if (pud_huge(pud)) {
817 ret_pte = (pte_t *) pudp;
819 } else if (is_hugepd(__hugepd(pud_val(pud))))
820 hpdp = (hugepd_t *)&pud;
823 pmdp = pmd_offset(&pud, ea);
824 pmd = READ_ONCE(*pmdp);
826 * A hugepage collapse is captured by pmd_none, because
827 * it mark the pmd none and do a hpte invalidate.
832 if (pmd_trans_huge(pmd) || pmd_devmap(pmd)) {
835 ret_pte = (pte_t *) pmdp;
839 * pmd_large check below will handle the swap pmd pte
840 * we need to do both the check because they are config
843 if (pmd_huge(pmd) || pmd_large(pmd)) {
844 ret_pte = (pte_t *) pmdp;
846 } else if (is_hugepd(__hugepd(pmd_val(pmd))))
847 hpdp = (hugepd_t *)&pmd;
849 return pte_offset_kernel(&pmd, ea);
855 ret_pte = hugepte_offset(*hpdp, ea, pdshift);
856 pdshift = hugepd_shift(*hpdp);
859 *hpage_shift = pdshift;
862 EXPORT_SYMBOL_GPL(__find_linux_pte);
864 int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
865 unsigned long end, int write, struct page **pages, int *nr)
867 unsigned long pte_end;
868 struct page *head, *page;
872 pte_end = (addr + sz) & ~(sz-1);
876 pte = READ_ONCE(*ptep);
878 if (!pte_access_permitted(pte, write))
881 /* hugepages are never "special" */
882 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
885 head = pte_page(pte);
887 page = head + ((addr & (sz-1)) >> PAGE_SHIFT);
889 VM_BUG_ON(compound_head(page) != head);
894 } while (addr += PAGE_SIZE, addr != end);
896 if (!page_cache_add_speculative(head, refs)) {
901 if (unlikely(pte_val(pte) != pte_val(*ptep))) {
902 /* Could be optimized better */