The patch titled Subject: uprobe-use-original-page-when-all-uprobes-are-removed-v11 has been removed from the -mm tree. Its filename was uprobe-use-original-page-when-all-uprobes-are-removed-v2.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ From: Song Liu <songliubraving@xxxxxx> Subject: uprobe-use-original-page-when-all-uprobes-are-removed-v11 Link: http://lkml.kernel.org/r/20190730193100.2295258-1-songliubraving@xxxxxx Signed-off-by: Song Liu <songliubraving@xxxxxx> Suggested-by: Oleg Nesterov <oleg@xxxxxxxxxx> Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Matthew Wilcox <matthew.wilcox@xxxxxxxxxx> Cc: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Cc: Srikar Dronamraju <srikar@xxxxxxxxxxxxxxxxxx> Cc: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx> Cc: William Kucharski <william.kucharski@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/events/uprobes.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/kernel/events/uprobes.c~uprobe-use-original-page-when-all-uprobes-are-removed-v2 +++ a/kernel/events/uprobes.c @@ -192,7 +192,9 @@ static int __replace_page(struct vm_area page_add_new_anon_rmap(new_page, vma, addr, false); mem_cgroup_commit_charge(new_page, memcg, false, false); lru_cache_add_active_or_unevictable(new_page, vma); - } + } else + /* no new page, just dec_mm_counter for old_page */ + dec_mm_counter(mm, MM_ANONPAGES); if (!PageAnon(old_page)) { dec_mm_counter(mm, mm_counter_file(old_page)); @@ -496,6 +498,10 @@ retry: ref_ctr_updated = 1; } + ret = 0; + if (!is_register && !PageAnon(old_page)) + goto put_old; + ret = anon_vma_prepare(vma); if (ret) goto put_old; @@ -509,11 +515,12 @@ retry: copy_highpage(new_page, old_page); copy_to_page(new_page, vaddr, &opcode, UPROBE_SWBP_INSN_SIZE); - /* try orig_page only for unregister and anonymous old_page */ - if (!is_register && PageAnon(old_page)) { + if (!is_register) { struct page *orig_page; pgoff_t index; + VM_BUG_ON_PAGE(!PageAnon(old_page), old_page); + index = vaddr_to_offset(vma, vaddr & PAGE_MASK) >> PAGE_SHIFT; orig_page = find_get_page(vma->vm_file->f_inode->i_mapping, index); @@ -524,9 +531,6 @@ retry: /* let go new_page */ put_page(new_page); new_page = NULL; - - /* dec_mm_counter for old_page */ - dec_mm_counter(mm, MM_ANONPAGES); } put_page(orig_page); } _ Patches currently in -mm which might be from songliubraving@xxxxxx are mm-thp-introduce-foll_split_pmd.patch mm-thp-introduce-foll_split_pmd-v11.patch uprobe-use-foll_split_pmd-instead-of-foll_split.patch khugepaged-enable-collapse-pmd-for-pte-mapped-thp.patch uprobe-collapse-thp-pmd-after-removing-all-uprobes.patch filemap-check-compound_headpage-mapping-in-filemap_fault.patch filemap-check-compound_headpage-mapping-in-pagecache_get_page.patch filemap-update-offset-check-in-filemap_fault.patch mmthp-stats-for-file-backed-thp.patch khugepaged-rename-collapse_shmem-and-khugepaged_scan_shmem.patch mmthp-add-read-only-thp-support-for-non-shmem-fs.patch mmthp-avoid-writes-to-file-with-thp-in-pagecache.patch