In order to utilise the new vma_flags_t type, we currently place it in
union with legacy vm_flags fields of type vm_flags_t to make the transition
smoother.

Add vma_flags_t union entries for mm->def_flags and vmg->vm_flags -
mm->def_vma_flags and vmg->vma_flags respectively.

Once the conversion is complete, these will be replaced with vma_flags_t
entries alone.

Also update the VMA tests to reflect the change.

Signed-off-by: Lorenzo Stoakes (Oracle) <[email protected]>
---
 include/linux/mm_types.h        | 6 +++++-
 mm/vma.h                        | 6 +++++-
 tools/testing/vma/include/dup.h | 5 ++++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index ad414ff2d815..ea76821c01e3 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -1262,7 +1262,11 @@ struct mm_struct {
                unsigned long data_vm;     /* VM_WRITE & ~VM_SHARED & ~VM_STACK 
*/
                unsigned long exec_vm;     /* VM_EXEC & ~VM_WRITE & ~VM_STACK */
                unsigned long stack_vm;    /* VM_STACK */
-               vm_flags_t def_flags;
+               union {
+                       /* Temporary while VMA flags are being converted. */
+                       vm_flags_t def_flags;
+                       vma_flags_t def_vma_flags;
+               };
 
                /**
                 * @write_protect_seq: Locked when any thread is write
diff --git a/mm/vma.h b/mm/vma.h
index eba388c61ef4..cf8926558bf6 100644
--- a/mm/vma.h
+++ b/mm/vma.h
@@ -98,7 +98,11 @@ struct vma_merge_struct {
        unsigned long end;
        pgoff_t pgoff;
 
-       vm_flags_t vm_flags;
+       union {
+               /* Temporary while VMA flags are being converted. */
+               vm_flags_t vm_flags;
+               vma_flags_t vma_flags;
+       };
        struct file *file;
        struct anon_vma *anon_vma;
        struct mempolicy *policy;
diff --git a/tools/testing/vma/include/dup.h b/tools/testing/vma/include/dup.h
index 2f53c27ddb21..faaf1239123d 100644
--- a/tools/testing/vma/include/dup.h
+++ b/tools/testing/vma/include/dup.h
@@ -33,7 +33,10 @@ struct mm_struct {
        unsigned long exec_vm;     /* VM_EXEC & ~VM_WRITE & ~VM_STACK */
        unsigned long stack_vm;    /* VM_STACK */
 
-       unsigned long def_flags;
+       union {
+               vm_flags_t def_flags;
+               vma_flags_t def_vma_flags;
+       };
 
        mm_flags_t flags; /* Must use mm_flags_* helpers to access */
 };
-- 
2.53.0


Reply via email to