Skip to content

Commit 7396fa8

Browse files
srikardIngo Molnar
authored andcommitted
uprobes/core: Make background page replacement logic account for rss_stat counters
Background page replacement logic adds a new anonymous page instead of a file backed (while inserting a breakpoint) / anonymous page (while removing a breakpoint). Hence the uprobes logic should take care to update the task->ss_stat counters accordingly. This bug became apparent courtesy of commit c3f0327 ("mm: add rss counters consistency check"). Signed-off-by: Srikar Dronamraju <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Ananth N Mavinakayanahalli <[email protected]> Cc: Jim Keniston <[email protected]> Cc: Linux-mm <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Masami Hiramatsu <[email protected]> Cc: Anton Arapov <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 6ac1ef4 commit 7396fa8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/events/uprobes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ static int __replace_page(struct vm_area_struct *vma, struct page *page, struct
160160
get_page(kpage);
161161
page_add_new_anon_rmap(kpage, vma, addr);
162162

163+
if (!PageAnon(page)) {
164+
dec_mm_counter(mm, MM_FILEPAGES);
165+
inc_mm_counter(mm, MM_ANONPAGES);
166+
}
167+
163168
flush_cache_page(vma, addr, pte_pfn(*ptep));
164169
ptep_clear_flush(vma, addr, ptep);
165170
set_pte_at_notify(mm, addr, ptep, mk_pte(kpage, vma->vm_page_prot));

0 commit comments

Comments
 (0)