]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
s390: Implement the new page table range API
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 13 Feb 2023 19:12:22 +0000 (14:12 -0500)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Tue, 1 Aug 2023 19:14:17 +0000 (15:14 -0400)
Add set_ptes() and update_mmu_cache_range().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: linux-s390@vger.kernel.org
arch/s390/include/asm/pgtable.h

index 30909fe27c24bb2f2acf5438cb27dbca8df7d1be..d28d2e5e68eed91e2e44d24ae00e95e479b99148 100644 (file)
@@ -47,6 +47,7 @@ static inline void update_page_count(int level, long count)
  * tables contain all the necessary information.
  */
 #define update_mmu_cache(vma, address, ptep)     do { } while (0)
+#define update_mmu_cache_range(vmf, vma, addr, ptep, nr) do { } while (0)
 #define update_mmu_cache_pmd(vma, address, ptep) do { } while (0)
 
 /*
@@ -1314,20 +1315,34 @@ pgprot_t pgprot_writecombine(pgprot_t prot);
 pgprot_t pgprot_writethrough(pgprot_t prot);
 
 /*
- * Certain architectures need to do special things when PTEs
- * within a page table are directly modified.  Thus, the following
- * hook is made available.
+ * Set multiple PTEs to consecutive pages with a single call.  All PTEs
+ * are within the same folio, PMD and VMA.
  */
-static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
-                             pte_t *ptep, pte_t entry)
+static inline void set_ptes(struct mm_struct *mm, unsigned long addr,
+                             pte_t *ptep, pte_t entry, unsigned int nr)
 {
        if (pte_present(entry))
                entry = clear_pte_bit(entry, __pgprot(_PAGE_UNUSED));
-       if (mm_has_pgste(mm))
-               ptep_set_pte_at(mm, addr, ptep, entry);
-       else
-               set_pte(ptep, entry);
+       if (mm_has_pgste(mm)) {
+               for (;;) {
+                       ptep_set_pte_at(mm, addr, ptep, entry);
+                       if (--nr == 0)
+                               break;
+                       ptep++;
+                       entry = __pte(pte_val(entry) + PAGE_SIZE);
+                       addr += PAGE_SIZE;
+               }
+       } else {
+               for (;;) {
+                       set_pte(ptep, entry);
+                       if (--nr == 0)
+                               break;
+                       ptep++;
+                       entry = __pte(pte_val(entry) + PAGE_SIZE);
+               }
+       }
 }
+#define set_ptes set_ptes
 
 /*
  * Conversion functions: convert a page and protection to a page entry,