kanoj-mm5.0-2.2.9 Unify and enhance find_extend_vma
Subsystems (2)
PATCH 1/1 kanoj-mm5.0-2.2.9 Unify and enhance find_extend_vma
find_extend_vma misses doing a couple of checks and updating some variables. It does not check total_vm against RLIMIT_AS.rlim_cur, and fails to update total_vm and locked_vm. This is probably partly because of code duplication. Since all versions of find_extend_vma are exactly similar, this patch makes find_extend_vma a platform independent function, and properly invokes expand_stack to do the right checks and updates. The new find_extend_vma also faults and locks in pages for locked vma's to go hand-in-hand with the update of locked_vm in expand_stack.
Kanoj
[email protected]
alpha/kernel/ptrace.c renamed from usr/tmp/p_rdiff_a00GNO/ptrace.c +0 -20
@@ -246,26 +246,6 @@flush_tlb (); } -static struct vm_area_struct * -find_extend_vma (struct task_struct * tsk,unsigned long addr) -{ -struct vm_area_struct * vma; - - addr &=PAGE_MASK ; - vma =find_vma (tsk->mm,addr); -if (!vma) -return NULL ; -if (vma->vm_start <= addr) -return vma; -if (!(vma->vm_flags &VM_GROWSDOWN )) -return NULL ; -if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK ].rlim_cur) -return NULL ; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; -return vma; -} -/* * This routine checks the page boundaries, and that the offset is * within the task area. It then calls get_long() to read a long.
arm/kernel/ptrace.c renamed from usr/tmp/p_rdiff_a00FNA/ptrace.c +0 -19
@@ -164,25 +164,6 @@flush_tlb (); } -static struct vm_area_struct *find_extend_vma (struct task_struct * tsk,unsigned long addr) -{ -struct vm_area_struct * vma; - - addr &=PAGE_MASK ; - vma =find_vma (tsk->mm,addr); -if (!vma) -return NULL ; -if (vma->vm_start <= addr) -return vma; -if (!(vma->vm_flags &VM_GROWSDOWN )) -return NULL ; -if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK ].rlim_cur) -return NULL ; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; -return vma; -} -/* * This routine checks the page boundaries, and that the offset is * within the task area. It then calls get_long() to read a long.
i386/kernel/ptrace.c renamed from usr/tmp/p_rdiff_a00GPZ/ptrace.c +0 -19
@@ -172,25 +172,6 @@flush_tlb (); } -static struct vm_area_struct *find_extend_vma (struct task_struct * tsk,unsigned long addr) -{ -struct vm_area_struct * vma; - - addr &=PAGE_MASK ; - vma =find_vma (tsk->mm,addr); -if (!vma) -return NULL ; -if (vma->vm_start <= addr) -return vma; -if (!(vma->vm_flags &VM_GROWSDOWN )) -return NULL ; -if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK ].rlim_cur) -return NULL ; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; -return vma; -} -/* * This routine checks the page boundaries, and that the offset is * within the task area. It then calls get_long() to read a long.
m68k/kernel/ptrace.c renamed from usr/tmp/p_rdiff_a00G4B/ptrace.c +0 -19
@@ -196,25 +196,6 @@flush_tlb_all (); } -static struct vm_area_struct *find_extend_vma (struct task_struct * tsk,unsigned long addr) -{ -struct vm_area_struct * vma; - - addr &=PAGE_MASK ; - vma =find_vma (tsk->mm, addr); -if (!vma) -return NULL ; -if (vma->vm_start <= addr) -return vma; -if (!(vma->vm_flags &VM_GROWSDOWN )) -return NULL ; -if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK ].rlim_cur) -return NULL ; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; -return vma; -} -/* * This routine checks the page boundaries, and that the offset is * within the task area. It then calls get_long() to read a long.
mips/kernel/ptrace.c renamed from usr/tmp/p_rdiff_a00BKC/ptrace.c +0 -19
@@ -143,25 +143,6 @@flush_tlb_page (vma, addr); } -static struct vm_area_struct *find_extend_vma (struct task_struct * tsk,unsigned long addr) -{ -struct vm_area_struct * vma; - - addr &=PAGE_MASK ; - vma =find_vma (tsk->mm, addr); -if (!vma) -return NULL ; -if (vma->vm_start <= addr) -return vma; -if (!(vma->vm_flags &VM_GROWSDOWN )) -return NULL ; -if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK ].rlim_cur) -return NULL ; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; -return vma; -} -/* * This routine checks the page boundaries, and that the offset is * within the task area. It then calls get_long() to read a long.
ppc/kernel/ptrace.c renamed from usr/tmp/p_rdiff_a00GX7/ptrace.c +0 -19
@@ -190,25 +190,6 @@flush_tlb_all (); } -static struct vm_area_struct *find_extend_vma (struct task_struct * tsk,unsigned long addr) -{ -struct vm_area_struct * vma; - - addr &=PAGE_MASK ; - vma =find_vma (tsk->mm,addr); -if (!vma) -return NULL ; -if (vma->vm_start <= addr) -return vma; -if (!(vma->vm_flags &VM_GROWSDOWN )) -return NULL ; -if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK ].rlim_cur) -return NULL ; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; -return vma; -} -/* * This routine checks the page boundaries, and that the offset is * within the task area. It then calls get_long() to read a long.
sparc/kernel/ptrace.c renamed from usr/tmp/p_rdiff_a00GXw/ptrace.c +0 -20
@@ -134,26 +134,6 @@flush_tlb_page (vma, addr); } -static struct vm_area_struct *find_extend_vma (struct task_struct * tsk, -unsigned long addr) -{ -struct vm_area_struct * vma; - - addr &=PAGE_MASK ; - vma =find_vma (tsk->mm,addr); -if (!vma) -return NULL ; -if (vma->vm_start <= addr) -return vma; -if (!(vma->vm_flags &VM_GROWSDOWN )) -return NULL ; -if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK ].rlim_cur) -return NULL ; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; -return vma; -} -/* * This routine checks the page boundaries, and that the offset is * within the task area. It then calls get_long() to read a long.
sparc64/kernel/ptrace.c renamed from usr/tmp/p_rdiff_a00EtZ/ptrace.c +0 -20
@@ -204,26 +204,6 @@flush_tlb_page (vma, addr); } -static struct vm_area_struct *find_extend_vma (struct task_struct * tsk, -unsigned long addr) -{ -struct vm_area_struct * vma; - - addr &=PAGE_MASK ; - vma =find_vma (tsk->mm,addr); -if (!vma) -return NULL ; -if (vma->vm_start <= addr) -return vma; -if (!(vma->vm_flags &VM_GROWSDOWN )) -return NULL ; -if (vma->vm_end - addr > tsk->rlim[RLIMIT_STACK ].rlim_cur) -return NULL ; - vma->vm_offset -= vma->vm_start - addr; - vma->vm_start = addr; -return vma; -} -/* * This routine checks the page boundaries, and that the offset is * within the task area. It then calls get_long() to read a long.
linux/mm.h renamed from usr/tmp/p_rdiff_a007MM/mm.h +2 -0
@@ -382,6 +382,8 @@return vma; } +extern struct vm_area_struct *find_extend_vma (struct task_struct *tsk,unsigned long addr); +#define buffer_under_min () ((buffermem >> PAGE_SHIFT) * 100 < \ buffer_mem.min_percent * num_physpages)#define pgcache_under_min () (page_cache_size * 100 < \
mmap.c renamed from usr/tmp/p_rdiff_a00CuV/mmap.c +22 -0
@@ -467,6 +467,28 @@return NULL ; } +struct vm_area_struct *find_extend_vma (struct task_struct * tsk,unsigned long addr) +{ +struct vm_area_struct * vma; +unsigned long start; + + addr &=PAGE_MASK ; + vma =find_vma (tsk->mm,addr); +if (!vma) +return NULL ; +if (vma->vm_start <= addr) +return vma; +if (!(vma->vm_flags &VM_GROWSDOWN )) +return NULL ; + start = vma->vm_start; +if (expand_stack (vma, addr)) +return NULL ; +if (vma->vm_flags &VM_LOCKED ) { +make_pages_present (addr, start); + } +return vma; +} +/* Normal function to fix up a mapping * This function is the default for when an area has no specific * function. This may be used as part of a more specific routine.
--
To unsubscribe, send a message with 'unsubscribe linux-mm my@address' in the body to [email protected]. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/