Hi,

while reviewing my own rtdm_mmap-code again, I noticed that the wrapped
remap_pfn_range() sets VM_RESERVED (+ some other bits) on the passed vma
while the compatibility function remap_page_range() doesn't do this.
This flag seems to exclude the vma from swapping considerations.

Adding the bit to the wrapper appears to me as the best way to catch
this on older kernels. And this should also make the VM_LOCKED setting
obsolete in nucleus/heap.c.

Feel free to correct/enlighten me.

Jan
Index: include/asm-generic/wrappers.h
===================================================================
--- include/asm-generic/wrappers.h	(Revision 600)
+++ include/asm-generic/wrappers.h	(Arbeitskopie)
@@ -46,8 +46,10 @@
 #define module_param_named(name,var,type,mode)  module_param(var,type,mode)
 
 /* VM */
-#define wrap_remap_page_range(vma,from,to,size,prot) \
-    remap_page_range(from,to,size,prot)
+#define wrap_remap_page_range(vma,from,to,size,prot) do { \
+    vma->flags |= VM_RESERVED; \
+    remap_page_range(from,to,size,prot); \
+} while (0)
 #define wrap_switch_mm(prev,next,task)	\
     switch_mm(prev,next,task,(task)->processor)
 #define wrap_enter_lazy_tlb(mm,task)	\
@@ -145,8 +147,10 @@
 #define wrap_remap_page_range(vma,from,to,size,prot)  \
     remap_pfn_range(vma,from,(to) >> PAGE_SHIFT,size,prot)
 #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) */
-#define wrap_remap_page_range(vma,from,to,size,prot)  \
-    remap_page_range(vma,from,to,size,prot)
+#define wrap_remap_page_range(vma,from,to,size,prot) do { \
+    vma->flags |= VM_RESERVED; \
+    remap_page_range(vma,from,to,size,prot); \
+} while (0)
 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10) */
 #define wrap_switch_mm(prev,next,task)	\
     switch_mm(prev,next,task)
Index: ksrc/nucleus/heap.c
===================================================================
--- ksrc/nucleus/heap.c	(Revision 600)
+++ ksrc/nucleus/heap.c	(Arbeitskopie)
@@ -948,7 +948,6 @@
 	return -ENXIO;	/* Doesn't match the heap size. */
         
     vma->vm_ops = &xnheap_vmops;
-    vma->vm_flags |= VM_LOCKED;	/* Don't swap this out. */
     vma->vm_private_data = file->private_data;
 
     vaddr = (unsigned long)heap->archdep.heapbase;

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to