The patch titled Subject: mm/mmap.c: rb_parent is not necessary in __vma_link_list() has been added to the -mm tree. Its filename is mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx> Subject: mm/mmap.c: rb_parent is not necessary in __vma_link_list() Now we use rb_parent to get next, while this is not necessary. When prev is NULL, this means vma should be the first element in the list. Then next should be current first one (mm->mmap), no matter whether we have parent or not. After removing it, the code shows the beauty of symmetry. Link: http://lkml.kernel.org/r/20190813032656.16625-1-richardw.yang@xxxxxxxxxxxxxxx Signed-off-by: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/internal.h | 2 +- mm/mmap.c | 2 +- mm/nommu.c | 2 +- mm/util.c | 8 ++------ 4 files changed, 5 insertions(+), 9 deletions(-) --- a/mm/internal.h~mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list +++ a/mm/internal.h @@ -290,7 +290,7 @@ static inline bool is_data_mapping(vm_fl /* mm/util.c */ void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma, - struct vm_area_struct *prev, struct rb_node *rb_parent); + struct vm_area_struct *prev); void __vma_unlink_list(struct mm_struct *mm, struct vm_area_struct *vma); #ifdef CONFIG_MMU --- a/mm/mmap.c~mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list +++ a/mm/mmap.c @@ -641,7 +641,7 @@ __vma_link(struct mm_struct *mm, struct struct vm_area_struct *prev, struct rb_node **rb_link, struct rb_node *rb_parent) { - __vma_link_list(mm, vma, prev, rb_parent); + __vma_link_list(mm, vma, prev); __vma_link_rb(mm, vma, rb_link, rb_parent); } --- a/mm/nommu.c~mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list +++ a/mm/nommu.c @@ -637,7 +637,7 @@ static void add_vma_to_mm(struct mm_stru if (rb_prev) prev = rb_entry(rb_prev, struct vm_area_struct, vm_rb); - __vma_link_list(mm, vma, prev, parent); + __vma_link_list(mm, vma, prev); } /* --- a/mm/util.c~mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list +++ a/mm/util.c @@ -271,7 +271,7 @@ void *memdup_user_nul(const void __user EXPORT_SYMBOL(memdup_user_nul); void __vma_link_list(struct mm_struct *mm, struct vm_area_struct *vma, - struct vm_area_struct *prev, struct rb_node *rb_parent) + struct vm_area_struct *prev) { struct vm_area_struct *next; @@ -280,12 +280,8 @@ void __vma_link_list(struct mm_struct *m next = prev->vm_next; prev->vm_next = vma; } else { + next = mm->mmap; mm->mmap = vma; - if (rb_parent) - next = rb_entry(rb_parent, - struct vm_area_struct, vm_rb); - else - next = NULL; } vma->vm_next = next; if (next) _ Patches currently in -mm which might be from richardw.yang@xxxxxxxxxxxxxxx are mm-mmapc-remove-a-never-trigger-warning-in-__vma_adjust.patch mm-rmapc-reuse-mergeable-anon_vma-as-parent-when-fork.patch mm-mmapc-prev-could-be-retrieved-from-vma-vm_prev.patch mm-mmapc-__vma_unlink_prev-is-not-necessary-now.patch mm-mmapc-extract-__vma_unlink_list-as-counter-part-for-__vma_link_list.patch mm-mmapc-rb_parent-is-not-necessary-in-__vma_link_list.patch hugetlb-remove-unused-hstate-in-hugetlb_fault_mutex_hash.patch userfaultfd-use-vma_pagesize-for-all-huge-page-size-calculation.patch userfaultfd-remove-unnecessary-warn_on-in-__mcopy_atomic_hugetlb.patch userfaultfd-wrap-the-common-dst_vma-check-into-an-inlined-function.patch mm-fix-typo-in-the-comment-when-calling-function-__setpageuptodate.patch