lkml.org 
[lkml]   [2015]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Kernel broken on processors without performance counters
On Tue, Jul 21, 2015 at 05:49:59PM +0200, Peter Zijlstra wrote:
> On Tue, Jul 21, 2015 at 05:43:27PM +0200, Thomas Gleixner wrote:
> > On Tue, 21 Jul 2015, Peter Zijlstra wrote:
> >
> > > > -#endif /* _LINUX_JUMP_LABEL_H */
> > > > +static inline void static_key_enable(struct static_key *key)
> > > > +{
> > > > + int count = static_key_count(key);
> > > > +
> > > > + WARN_ON_ONCE(count < 0 || count > 1);
> > > > +
> > > > + if (!count)
> > > > + static_key_slow_inc(key);
> > > > +}
> > > > +
> > > > +static inline void static_key_disable(struct static_key *key)
> > > > +{
> > > > + int count = static_key_count(key);
> > > > +
> > > > + WARN_ON_ONCE(count < 0 || count > 1);
> > > > +
> > > > + if (count)
> > > > + static_key_slow_dec(key);
> > > > +}
> >
> > The functions above are not part of the interface which should be used
> > in code, right?
>
> They are in fact. They make it easier to deal with the refcount thing
> when all you want is boolean states.

That is, things like sched_feat_keys[] which is an array of static keys,
the split types doesn't work -- an array can after all have only one
type.

In such cases you do have to be very careful to not wreck things.


\
 
 \ /
  Last update: 2015-07-21 18:21    [W:0.166 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site