lkml.org 
[lkml]   [2013]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectracy jump label users
Jason,

I noticed that a lot of the jump label users are racy,
because they implement something like this

static void sched_feat_disable(int i)
{
if (static_key_enabled(&sched_feat_keys[i]))
static_key_slow_dec(&sched_feat_keys[i]);
}

static void sched_feat_enable(int i)
{
if (!static_key_enabled(&sched_feat_keys[i]))
static_key_slow_inc(&sched_feat_keys[i]);
}

with no extra locking, controlled by sysfs. If two
CPUs do this in parallel the reference can be set multiple
times, which gives very unexpected semantics for a sysfs boolean.

Most likely you need a static_key_slow_setstate()
that does the check and set inside the jump label lock.

I understand that for inside kernel use reference
counts are the right semantics, but they are not so
good for sysfs interfaces.

-Andi

--
ak@linux.intel.com -- Speaking for myself only


\
 
 \ /
  Last update: 2013-03-22 21:41    [W:0.027 / U:0.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site