Skip to contentSkip to conversation

2.5 vm bugfix

PATCH In review Gerd Knorr 2 participants 2 messages Mar 21, 2003

Subsystems (2)
lore
Share & tools
lore

Gerd Knorr

author
#0 lore raw

PATCH 1/1 2.5 vm bugfix

Hi,

2.5.x kernels don't look at the VM_DONTEXPAND flag when merging multiple vmas into one. Fix below.

Gerd

mm/mmap.c +4 -0
@@ -379,6 +379,8 @@
 can_vma_merge_before(struct vm_area_struct *vma, unsigned long vm_flags,
 	struct file *file, unsigned long vm_pgoff, unsigned long size)
 {
+	if ((vma->vm_flags & VM_DONTEXPAND) || (vm_flags & VM_DONTEXPAND))
+		return 0;
 	if (vma->vm_file == file && vma->vm_flags == vm_flags) {
 		if (!file)
 			return 1;	/* anon mapping */
@@ -396,6 +398,8 @@
 can_vma_merge_after(struct vm_area_struct *vma, unsigned long vm_flags,
 	struct file *file, unsigned long vm_pgoff)
 {
+	if ((vma->vm_flags & VM_DONTEXPAND) || (vm_flags & VM_DONTEXPAND))
+		return 0;
 	if (vma->vm_file == file && vma->vm_flags == vm_flags) {
 		unsigned long vma_size;
 
#1 lore raw
Quoted 5 lines · Gerd Knorr

Hi,

2.5.x kernels don't look at the VM_DONTEXPAND flag when merging multiple vmas into one. Fix below.

There is but one user of VM_DONTEXPAND in the kernel, and that is you ;)

Can you describe exactly why this driver requires DONTEXPAND? ie: how does the driver work, and why is it special?

If there is some alternative way of providing the same behaviour we could remove VM_DONTEXPAND, which would be nice.

Thanks.