lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250813082942.GK4067720@noisy.programming.kicks-ass.net>
Date: Wed, 13 Aug 2025 10:29:42 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
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 09/15] perf: Reflow to get rid of aux_success label

On Wed, Aug 13, 2025 at 07:03:01AM +0100, Lorenzo Stoakes wrote:
> On Tue, Aug 12, 2025 at 12:39:07PM +0200, Peter Zijlstra wrote:
> > Mostly re-indent noise needed to get rid of that label.
> >
> > Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> 
> This is where a side-by-side git diff pager comes in handy :)
> 
> LGTM apart from nit/comment below so:
> 
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> 
> > ---
> >  kernel/events/core.c |   37 ++++++++++++++++++-------------------
> >  1 file changed, 18 insertions(+), 19 deletions(-)
> >
> > --- a/kernel/events/core.c
> > +++ b/kernel/events/core.c
> > @@ -7127,30 +7127,29 @@ static int perf_mmap(struct file *file,
> >  		if (rb_has_aux(rb)) {
> >  			atomic_inc(&rb->aux_mmap_count);
> >  			ret = 0;
> > -			goto aux_success;
> > -		}
> >
> > -		if (!perf_mmap_calc_limits(vma, &user_extra, &extra)) {
> > -			ret = -EPERM;
> > -			atomic_dec(&rb->mmap_count);
> > -			goto unlock;
> > -		}
> 
> NIT: These leaves  a space above:
> 
> 		if (rb_has_aux(rb)) {
> 			atomic_inc(&rb->aux_mmap_count);
> 			ret = 0;
> 
> 		} else {
> 

Yeah, you mention that elsewhere as well. I tend to do that to visually
separate the else branch from the previous block. Although I'm not very
consistent with it. I can remove these I suppose.

> > +		} else {
> > +			if (!perf_mmap_calc_limits(vma, &user_extra, &extra)) {
> > +				ret = -EPERM;
> > +				atomic_dec(&rb->mmap_count);
> > +				goto unlock;
> > +			}
> >
> > -		WARN_ON(!rb && event->rb);
> > +			WARN_ON(!rb && event->rb);
> >
> > -		if (vma->vm_flags & VM_WRITE)
> > -			flags |= RING_BUFFER_WRITABLE;
> > +			if (vma->vm_flags & VM_WRITE)
> > +				flags |= RING_BUFFER_WRITABLE;
> >
> > -		ret = rb_alloc_aux(rb, event, vma->vm_pgoff, nr_pages,
> > -				   event->attr.aux_watermark, flags);
> > -		if (ret) {
> > -			atomic_dec(&rb->mmap_count);
> > -			goto unlock;
> > -		}
> > +			ret = rb_alloc_aux(rb, event, vma->vm_pgoff, nr_pages,
> > +					   event->attr.aux_watermark, flags);
> > +			if (ret) {
> > +				atomic_dec(&rb->mmap_count);
> > +				goto unlock;
> > +			}
> >
> > -		atomic_set(&rb->aux_mmap_count, 1);
> > -		rb->aux_mmap_locked = extra;
> > -aux_success:
> > +			atomic_set(&rb->aux_mmap_count, 1);
> > +			rb->aux_mmap_locked = extra;
> > +		}
> 
> This gets rid of the label but leave spretty horrid nesting, but I'm
> guessing further refactorings will tame it.

The split out in the next patch removes one indent level.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ