.foliop = NULL, \
}
+void uffd_complete_register(struct vm_area_struct *vma);
/* VMA userfaultfd operations */
unsigned int uffd_page_shift(struct vm_area_struct *vma);
int uffd_writeprotect(struct uffd_info *info);
struct vm_area_struct *dst, struct folio *folio,
unsigned long src_addr);
unsigned int (*page_shift)(struct vm_area_struct *src_vma);
+ void (*complete_register)(struct vm_area_struct *vma);
};
#define MFILL_ATOMIC_MODE_BITS (const_ilog2(NR_MFILL_ATOMIC_MODES - 1) + 1)
return huge_page_shift(hstate_vma(vma));
}
+static inline void hugetlb_complete_register(struct vm_area_struct *vma)
+{
+ if (is_vm_hugetlb_page(vma) && uffd_disable_huge_pmd_share(vma))
+ hugetlb_unshare_all_pmds(vma);
+}
+
static int hugetlb_mfill_pte_poison(struct uffd_info *info);
static int hugetlb_mfill_pte_continue(struct uffd_info *info);
static int hugetlb_mfill_atomic_pte_copy(struct uffd_info *info);
.increment = hugetlb_mfill_size,
.failed_do_unlock = hugetlb_failed_do_unlock,
.page_shift = hugetlb_page_shift,
+ .complete_register = hugetlb_complete_register,
};
#endif
.increment = mfill_size,
.failed_do_unlock = uffd_failed_do_unlock,
.page_shift = uffd_page_shift,
+ .complete_register = uffd_complete_register,
};
#endif
#include <linux/swapops.h>
#include <linux/userfaultfd_k.h>
#include <linux/mmu_notifier.h>
-#include <linux/hugetlb.h>
#include <asm/tlbflush.h>
#include <asm/tlb.h>
#include "internal.h"
return 0;
}
+void uffd_complete_register(struct vm_area_struct *vma)
+{
+}
/* Anon vma ops */
static const struct vm_uffd_ops default_uffd_ops = {
.increment = mfill_size,
.failed_do_unlock = uffd_failed_do_unlock,
.page_shift = uffd_page_shift,
+ .complete_register = uffd_complete_register,
};
unsigned int uffd_page_shift(struct vm_area_struct *vma)
struct vm_area_struct *prev = vma_prev(&vmi);
unsigned long vma_end;
vm_flags_t new_flags;
+ const struct vm_uffd_ops *uffd_ops;
if (vma->vm_start < start)
prev = vma;
*/
userfaultfd_set_ctx(vma, ctx, vm_flags);
- if (is_vm_hugetlb_page(vma) && uffd_disable_huge_pmd_share(vma))
- hugetlb_unshare_all_pmds(vma);
+
+ uffd_ops = vma_get_uffd_ops(vma);
+ uffd_ops->complete_register(vma);
skip:
prev = vma;