Messages in this thread | | | Date | Fri, 11 Dec 2015 16:12:29 +0100 | From | Peter Zijlstra <> | Subject | Re: [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; > +}
| |