Skip to content

Commit 6244419

Browse files
committed
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fix from Thomas Gleixner: "A single bug fix to prevent a subtle deadlock in the scheduler core code vs cpu hotplug" * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/core: Fix cpu.max vs. cpuhotplug deadlock
2 parents 39e3836 + ce48c14 commit 6244419

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

include/linux/jump_label.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry,
160160
extern int jump_label_text_reserved(void *start, void *end);
161161
extern void static_key_slow_inc(struct static_key *key);
162162
extern void static_key_slow_dec(struct static_key *key);
163+
extern void static_key_slow_inc_cpuslocked(struct static_key *key);
164+
extern void static_key_slow_dec_cpuslocked(struct static_key *key);
163165
extern void jump_label_apply_nops(struct module *mod);
164166
extern int static_key_count(struct static_key *key);
165167
extern void static_key_enable(struct static_key *key);
@@ -222,6 +224,9 @@ static inline void static_key_slow_dec(struct static_key *key)
222224
atomic_dec(&key->enabled);
223225
}
224226

227+
#define static_key_slow_inc_cpuslocked(key) static_key_slow_inc(key)
228+
#define static_key_slow_dec_cpuslocked(key) static_key_slow_dec(key)
229+
225230
static inline int jump_label_text_reserved(void *start, void *end)
226231
{
227232
return 0;
@@ -416,6 +421,8 @@ extern bool ____wrong_branch_error(void);
416421

417422
#define static_branch_inc(x) static_key_slow_inc(&(x)->key)
418423
#define static_branch_dec(x) static_key_slow_dec(&(x)->key)
424+
#define static_branch_inc_cpuslocked(x) static_key_slow_inc_cpuslocked(&(x)->key)
425+
#define static_branch_dec_cpuslocked(x) static_key_slow_dec_cpuslocked(&(x)->key)
419426

420427
/*
421428
* Normal usage; boolean enable/disable.

kernel/jump_label.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ int static_key_count(struct static_key *key)
7979
}
8080
EXPORT_SYMBOL_GPL(static_key_count);
8181

82-
static void static_key_slow_inc_cpuslocked(struct static_key *key)
82+
void static_key_slow_inc_cpuslocked(struct static_key *key)
8383
{
8484
int v, v1;
8585

@@ -180,7 +180,7 @@ void static_key_disable(struct static_key *key)
180180
}
181181
EXPORT_SYMBOL_GPL(static_key_disable);
182182

183-
static void static_key_slow_dec_cpuslocked(struct static_key *key,
183+
static void __static_key_slow_dec_cpuslocked(struct static_key *key,
184184
unsigned long rate_limit,
185185
struct delayed_work *work)
186186
{
@@ -211,7 +211,7 @@ static void __static_key_slow_dec(struct static_key *key,
211211
struct delayed_work *work)
212212
{
213213
cpus_read_lock();
214-
static_key_slow_dec_cpuslocked(key, rate_limit, work);
214+
__static_key_slow_dec_cpuslocked(key, rate_limit, work);
215215
cpus_read_unlock();
216216
}
217217

@@ -229,6 +229,12 @@ void static_key_slow_dec(struct static_key *key)
229229
}
230230
EXPORT_SYMBOL_GPL(static_key_slow_dec);
231231

232+
void static_key_slow_dec_cpuslocked(struct static_key *key)
233+
{
234+
STATIC_KEY_CHECK_USE(key);
235+
__static_key_slow_dec_cpuslocked(key, 0, NULL);
236+
}
237+
232238
void static_key_slow_dec_deferred(struct static_key_deferred *key)
233239
{
234240
STATIC_KEY_CHECK_USE(key);

kernel/sched/fair.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4365,12 +4365,12 @@ static inline bool cfs_bandwidth_used(void)
43654365

43664366
void cfs_bandwidth_usage_inc(void)
43674367
{
4368-
static_key_slow_inc(&__cfs_bandwidth_used);
4368+
static_key_slow_inc_cpuslocked(&__cfs_bandwidth_used);
43694369
}
43704370

43714371
void cfs_bandwidth_usage_dec(void)
43724372
{
4373-
static_key_slow_dec(&__cfs_bandwidth_used);
4373+
static_key_slow_dec_cpuslocked(&__cfs_bandwidth_used);
43744374
}
43754375
#else /* HAVE_JUMP_LABEL */
43764376
static bool cfs_bandwidth_used(void)

0 commit comments

Comments
 (0)