Merge tag 's390-5.19-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
[sfrench/cifs-2.6.git] / arch / s390 / mm / gmap.c
index 1ac73917a8d399ef8335744a056252032120aacd..b8ae4a4aa2ba46388eaaba72a02f1666f1d56324 100644 (file)
@@ -2608,6 +2608,18 @@ static int __s390_enable_skey_pte(pte_t *pte, unsigned long addr,
        return 0;
 }
 
+/*
+ * Give a chance to schedule after setting a key to 256 pages.
+ * We only hold the mm lock, which is a rwsem and the kvm srcu.
+ * Both can sleep.
+ */
+static int __s390_enable_skey_pmd(pmd_t *pmd, unsigned long addr,
+                                 unsigned long next, struct mm_walk *walk)
+{
+       cond_resched();
+       return 0;
+}
+
 static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,
                                      unsigned long hmask, unsigned long next,
                                      struct mm_walk *walk)
@@ -2630,12 +2642,14 @@ static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,
        end = start + HPAGE_SIZE - 1;
        __storage_key_init_range(start, end);
        set_bit(PG_arch_1, &page->flags);
+       cond_resched();
        return 0;
 }
 
 static const struct mm_walk_ops enable_skey_walk_ops = {
        .hugetlb_entry          = __s390_enable_skey_hugetlb,
        .pte_entry              = __s390_enable_skey_pte,
+       .pmd_entry              = __s390_enable_skey_pmd,
 };
 
 int s390_enable_skey(void)