RFC: Introduce struct vma_link_info
Subsystems (5)
Hi there,
Currently find_vma_prepare() and low-level VMA functions (eg. __vma_link())
require callers to provide three parameters to return/pass link information (pprev, rb_link and rb_parent):
static struct vm_area_struct *
find_vma_prepare(struct mm_struct *mm, unsigned long addr,
struct vm_area_struct **pprev, struct rb_node ***rb_link, struct rb_node ** rb_parent);
With this patch callers can pass a struct vma_link_info instead:
static struct vm_area_struct * find_vma_prepare(struct mm_struct *mm, unsigned long addr,
struct vma_link_info *link_info);
The code gets simpler IMO and it _should_ be better because less
variables are pushed into the stack/registers... BUT, for some reason I can't understand hackbench is saying exactly the opposite on my test machine:
kernel Avarage of three runs (25 processes groups)
2.6.29.rc8-vanilla 2.03
2.6.29.rc8-vma-info 2.12
I have tested with more processes and the delta is almost the same,
the machine is UP, processor AMD Sempron with 512MB RAM.
Does anyone have any idea on why this could happen?
--- include/linux/mm.h | 8 ++++- kernel/fork.c | 12 +++--- mm/mmap.c | 91 +++++++++++++++++++++++++-------------------------- 3 files changed, 58 insertions(+), 53 deletions(-)
include/linux/mm.h +7 -1
@@ -1097,6 +1097,12 @@ static inline void vma_nonlinear_insert(struct vm_area_struct *vma, }/* mmap.c */ +struct vma_link_info { +struct rb_node *rb_parent; +struct rb_node **rb_link; +struct vm_area_struct *prev; +}; +extern int __vm_enough_memory (struct mm_struct *mm,long pages,int cap_sys_admin);extern void vma_adjust (struct vm_area_struct *vma,unsigned long start,unsigned long end,pgoff_t pgoff,struct vm_area_struct *insert);
@@ -1109,7 +1115,7 @@ extern int split_vma(struct mm_struct *, struct vm_area_struct *, unsigned long addr, int new_below);extern int insert_vm_struct (struct mm_struct *,struct vm_area_struct *);extern void __vma_link_rb (struct mm_struct *,struct vm_area_struct *, -struct rb_node **,struct rb_node *); +struct vma_link_info *link_info);extern void unlink_file_vma (struct vm_area_struct *);extern struct vm_area_struct *copy_vma (struct vm_area_struct **,unsigned long addr,unsigned long len,pgoff_t pgoff);
kernel/fork.c +6 -6
@@ -261,7 +261,7 @@ out:static int dup_mmap (struct mm_struct *mm,struct mm_struct *oldmm) {struct vm_area_struct *mpnt, *tmp, **pprev; -struct rb_node **rb_link, *rb_parent; +struct vma_link_info link_info;int retval;unsigned long charge;struct mempolicy *pol;
@@ -281,8 +281,8 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) mm->map_count =0 ;cpus_clear (mm->cpu_vm_mask); mm->mm_rb =RB_ROOT ; - rb_link = &mm->mm_rb.rb_node; - rb_parent =NULL ; + link_info.rb_link = &mm->mm_rb.rb_node; + link_info.rb_parent =NULL ; pprev = &mm->mmap;for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) {
@@ -348,9 +348,9 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) *pprev = tmp; pprev = &tmp->vm_next; -__vma_link_rb (mm, tmp, rb_link, rb_parent); - rb_link = &tmp->vm_rb.rb_right; - rb_parent = &tmp->vm_rb; +__vma_link_rb (mm, tmp, &link_info); + link_info.rb_link = &tmp->vm_rb.rb_right; + link_info.rb_parent = &tmp->vm_rb; mm->map_count++; retval =copy_page_range (mm, oldmm, mpnt);
mm/mmap.c +45 -46
236 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>