On Tue, May 13, 2014 at 10:45:35AM +0100, Mel Gorman wrote: > +#ifdef HAVE_JUMP_LABEL > +extern struct static_key cpusets_enabled_key; > +static inline bool cpusets_enabled(void) > +{ > + return static_key_false(&cpusets_enabled_key); > +} > + > +/* jump label reference count + the top-level cpuset */ > +#define number_of_cpusets (static_key_count(&cpusets_enabled_key) + 1) > + > +static inline void cpuset_inc(void) > +{ > + static_key_slow_inc(&cpusets_enabled_key); > +} > + > +static inline void cpuset_dec(void) > +{ > + static_key_slow_dec(&cpusets_enabled_key); > +} > + > +static inline void cpuset_init_count(void) { } > + > +#else > extern int number_of_cpusets; /* How many cpusets are defined in system? */ > > +static inline bool cpusets_enabled(void) > +{ > + return number_of_cpusets > 1; > +} > + > +static inline void cpuset_inc(void) > +{ > + number_of_cpusets++; > +} > + > +static inline void cpuset_dec(void) > +{ > + number_of_cpusets--; > +} > + > +static inline void cpuset_init_count(void) > +{ > + number_of_cpusets = 1; > +} > +#endif /* HAVE_JUMP_LABEL */ I'm still puzzled by the whole #else branch here, why not unconditionally use the jump-label one? Without HAVE_JUMP_LABEL we'll revert to a simple atomic_t counter, which should be perfectly fine, no?
Attachment:
pgpbOYsOpb6Lc.pgp
Description: PGP signature