The rss_stat tracepoint is emitted on every RSS update, including each page fault. When it is enabled, it reports the precise sum of the RSS counter, which iterates over all possible CPUs for each event: 384 per page fault on a machine with 384 logical CPUs. Report the approximate sum of the hierarchical per-cpu counter instead, through get_mm_counter(), which reads the root of the counter tree. The size field of the event, the RSS counter after the update, is therefore within the accuracy bound of the counter from the precise value: within 158.5MB on a machine with 384 logical CPUs and 4kB pages. The tracepoint reports the precise sum since commit f1a7941243c1 ("mm: convert mm's rss stats into percpu_counter"). Before that, it reported an atomic counter which only received the per-task cached updates in batches. Signed-off-by: Mathieu Desnoyers Cc: "Paul E. McKenney" Cc: Steven Rostedt Cc: Masami Hiramatsu Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Martin Liu Cc: David Rientjes Cc: christian.koenig@amd.com Cc: Shakeel Butt Cc: SeongJae Park Cc: Michal Hocko Cc: Johannes Weiner Cc: Sweet Tea Dorminy Cc: Lorenzo Stoakes Cc: Liam R. Howlett Cc: Mike Rapoport Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Christian Brauner Cc: Wei Yang Cc: David Hildenbrand Cc: Miaohe Lin Cc: Al Viro Cc: Yu Zhao Cc: Roman Gushchin Cc: Mateusz Guzik Cc: Matthew Wilcox Cc: Baolin Wang Cc: Aboorva Devarajan Cc: David Carlier Cc: Josh Law Cc: Andrew Morton Cc: linux-mm@kvack.org --- Changes since v22: - Split from "mm: improve RSS counter approximation accuracy for proc interfaces", which now keeps reporting the precise sum. --- include/trace/events/kmem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h index ac4c96db7638..8ee6d5df5961 100644 --- a/include/trace/events/kmem.h +++ b/include/trace/events/kmem.h @@ -448,7 +448,7 @@ TRACE_EVENT(rss_stat, */ __entry->curr = current->mm == mm && !(current->flags & PF_KTHREAD); __entry->member = member; - __entry->size = get_mm_counter_sum(mm, member) << PAGE_SHIFT; + __entry->size = get_mm_counter(mm, member) << PAGE_SHIFT; ), TP_printk("mm_id=%u curr=%d type=%s size=%ldB", -- 2.47.3