]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf: Remove redundant condition for AUX buffer size
authorThomas Gleixner <tglx@linutronix.de>
Tue, 12 Aug 2025 10:38:59 +0000 (12:38 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 15 Aug 2025 11:12:58 +0000 (13:12 +0200)
It is already checked whether the VMA size is the same as
nr_pages * PAGE_SIZE, so later checking both:

      aux_size == vma_size && aux_size == nr_pages * PAGE_SIZE

is redundant. Remove the vma_size check as nr_pages is what is actually
used in the allocation function. That prepares for splitting out the buffer
allocation into separate functions, so that only nr_pages needs to be
handed in.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Link: https://lore.kernel.org/r/20250812104018.424519320@infradead.org
kernel/events/core.c

index 8060c2857bb2b379b13cae56b25b064ffdbf5d09..eea3a7d6c61d7048dbd97ff4892569602323e30f 100644 (file)
@@ -7043,7 +7043,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
                if (rb_has_aux(rb) && rb->aux_pgoff != vma->vm_pgoff)
                        goto aux_unlock;
 
-               if (aux_size != vma_size || aux_size != nr_pages * PAGE_SIZE)
+               if (aux_size != nr_pages * PAGE_SIZE)
                        goto aux_unlock;
 
                /* already mapped with a different size */