lkml.org 
[lkml]   [2014]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/6] perf: Update sort to handle MAP_SHARED bits
Date
Remove some of the false positives when sorting by utilizing the MAP_SHARED bit.

This helps deal with the COW cases where a virtual address is modified but is
mapped to a read-only shared library area because the perf tool doesn't understand
COW faults.

Using the MAP_SHARED bit tells the tool in this example the memory is private
and will not cause contention with other processes accessing the same shared
library area.

Signed-off-by: Don Zickus <dzickus@redhat.com>
---
tools/perf/util/sort.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index e016fc1..be675f4 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1,3 +1,4 @@
+#include <sys/mman.h>
#include "sort.h"
#include "hist.h"
#include "comm.h"
@@ -1001,7 +1002,8 @@ sort__physid_daddr_cmp(struct hist_entry *left, struct hist_entry *right)
* assumed to be unity mapped. Sort those on address then pid.
*/

- if (l_map->maj || l_map->min || l_map->ino || l_map->ino_generation) {
+ if ((l_map->flags & MAP_SHARED) &&
+ (l_map->maj || l_map->min || l_map->ino || l_map->ino_generation)) {
/* mmapped areas */

if (l_map->maj > r_map->maj) return -1;
--
1.7.11.7


\
 
 \ /
  Last update: 2014-03-24 21:01    [W:0.827 / U:0.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site