[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e43b91c2-3139-488e-b7f6-0c715afa43c1@lucifer.local>
Date: Wed, 13 Aug 2025 09:27:02 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: tglx@...utronix.de, linux-kernel@...r.kernel.org,
torvalds@...uxfoundation.org, mingo@...nel.org, namhyung@...nel.org,
acme@...hat.com, kees@...nel.org
Subject: Re: [PATCH v3 06/15] perf: Move common code into both rb and aux
branches
On Wed, Aug 13, 2025 at 10:25:24AM +0200, Peter Zijlstra wrote:
> On Wed, Aug 13, 2025 at 06:55:51AM +0100, Lorenzo Stoakes wrote:
> > On Tue, Aug 12, 2025 at 12:39:04PM +0200, Peter Zijlstra wrote:
> > > if (cond) {
> > > A;
> > > } else {
> > > B;
> > > }
> > > C;
> > >
> > > into
> > >
> > > if (cond) {
> > > A;
> > > C;
> > > } else {
> > > B;
> > > C;
> > > }
> > >
> >
> > Hm we're doing more than that here though, we're refactoring other stuff at
> > the same time.
> >
> > I guess you're speaking broad strokes here, but maybe worth mentioniing the
> > tricksy hobbitses around the rb_has_aux() bit.
>
> Does something like so clarify:
>
> Notably C has a success branch and both A and B have two places for
> success. For A (rb case), duplicate the success case because later
> patches will result in them no longer being identical. For B (aux
> case), share using goto (cleaned up later).
Sounds great, thanks!
>
> > Anyway LGTM so:
> >
> > Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> >
> > > Suggested-by: Thomas Gleixner <tglx@...utronix.de>
> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> > > ---
> > > kernel/events/core.c | 25 +++++++++++++++----------
> > > 1 file changed, 15 insertions(+), 10 deletions(-)
[snip]
> > > @@ -7142,20 +7148,19 @@ static int perf_mmap(struct file *file,
> > >
> > > ret = rb_alloc_aux(rb, event, vma->vm_pgoff, nr_pages,
> > > event->attr.aux_watermark, flags);
> > > - if (!ret) {
> > > - atomic_set(&rb->aux_mmap_count, 1);
> > > - rb->aux_mmap_locked = extra;
> > > + if (ret) {
> >
> > You dropped the 'AUX allocation failed' comment here, but honestly I think
> > that's fine, it's pretty obvious that's the case given the literal previous
> > line is you trying the AUX allocation... :)
>
> Yes that :-)
:)
Powered by blists - more mailing lists