2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-24 21:24:00 +08:00

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
This commit is contained in:
Linus Torvalds 2018-01-28 11:51:45 -08:00
commit 624441927f
3 changed files with 18 additions and 5 deletions

View File

@ -160,6 +160,8 @@ extern void arch_jump_label_transform_static(struct jump_entry *entry,
extern int jump_label_text_reserved(void *start, void *end); extern int jump_label_text_reserved(void *start, void *end);
extern void static_key_slow_inc(struct static_key *key); extern void static_key_slow_inc(struct static_key *key);
extern void static_key_slow_dec(struct static_key *key); extern void static_key_slow_dec(struct static_key *key);
extern void static_key_slow_inc_cpuslocked(struct static_key *key);
extern void static_key_slow_dec_cpuslocked(struct static_key *key);
extern void jump_label_apply_nops(struct module *mod); extern void jump_label_apply_nops(struct module *mod);
extern int static_key_count(struct static_key *key); extern int static_key_count(struct static_key *key);
extern void static_key_enable(struct static_key *key); extern void static_key_enable(struct static_key *key);
@ -222,6 +224,9 @@ static inline void static_key_slow_dec(struct static_key *key)
atomic_dec(&key->enabled); atomic_dec(&key->enabled);
} }
#define static_key_slow_inc_cpuslocked(key) static_key_slow_inc(key)
#define static_key_slow_dec_cpuslocked(key) static_key_slow_dec(key)
static inline int jump_label_text_reserved(void *start, void *end) static inline int jump_label_text_reserved(void *start, void *end)
{ {
return 0; return 0;
@ -416,6 +421,8 @@ extern bool ____wrong_branch_error(void);
#define static_branch_inc(x) static_key_slow_inc(&(x)->key) #define static_branch_inc(x) static_key_slow_inc(&(x)->key)
#define static_branch_dec(x) static_key_slow_dec(&(x)->key) #define static_branch_dec(x) static_key_slow_dec(&(x)->key)
#define static_branch_inc_cpuslocked(x) static_key_slow_inc_cpuslocked(&(x)->key)
#define static_branch_dec_cpuslocked(x) static_key_slow_dec_cpuslocked(&(x)->key)
/* /*
* Normal usage; boolean enable/disable. * Normal usage; boolean enable/disable.

View File

@ -79,7 +79,7 @@ int static_key_count(struct static_key *key)
} }
EXPORT_SYMBOL_GPL(static_key_count); EXPORT_SYMBOL_GPL(static_key_count);
static void static_key_slow_inc_cpuslocked(struct static_key *key) void static_key_slow_inc_cpuslocked(struct static_key *key)
{ {
int v, v1; int v, v1;
@ -180,7 +180,7 @@ void static_key_disable(struct static_key *key)
} }
EXPORT_SYMBOL_GPL(static_key_disable); EXPORT_SYMBOL_GPL(static_key_disable);
static void static_key_slow_dec_cpuslocked(struct static_key *key, static void __static_key_slow_dec_cpuslocked(struct static_key *key,
unsigned long rate_limit, unsigned long rate_limit,
struct delayed_work *work) struct delayed_work *work)
{ {
@ -211,7 +211,7 @@ static void __static_key_slow_dec(struct static_key *key,
struct delayed_work *work) struct delayed_work *work)
{ {
cpus_read_lock(); cpus_read_lock();
static_key_slow_dec_cpuslocked(key, rate_limit, work); __static_key_slow_dec_cpuslocked(key, rate_limit, work);
cpus_read_unlock(); cpus_read_unlock();
} }
@ -229,6 +229,12 @@ void static_key_slow_dec(struct static_key *key)
} }
EXPORT_SYMBOL_GPL(static_key_slow_dec); EXPORT_SYMBOL_GPL(static_key_slow_dec);
void static_key_slow_dec_cpuslocked(struct static_key *key)
{
STATIC_KEY_CHECK_USE(key);
__static_key_slow_dec_cpuslocked(key, 0, NULL);
}
void static_key_slow_dec_deferred(struct static_key_deferred *key) void static_key_slow_dec_deferred(struct static_key_deferred *key)
{ {
STATIC_KEY_CHECK_USE(key); STATIC_KEY_CHECK_USE(key);

View File

@ -4365,12 +4365,12 @@ static inline bool cfs_bandwidth_used(void)
void cfs_bandwidth_usage_inc(void) void cfs_bandwidth_usage_inc(void)
{ {
static_key_slow_inc(&__cfs_bandwidth_used); static_key_slow_inc_cpuslocked(&__cfs_bandwidth_used);
} }
void cfs_bandwidth_usage_dec(void) void cfs_bandwidth_usage_dec(void)
{ {
static_key_slow_dec(&__cfs_bandwidth_used); static_key_slow_dec_cpuslocked(&__cfs_bandwidth_used);
} }
#else /* HAVE_JUMP_LABEL */ #else /* HAVE_JUMP_LABEL */
static bool cfs_bandwidth_used(void) static bool cfs_bandwidth_used(void)