Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1222720

Re: static key arrays?

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: static key arrays?
Date 2015-09-11 13:20 +0200
Message-ID <q7ux4-8mN-7@gated-at.bofh.it> (permalink)
References <q7t7Y-6eG-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Sep 11, 2015 at 11:45:35AM +0200, Johannes Berg wrote:
> Hi Peter, Jason, all,
> 
> Per the recent type-safe API changes, it's no longer easy to generate
> an array of static keys. I was planning to do that for a set of very
> unlikely debug options.
> 
> It sounds like you're planning to remove the previous API entirely at
> some point, so I'm wondering if you've given any thought to this
> possibility.

If possible I'd kill static_key_{true,false}() and
static_key_slow_{inc,dec}. Not sure how much more makes sense, the new
interface builds on parts of the old stuff.

> I briefly played with the idea of adding a macro for that, but the
> necessary "REPEAT(n, d)" macro for the initialisation becomes ugly
> pretty quickly and, afaict, needs to have enough macros for the maximum
> expected numbers.
> 
> For the case I was looking at it's static_key_false so a zero
> -initialized array would be sufficient, but that can't be done easily
> with a static_key_true.

As long as its all the same type it shouldn't be too hard;

struct static_key_false array[n] = { STATIC_KEY_FALSE_INIT, };

or something like that.

The scheduler has an array of these things that has different types;
which if going to be even more interesting. I'm not quite sure what to
do there, but I think it'll end up relying on the fact that both types
share the same base (struct static_key) and involve a lot of type
casting :-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

static key arrays? Johannes Berg <johannes@sipsolutions.net> - 2015-09-11 11:50 +0200
  Re: static key arrays? Peter Zijlstra <peterz@infradead.org> - 2015-09-11 13:20 +0200
    Re: static key arrays? Johannes Berg <johannes@sipsolutions.net> - 2015-09-11 14:20 +0200
      Re: static key arrays? Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-09-11 16:50 +0200
        Re: static key arrays? Johannes Berg <johannes@sipsolutions.net> - 2015-09-11 17:00 +0200
  Re: static key arrays? "Baron, Jason" <jbaron@akamai.com> - 2015-09-11 13:30 +0200

csiph-web