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;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to