Skip to content

Commit

Permalink
Merge pull request #34 from tvegas1/const_vm_flags
Browse files Browse the repository at this point in the history
KERNEL: Support vma constified vm_flags on 6.3+ kernels
  • Loading branch information
yosefe authored Jul 11, 2023
2 parents 951be2d + e556a7c commit 4dabd71
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kernel/xpmem_attach.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,12 @@ xpmem_attach(struct file *file, xpmem_apid_t apid, off_t offset, size_t size,

xpmem_mmap_write_lock(current->mm);
vma = find_vma(current->mm, at_vaddr);
xpmem_mmap_write_unlock(current->mm);

vma->vm_private_data = att;
vma->vm_flags |=
VM_DONTCOPY | VM_DONTDUMP | VM_IO | VM_DONTEXPAND | VM_PFNMAP;
vm_flags_set(vma,
VM_DONTCOPY | VM_DONTDUMP | VM_IO | VM_DONTEXPAND | VM_PFNMAP);
vma->vm_ops = &xpmem_vm_ops;
xpmem_mmap_write_unlock(current->mm);

att->at_vma = vma;

Expand Down
7 changes: 7 additions & 0 deletions kernel/xpmem_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,13 @@ struct vma_iterator {
(_vma) = (_vma)->vm_next)
#endif

#if (!HAVE_DECL_VM_FLAGS_SET)
static inline void vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags)
{
vma->vm_flags |= flags;
}
#endif

extern struct xpmem_thread_group *xpmem_tg_ref_by_segid(xpmem_segid_t);
extern struct xpmem_thread_group *xpmem_tg_ref_by_apid(xpmem_apid_t);
extern void xpmem_tg_deref(struct xpmem_thread_group *);
Expand Down
2 changes: 2 additions & 0 deletions m4/ac_path_kernel_source.m4
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ AC_DEFUN([AC_KERNEL_CHECKS],
AC_DEFINE([HAVE_LATEST_APPLY_TO_PAGE_RANGE], 1, [Have latest page iterator])
], [])
AC_CHECK_DECLS([vm_flags_set], [], [], [[#include <linux/mm.h>]])
CPPFLAGS="$save_CPPFLAGS"
]
)

0 comments on commit 4dabd71

Please sign in to comment.