All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Jason Baron <jbaron@akamai.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"andi@firstfloor.org" <andi@firstfloor.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/3] static keys: fix test/set races
Date: Tue, 2 Jul 2013 11:38:08 +0200	[thread overview]
Message-ID: <20130702093808.GA5166@gmail.com> (raw)
In-Reply-To: <20130702080306.GD21726@dyad.programming.kicks-ass.net>


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Mon, Jul 01, 2013 at 12:12:11AM -0400, Jason Baron wrote:
> > 
> > Yes, I agree that 'higher' level locking may be required for some callers of
> > the newly proposed interface. However, I do think that the
> > static_key_slow_set_true()/false() provides a nice abstraction for some
> > callers, while addressing test/set() races, by making that sequence atomic.
> > 
> > I view the proposed inteface of set_true()/set_false() as somewhat analogous
> > to an atomic_set() call. In the same way, the current
> > static_key_slow_inc()/dec() are analogous to atomic_inc()/dec().
> > 
> > It arguably makes the code code a bit more readable, transforming sequences
> > such as:
> > 
> > if (!static_key_enabled(&control_var))
> >         static_key_slow_inc(&control_var);
> > 
> > into:
> > 
> >         static_key_slow_set_true(&control_var);
> > 
> > 
> > I see at least 3 users of static_keys in the tree which I think would
> > benefit  from this transformation. The 2 attached with this series, and the
> > usage in kernel/tracepoint.c.
> 
> I tend to agree with Jason here. I also dont' think the scheduler needs 
> this; but the new API is more usable for binary switches as opposed to 
> the refcount thing.

Ok - no objections then from me either.

Thanks,

	Ingo

  reply	other threads:[~2013-07-02  9:38 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-28 22:30 [PATCH 0/3] static keys: fix test/set races jbaron
2013-06-28 22:30 ` [PATCH 1/3] static_keys: Add a static_key_slow_set_true()/false() interface jbaron
2013-06-29  3:00   ` Steven Rostedt
2013-06-28 22:30 ` [PATCH 2/3] sched: fix static keys race in sched_feat jbaron
2013-06-29  3:03   ` Steven Rostedt
2013-06-28 22:30 ` [PATCH 3/3] udp: make use of static_key_slow_set_true() interface jbaron
2013-06-29  3:13   ` Steven Rostedt
2013-07-01  4:20     ` Jason Baron
2013-07-01 14:28       ` Steven Rostedt
2013-06-29  7:20 ` [PATCH 0/3] static keys: fix test/set races Ingo Molnar
2013-07-01  4:12   ` Jason Baron
2013-07-02  8:03     ` Peter Zijlstra
2013-07-02  9:38       ` Ingo Molnar [this message]
2014-06-24  2:28 ` Steven Rostedt
2014-06-24  2:41   ` Jason Baron
2014-06-30 21:43   ` Jason Baron
2014-06-30 22:36     ` Steven Rostedt

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=20130702093808.GA5166@gmail.com \
    --to=mingo@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=jbaron@akamai.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.