From 4430c1295e48c617757c1293b1b3457928162ab9 Mon Sep 17 00:00:00 2001
From: chewitt <christianshewitt@gmail.com>
Date: Thu, 12 Dec 2019 13:48:45 +0000
Subject: [PATCH 056/101] HACK: revert mm: emit tracepoint when RSS changes

---
 include/linux/mm.h          | 14 +++-----------
 include/trace/events/kmem.h | 28 ----------------------------
 mm/memory.c                 |  6 ------
 3 files changed, 3 insertions(+), 45 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index c54fb96cb1e6..db55e0dea9a5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1629,27 +1629,19 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member)
 	return (unsigned long)val;
 }
 
-void mm_trace_rss_stat(struct mm_struct *mm, int member, long count);
-
 static inline void add_mm_counter(struct mm_struct *mm, int member, long value)
 {
-	long count = atomic_long_add_return(value, &mm->rss_stat.count[member]);
-
-	mm_trace_rss_stat(mm, member, count);
+	atomic_long_add(value, &mm->rss_stat.count[member]);
 }
 
 static inline void inc_mm_counter(struct mm_struct *mm, int member)
 {
-	long count = atomic_long_inc_return(&mm->rss_stat.count[member]);
-
-	mm_trace_rss_stat(mm, member, count);
+	atomic_long_inc(&mm->rss_stat.count[member]);
 }
 
 static inline void dec_mm_counter(struct mm_struct *mm, int member)
 {
-	long count = atomic_long_dec_return(&mm->rss_stat.count[member]);
-
-	mm_trace_rss_stat(mm, member, count);
+	atomic_long_dec(&mm->rss_stat.count[member]);
 }
 
 /* Optimized variant when page is already known not to be PageAnon */
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
index f65b1f6db22d..788e049f899c 100644
--- a/include/trace/events/kmem.h
+++ b/include/trace/events/kmem.h
@@ -335,34 +335,6 @@ static unsigned int __maybe_unused mm_ptr_to_hash(const void *ptr)
 #define __PTR_TO_HASHVAL
 #endif
 
-TRACE_EVENT(rss_stat,
-
-	TP_PROTO(struct mm_struct *mm,
-		int member,
-		long count),
-
-	TP_ARGS(mm, member, count),
-
-	TP_STRUCT__entry(
-		__field(unsigned int, mm_id)
-		__field(unsigned int, curr)
-		__field(int, member)
-		__field(long, size)
-	),
-
-	TP_fast_assign(
-		__entry->mm_id = mm_ptr_to_hash(mm);
-		__entry->curr = !!(current->mm == mm);
-		__entry->member = member;
-		__entry->size = (count << PAGE_SHIFT);
-	),
-
-	TP_printk("mm_id=%u curr=%d member=%d size=%ldB",
-		__entry->mm_id,
-		__entry->curr,
-		__entry->member,
-		__entry->size)
-	);
 #endif /* _TRACE_KMEM_H */
 
 /* This part must be outside protection */
diff --git a/mm/memory.c b/mm/memory.c
index e8bfdf0d9d1d..889bfbb49e19 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -72,8 +72,6 @@
 #include <linux/oom.h>
 #include <linux/numa.h>
 
-#include <trace/events/kmem.h>
-
 #include <asm/io.h>
 #include <asm/mmu_context.h>
 #include <asm/pgalloc.h>
@@ -154,10 +152,6 @@ static int __init init_zero_pfn(void)
 }
 core_initcall(init_zero_pfn);
 
-void mm_trace_rss_stat(struct mm_struct *mm, int member, long count)
-{
-	trace_rss_stat(mm, member, count);
-}
 
 #if defined(SPLIT_RSS_COUNTING)
 
-- 
2.17.1

