From: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linuxfoundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Kees Cook <kees@kernel.org>
Subject: Re: [patch 1/6] perf/core: Remove redundant condition for AUX buffer size
Date: Thu, 7 Aug 2025 14:30:06 +0100 [thread overview]
Message-ID: <9dacc7fa-45c3-40cc-a634-9609c08038e9@lucifer.local> (raw)
In-Reply-To: <20250806200617.258754928@linutronix.de>
On Wed, Aug 06, 2025 at 10:12:54PM +0200, Thomas Gleixner wrote:
> It is already checked whether the VMA size is the same as
> nr_pages * PAGE_SIZE, so later checking both:
Yeah I see near the start of perf_mmap();
if (vma_size != PAGE_SIZE * nr_pages)
return -EINVAL;
>
> 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 seperate functions, so that only nr_pages needs to be
> handed in.
>
> No functional change.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
So this seems obviously correct:
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
> ---
> kernel/events/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -7043,7 +7043,7 @@ static int perf_mmap(struct file *file,
> 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 */
>
next prev parent reply other threads:[~2025-08-07 13:30 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 20:12 [patch 0/6] perf: Convert mmap() related reference counts to refcount_t Thomas Gleixner
2025-08-06 20:12 ` [patch 1/6] perf/core: Remove redundant condition for AUX buffer size Thomas Gleixner
2025-08-07 13:30 ` Lorenzo Stoakes [this message]
2025-08-06 20:12 ` [patch 2/6] perf/core: Split out mlock limit handling Thomas Gleixner
2025-08-07 14:14 ` Lorenzo Stoakes
2025-08-06 20:12 ` [patch 3/6] perf/core: Split out VM accounting Thomas Gleixner
2025-08-07 14:25 ` Lorenzo Stoakes
2025-08-06 20:12 ` [patch 4/6] perf/core: Split out ringbuffer allocation Thomas Gleixner
2025-08-07 15:38 ` Lorenzo Stoakes
2025-08-11 6:26 ` Thomas Gleixner
2025-08-06 20:13 ` [patch 5/6] perf/core: Split the ringbuffer mmap() and allocation code out Thomas Gleixner
2025-08-06 20:13 ` [patch 6/6] perf/core: Convert mmap() refcounts to refcount_t Thomas Gleixner
2025-08-07 15:39 ` [patch 0/6] perf: Convert mmap() related reference counts " Lorenzo Stoakes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9dacc7fa-45c3-40cc-a634-9609c08038e9@lucifer.local \
--to=lorenzo.stoakes@oracle.com \
--cc=acme@redhat.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®