lkml.org 
[lkml]   [2015]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v0 3/5] perf: Introduce instruction trace filtering
On Fri, Dec 11, 2015 at 03:36:36PM +0200, Alexander Shishkin wrote:
> +/*
> + * Scan through mm's vmas and see if one of them matches the
> + * @filter; if so, adjust filter's address range.
> + * Called with mm::mmap_sem down for reading.
> + */
> +static int perf_itrace_filter_apply(struct perf_event *event,
> + struct perf_itrace_filter *filter,
> + struct mm_struct *mm)
> +{
> + struct vm_area_struct *vma;

lockdep_assert_held(&mm->mmap_sem);

If you want to be pedantic we could add:

lockdep_assert_held_shared()
lockdep_assert_held_exclusive()

to assert we hold it in any particular state.

> +
> + for (vma = mm->mmap; vma->vm_next; vma = vma->vm_next) {
> + struct file *file = vma->vm_file;
> + unsigned long off = vma->vm_pgoff << PAGE_SHIFT;
> + unsigned long vma_size = vma->vm_end - vma->vm_start;
> +
> + if (!file)
> + continue;
> +
> + if (!perf_itrace_filter_match(filter, file, off,
> + vma_size))
> + continue;
> +
> + filter->start = vma->vm_start + filter->offset;
> + filter->end = vma->vm_start + filter->offset +
> + filter->size;
> +
> + return 1;
> + }
> +
> + return 0;
> +}


\
 
 \ /
  Last update: 2015-12-11 16:41    [W:0.119 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site