summaryrefslogtreecommitdiff
path: root/include/linux/pgsize_migration.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/pgsize_migration.h')
-rw-r--r--include/linux/pgsize_migration.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/pgsize_migration.h b/include/linux/pgsize_migration.h
index 7ab0f288bcf9..5c47ec28ea7d 100644
--- a/include/linux/pgsize_migration.h
+++ b/include/linux/pgsize_migration.h
@@ -61,6 +61,9 @@ extern struct vm_area_struct *get_data_vma(struct vm_area_struct *vma);
extern void show_map_pad_vma(struct vm_area_struct *vma,
struct vm_area_struct *pad,
struct seq_file *m, show_pad_vma_fn func);
+
+extern void split_pad_vma(struct vm_area_struct *vma, struct vm_area_struct *new,
+ unsigned long addr, int new_below);
#else /* PAGE_SIZE != SZ_4K || !defined(CONFIG_64BIT) */
static inline void vma_set_pad_pages(struct vm_area_struct *vma,
unsigned long nr_pages)
@@ -92,10 +95,41 @@ static inline void show_map_pad_vma(struct vm_area_struct *vma,
struct seq_file *m, show_pad_vma_fn func)
{
}
+
+static inline void split_pad_vma(struct vm_area_struct *vma, struct vm_area_struct *new,
+ unsigned long addr, int new_below)
+{
+}
#endif /* PAGE_SIZE == SZ_4K && defined(CONFIG_64BIT) */
static inline unsigned long vma_data_pages(struct vm_area_struct *vma)
{
return vma_pages(vma) - vma_pad_pages(vma);
}
+
+/*
+ * Sets the correct padding bits / flags for a VMA split.
+ */
+static inline unsigned long vma_pad_fixup_flags(struct vm_area_struct *vma,
+ unsigned long newflags)
+{
+ if (newflags & VM_PAD_MASK)
+ return (newflags & ~VM_PAD_MASK) | (vma->vm_flags & VM_PAD_MASK);
+ else
+ return newflags;
+}
+
+/*
+ * Merging of padding VMAs is uncommon, as padding is only allowed
+ * from the linker context.
+ *
+ * To simplify the semantics, adjacent VMAs with padding are not
+ * allowed to merge.
+ */
+static inline bool is_mergable_pad_vma(struct vm_area_struct *vma,
+ unsigned long vm_flags)
+{
+ /* Padding VMAs cannot be merged with other padding or real VMAs */
+ return !((vma->vm_flags | vm_flags) & VM_PAD_MASK);
+}
#endif /* _LINUX_PAGE_SIZE_MIGRATION_H */