perf: use VMA iterator
The VMA iterator is faster than the linked list and removing the linked list will shrink the vm_area_struct. Link: https://lkml.kernel.org/r/20220906194824.2110408-48-Liam.Howlett@oracle.com Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com> Acked-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Tested-by: Yu Zhao <yuzhao@google.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: David Hildenbrand <david@redhat.com> Cc: David Howells <dhowells@redhat.com> Cc: SeongJae Park <sj@kernel.org> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Will Deacon <will@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
160c820023
commit
fcb72a585a
@@ -10229,8 +10229,9 @@ static void perf_addr_filter_apply(struct perf_addr_filter *filter,
|
|||||||
struct perf_addr_filter_range *fr)
|
struct perf_addr_filter_range *fr)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
|
VMA_ITERATOR(vmi, mm, 0);
|
||||||
|
|
||||||
for (vma = mm->mmap; vma; vma = vma->vm_next) {
|
for_each_vma(vmi, vma) {
|
||||||
if (!vma->vm_file)
|
if (!vma->vm_file)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -349,9 +349,10 @@ static bool valid_ref_ctr_vma(struct uprobe *uprobe,
|
|||||||
static struct vm_area_struct *
|
static struct vm_area_struct *
|
||||||
find_ref_ctr_vma(struct uprobe *uprobe, struct mm_struct *mm)
|
find_ref_ctr_vma(struct uprobe *uprobe, struct mm_struct *mm)
|
||||||
{
|
{
|
||||||
|
VMA_ITERATOR(vmi, mm, 0);
|
||||||
struct vm_area_struct *tmp;
|
struct vm_area_struct *tmp;
|
||||||
|
|
||||||
for (tmp = mm->mmap; tmp; tmp = tmp->vm_next)
|
for_each_vma(vmi, tmp)
|
||||||
if (valid_ref_ctr_vma(uprobe, tmp))
|
if (valid_ref_ctr_vma(uprobe, tmp))
|
||||||
return tmp;
|
return tmp;
|
||||||
|
|
||||||
@@ -1231,11 +1232,12 @@ int uprobe_apply(struct inode *inode, loff_t offset,
|
|||||||
|
|
||||||
static int unapply_uprobe(struct uprobe *uprobe, struct mm_struct *mm)
|
static int unapply_uprobe(struct uprobe *uprobe, struct mm_struct *mm)
|
||||||
{
|
{
|
||||||
|
VMA_ITERATOR(vmi, mm, 0);
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
mmap_read_lock(mm);
|
mmap_read_lock(mm);
|
||||||
for (vma = mm->mmap; vma; vma = vma->vm_next) {
|
for_each_vma(vmi, vma) {
|
||||||
unsigned long vaddr;
|
unsigned long vaddr;
|
||||||
loff_t offset;
|
loff_t offset;
|
||||||
|
|
||||||
@@ -1983,9 +1985,10 @@ bool uprobe_deny_signal(void)
|
|||||||
|
|
||||||
static void mmf_recalc_uprobes(struct mm_struct *mm)
|
static void mmf_recalc_uprobes(struct mm_struct *mm)
|
||||||
{
|
{
|
||||||
|
VMA_ITERATOR(vmi, mm, 0);
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
|
|
||||||
for (vma = mm->mmap; vma; vma = vma->vm_next) {
|
for_each_vma(vmi, vma) {
|
||||||
if (!valid_vma(vma, false))
|
if (!valid_vma(vma, false))
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user