[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130702080306.GD21726@dyad.programming.kicks-ass.net>
Date: Tue, 2 Jul 2013 10:03:06 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Jason Baron <jbaron@...mai.com>
Cc: Ingo Molnar <mingo@...nel.org>,
"rostedt@...dmis.org" <rostedt@...dmis.org>,
"andi@...stfloor.org" <andi@...stfloor.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 0/3] static keys: fix test/set races
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists