Minor cleanup in mm/mremap.c
Subsystems (3)
PATCH 1/1 Minor cleanup in mm/mremap.c
http://www.anomalistic.org/patches/mremap-remove-allocated_vma-fix-2.6.1-rc1-mm1.patch
mm/mremap.c +5 -5
@@ -5,6 +5,9 @@* * Address space accounting code <[email protected]> * (C) Copyright 2002 Red Hat Inc, All Rights Reserved +* +* Eugene Teo January 3rd, 2004 +* - A minor cleanup to remove allocated_vma since it is not necessary. */ #include <linux/mm.h>
@@ -186,7 +189,6 @@ {struct mm_struct *mm = vma->vm_mm;struct vm_area_struct *new_vma, *next, *prev; -int allocated_vma;int split =0 ; new_vma =NULL ;
@@ -232,18 +234,16 @@ } } - allocated_vma =0 ;if (!new_vma) { new_vma =kmem_cache_alloc (vm_area_cachep,SLAB_KERNEL );if (!new_vma) goto out; - allocated_vma =1 ; }if (!move_page_tables (vma, new_addr, addr, old_len)) {unsigned long vm_locked = vma->vm_flags &VM_LOCKED ; -if (allocated_vma) { +if (new_vma) { *new_vma = *vma;INIT_LIST_HEAD (&new_vma->shared); new_vma->vm_start = new_addr;
@@ -285,7 +285,7 @@ }return new_addr; } -if (allocated_vma) +if (new_vma)kmem_cache_free (vm_area_cachep, new_vma); out:return -ENOMEM ;
Signature · 8 lines
Eugene TEO <[email protected]> <http://www.anomalistic.org/> 1024D/14A0DDE5 print D851 4574 E357 469C D308 A01E 7321 A38A 14A0 DDE5 main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); } _______________________________________________ Kernel-janitors mailing list [email protected] http://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 6 lines · Eugene Teo
http://www.anomalistic.org/patches/mremap-remove-allocated_vma-fix-2.6.1-rc1-mm1.patch
diff -Naur -X
/home/amnesia/w/dontdiff2.6.1-rc1-mm1/mm/mremap.c2.6.1-rc1-mm1-fix/mm/mremap.c
mm/mremap.c line 241
Quoted 10 lines
mm/mremap.c +0
-2@@ -232,18 +234,16 @@ } } - allocated_vma =0 ;if (!new_vma) { new_vma =kmem_cache_alloc (vm_area_cachep,SLAB_KERNEL );if (!new_vma) goto out; - allocated_vma =1 ; }
Incorrect. If new_vma already was non-NULL, allocated_vma will be 0.
Signature · 10 lines
"Next the statesmen will invent cheap lies, putting the blame upon the nation that is attacked, and every man will be glad of those conscience-soothing falsities, and will diligently study them, and refuse to examine any refutations of them; and thus he will by and by convince himself that the war is just, and will thank God for the better sleep he enjoys after this process of grotesque self-deception." -- Mark Twain _______________________________________________ Kernel-janitors mailing list [email protected] http://lists.osdl.org/mailman/listinfo/kernel-janitors
<quote sender="Matthew Wilcox">
Quoted 10 lines · Eugene Teo
Quoted 9 lines
http://www.anomalistic.org/patches/mremap-remove-allocated_vma-fix-2.6.1-rc1-mm1.patch
diff -Naur -X
/home/amnesia/w/dontdiff2.6.1-rc1-mm1/mm/mremap.c2.6.1-rc1-mm1-fix/mm/mremap.cmm/mremap.c +0
-0@@ -232,18 +234,16 @@ } }
Quoted 9 lines
mm/mremap.c line 241
Quoted 7 lines
mm/mremap.c +0
-2- allocated_vma =0 ;if (!new_vma) { new_vma =kmem_cache_alloc (vm_area_cachep,SLAB_KERNEL );if (!new_vma) goto out; - allocated_vma =1 ; }Incorrect. If
new_vmaalready was non-NULL,allocated_vmawill be 0.
You are right. The following code only works on a newly allocated vma if it wasn't initialised prior to allocated_vma = 0.
Thanks.
Signature · 8 lines
Eugene TEO <[email protected]> <http://www.anomalistic.org/> 1024D/14A0DDE5 print D851 4574 E357 469C D308 A01E 7321 A38A 14A0 DDE5 main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); } _______________________________________________ Kernel-janitors mailing list [email protected] http://lists.osdl.org/mailman/listinfo/kernel-janitors