aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/perf_counter.h11
-rw-r--r--kernel/perf_counter.c38
-rw-r--r--mm/mmap.c6
3 files changed, 4 insertions, 51 deletions
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 380247bdb918..6ca403acd419 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -148,11 +148,10 @@ struct perf_counter_attr {
148 exclude_hv : 1, /* ditto hypervisor */ 148 exclude_hv : 1, /* ditto hypervisor */
149 exclude_idle : 1, /* don't count when idle */ 149 exclude_idle : 1, /* don't count when idle */
150 mmap : 1, /* include mmap data */ 150 mmap : 1, /* include mmap data */
151 munmap : 1, /* include munmap data */
152 comm : 1, /* include comm data */ 151 comm : 1, /* include comm data */
153 freq : 1, /* use freq, not period */ 152 freq : 1, /* use freq, not period */
154 153
155 __reserved_1 : 52; 154 __reserved_1 : 53;
156 155
157 __u32 wakeup_events; /* wakeup every n events */ 156 __u32 wakeup_events; /* wakeup every n events */
158 __u32 __reserved_2; 157 __u32 __reserved_2;
@@ -246,7 +245,6 @@ enum perf_event_type {
246 * }; 245 * };
247 */ 246 */
248 PERF_EVENT_MMAP = 1, 247 PERF_EVENT_MMAP = 1,
249 PERF_EVENT_MUNMAP = 2,
250 248
251 /* 249 /*
252 * struct { 250 * struct {
@@ -622,9 +620,6 @@ extern void perf_swcounter_event(u32, u64, int, struct pt_regs *, u64);
622extern void perf_counter_mmap(unsigned long addr, unsigned long len, 620extern void perf_counter_mmap(unsigned long addr, unsigned long len,
623 unsigned long pgoff, struct file *file); 621 unsigned long pgoff, struct file *file);
624 622
625extern void perf_counter_munmap(unsigned long addr, unsigned long len,
626 unsigned long pgoff, struct file *file);
627
628extern void perf_counter_comm(struct task_struct *tsk); 623extern void perf_counter_comm(struct task_struct *tsk);
629extern void perf_counter_fork(struct task_struct *tsk); 624extern void perf_counter_fork(struct task_struct *tsk);
630 625
@@ -677,10 +672,6 @@ static inline void
677perf_counter_mmap(unsigned long addr, unsigned long len, 672perf_counter_mmap(unsigned long addr, unsigned long len,
678 unsigned long pgoff, struct file *file) { } 673 unsigned long pgoff, struct file *file) { }
679 674
680static inline void
681perf_counter_munmap(unsigned long addr, unsigned long len,
682 unsigned long pgoff, struct file *file) { }
683
684static inline void perf_counter_comm(struct task_struct *tsk) { } 675static inline void perf_counter_comm(struct task_struct *tsk) { }
685static inline void perf_counter_fork(struct task_struct *tsk) { } 676static inline void perf_counter_fork(struct task_struct *tsk) { }
686static inline void perf_counter_init(void) { } 677static inline void perf_counter_init(void) { }
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c
index 78c58623a0dd..195712e20d07 100644
--- a/kernel/perf_counter.c
+++ b/kernel/perf_counter.c
@@ -41,7 +41,6 @@ static int perf_overcommit __read_mostly = 1;
41 41
42static atomic_t nr_counters __read_mostly; 42static atomic_t nr_counters __read_mostly;
43static atomic_t nr_mmap_counters __read_mostly; 43static atomic_t nr_mmap_counters __read_mostly;
44static atomic_t nr_munmap_counters __read_mostly;
45static atomic_t nr_comm_counters __read_mostly; 44static atomic_t nr_comm_counters __read_mostly;
46 45
47int sysctl_perf_counter_priv __read_mostly; /* do we need to be privileged */ 46int sysctl_perf_counter_priv __read_mostly; /* do we need to be privileged */
@@ -1448,8 +1447,6 @@ static void free_counter(struct perf_counter *counter)
1448 atomic_dec(&nr_counters); 1447 atomic_dec(&nr_counters);
1449 if (counter->attr.mmap) 1448 if (counter->attr.mmap)
1450 atomic_dec(&nr_mmap_counters); 1449 atomic_dec(&nr_mmap_counters);
1451 if (counter->attr.munmap)
1452 atomic_dec(&nr_munmap_counters);
1453 if (counter->attr.comm) 1450 if (counter->attr.comm)
1454 atomic_dec(&nr_comm_counters); 1451 atomic_dec(&nr_comm_counters);
1455 1452
@@ -2510,7 +2507,7 @@ static void perf_counter_fork_output(struct perf_counter *counter,
2510 2507
2511static int perf_counter_fork_match(struct perf_counter *counter) 2508static int perf_counter_fork_match(struct perf_counter *counter)
2512{ 2509{
2513 if (counter->attr.comm || counter->attr.mmap || counter->attr.munmap) 2510 if (counter->attr.comm || counter->attr.mmap)
2514 return 1; 2511 return 1;
2515 2512
2516 return 0; 2513 return 0;
@@ -2557,8 +2554,7 @@ void perf_counter_fork(struct task_struct *task)
2557 struct perf_fork_event fork_event; 2554 struct perf_fork_event fork_event;
2558 2555
2559 if (!atomic_read(&nr_comm_counters) && 2556 if (!atomic_read(&nr_comm_counters) &&
2560 !atomic_read(&nr_mmap_counters) && 2557 !atomic_read(&nr_mmap_counters))
2561 !atomic_read(&nr_munmap_counters))
2562 return; 2558 return;
2563 2559
2564 fork_event = (struct perf_fork_event){ 2560 fork_event = (struct perf_fork_event){
@@ -2722,12 +2718,7 @@ static void perf_counter_mmap_output(struct perf_counter *counter,
2722static int perf_counter_mmap_match(struct perf_counter *counter, 2718static int perf_counter_mmap_match(struct perf_counter *counter,
2723 struct perf_mmap_event *mmap_event) 2719 struct perf_mmap_event *mmap_event)
2724{ 2720{
2725 if (counter->attr.mmap && 2721 if (counter->attr.mmap)
2726 mmap_event->event.header.type == PERF_EVENT_MMAP)
2727 return 1;
2728
2729 if (counter->attr.munmap &&
2730 mmap_event->event.header.type == PERF_EVENT_MUNMAP)
2731 return 1; 2722 return 1;
2732 2723
2733 return 0; 2724 return 0;
@@ -2821,27 +2812,6 @@ void perf_counter_mmap(unsigned long addr, unsigned long len,
2821 perf_counter_mmap_event(&mmap_event); 2812 perf_counter_mmap_event(&mmap_event);
2822} 2813}
2823 2814
2824void perf_counter_munmap(unsigned long addr, unsigned long len,
2825 unsigned long pgoff, struct file *file)
2826{
2827 struct perf_mmap_event mmap_event;
2828
2829 if (!atomic_read(&nr_munmap_counters))
2830 return;
2831
2832 mmap_event = (struct perf_mmap_event){
2833 .file = file,
2834 .event = {
2835 .header = { .type = PERF_EVENT_MUNMAP, },
2836 .start = addr,
2837 .len = len,
2838 .pgoff = pgoff,
2839 },
2840 };
2841
2842 perf_counter_mmap_event(&mmap_event);
2843}
2844
2845/* 2815/*
2846 * Log sample_period changes so that analyzing tools can re-normalize the 2816 * Log sample_period changes so that analyzing tools can re-normalize the
2847 * event flow. 2817 * event flow.
@@ -3525,8 +3495,6 @@ done:
3525 atomic_inc(&nr_counters); 3495 atomic_inc(&nr_counters);
3526 if (counter->attr.mmap) 3496 if (counter->attr.mmap)
3527 atomic_inc(&nr_mmap_counters); 3497 atomic_inc(&nr_mmap_counters);
3528 if (counter->attr.munmap)
3529 atomic_inc(&nr_munmap_counters);
3530 if (counter->attr.comm) 3498 if (counter->attr.comm)
3531 atomic_inc(&nr_comm_counters); 3499 atomic_inc(&nr_comm_counters);
3532 3500
diff --git a/mm/mmap.c b/mm/mmap.c
index 2c1c2cb0e2e1..6451ce2854b9 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1756,12 +1756,6 @@ static void remove_vma_list(struct mm_struct *mm, struct vm_area_struct *vma)
1756 do { 1756 do {
1757 long nrpages = vma_pages(vma); 1757 long nrpages = vma_pages(vma);
1758 1758
1759 if (vma->vm_flags & VM_EXEC) {
1760 perf_counter_munmap(vma->vm_start,
1761 nrpages << PAGE_SHIFT,
1762 vma->vm_pgoff, vma->vm_file);
1763 }
1764
1765 mm->total_vm -= nrpages; 1759 mm->total_vm -= nrpages;
1766 vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages); 1760 vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
1767 vma = remove_vma(vma); 1761 vma = remove_vma(vma);