mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: "Reshetova, Elena" <elena.reshetova@intel.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"acme@kernel.org" <acme@kernel.org>,
	"namhyung@kernel.org" <namhyung@kernel.org>,
	"alexander.shishkin@linux.intel.com" 
	<alexander.shishkin@linux.intel.com>,
	"jolsa@redhat.com" <jolsa@redhat.com>,
	"keescook@chromium.org" <keescook@chromium.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>
Subject: Re: [PATCH 1/3] perf: convert perf_event_context.refcount to refcount_t
Date: Fri, 1 Feb 2019 16:23:53 +0000	[thread overview]
Message-ID: <20190201162313.GA34079@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <2236FBA76BA1254E88B949DDB74E612BA4B9DD52@IRSMSX102.ger.corp.intel.com>

On Fri, Feb 01, 2019 at 03:44:38PM +0000, Reshetova, Elena wrote:
> > On Tue, Jan 29, 2019 at 01:55:32PM +0000, Reshetova, Elena wrote:
> > > > On Mon, Jan 28, 2019 at 02:27:26PM +0200, Elena Reshetova wrote:
> > > > > diff --git a/kernel/events/core.c b/kernel/events/core.c
> > > > > index 3cd13a3..a1e87d2 100644
> > > > > --- a/kernel/events/core.c
> > > > > +++ b/kernel/events/core.c
> > > > > @@ -1171,7 +1171,7 @@ static void perf_event_ctx_deactivate(struct
> > > > perf_event_context *ctx)
> > > > >
> > > > >  static void get_ctx(struct perf_event_context *ctx)
> > > > >  {
> > > > > -	WARN_ON(!atomic_inc_not_zero(&ctx->refcount));
> > > > > +	WARN_ON(!refcount_inc_not_zero(&ctx->refcount));
> > > >
> > > > This could be refcount_inc(), remember how that already produces a WARN
> > > > when we try and increment 0.
> > >
> > > But is this true for the x86 arch-specific implementation also?
> > 
> > If you use recount_inc_checked(), it will always produce the WARN(),
> > even when using the x86-specific refcount implementation.
> > 
> > (this was one place I had intended to use the *_checked() forms of the
> > refcount ops).
> 
> Yes, with refcount_inc_checked() it would work, but I don't like it
> that much when we have functions that behave regardless of refcount 
> config. It does help for code minimization & clarity like here, but I think 
> it complicates things even more: two different configs, then functions that
> do not obey configs, etc. 

Sure. The main idea of having the _checked() forms was to not lose
warnings in a conversion to refcount_t, but I appreciate that people
might not like the existing warnings at all.

> Anyhow, I can change this to refcount_inc_checked(), if this is what everyone
> thinks is the best. 

I'll defer to Peter.

Peter, would you prefer refcount_inc() or refcount_inc_checked() here?

Thanks,
Mark.

  reply	other threads:[~2019-02-01 16:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-28 12:27 [PATCH 0/3] perf refcount_t conversions Elena Reshetova
2019-01-28 12:27 ` [PATCH 1/3] perf: convert perf_event_context.refcount to refcount_t Elena Reshetova
2019-01-29  9:37   ` Peter Zijlstra
2019-01-29 13:55     ` Reshetova, Elena
2019-01-30  9:01       ` Peter Zijlstra
2019-02-01 10:32       ` Mark Rutland
2019-02-01 15:44         ` Reshetova, Elena
2019-02-01 16:23           ` Mark Rutland [this message]
2019-02-04  8:51   ` [tip:perf/core] perf: Convert " tip-bot for Elena Reshetova
2019-01-28 12:27 ` [PATCH 2/3] perf/ring_buffer: convert ring_buffer.refcount " Elena Reshetova
2019-02-04  8:52   ` [tip:perf/core] perf/ring_buffer: Convert " tip-bot for Elena Reshetova
2019-01-28 12:27 ` [PATCH 3/3] perf/ring_buffer: convert ring_buffer.aux_refcount " Elena Reshetova
2019-02-04  8:53   ` [tip:perf/core] perf/ring_buffer: Convert " tip-bot for Elena Reshetova
2019-01-29  9:39 ` [PATCH 0/3] perf refcount_t conversions Peter Zijlstra

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=20190201162313.GA34079@lakrids.cambridge.arm.com \
    --to=mark.rutland@arm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=elena.reshetova@intel.com \
    --cc=jolsa@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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®