mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-18 11:57:03 +07:00
timers: simplify lockdep handling
In order to avoid the false positive from lockdep, each per-cpu base->lock has the separate lock class and migrate_timers() uses double_spin_lock(). This all is overcomplicated: except for migrate_timers() we never take 2 locks at once, and migrate_timers() can use spin_lock_nested(). Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Arjan van de Ven <arjan@linux.intel.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
parent
ee7dd205b5
commit
0d180406f2
@ -1228,13 +1228,6 @@ asmlinkage long sys_sysinfo(struct sysinfo __user *info)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* lockdep: we want to track each per-CPU base as a separate lock-class,
|
|
||||||
* but timer-bases are kmalloc()-ed, so we need to attach separate
|
|
||||||
* keys to them:
|
|
||||||
*/
|
|
||||||
static struct lock_class_key base_lock_keys[NR_CPUS];
|
|
||||||
|
|
||||||
static int __cpuinit init_timers_cpu(int cpu)
|
static int __cpuinit init_timers_cpu(int cpu)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
@ -1277,7 +1270,6 @@ static int __cpuinit init_timers_cpu(int cpu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_lock_init(&base->lock);
|
spin_lock_init(&base->lock);
|
||||||
lockdep_set_class(&base->lock, base_lock_keys + cpu);
|
|
||||||
|
|
||||||
for (j = 0; j < TVN_SIZE; j++) {
|
for (j = 0; j < TVN_SIZE; j++) {
|
||||||
INIT_LIST_HEAD(base->tv5.vec + j);
|
INIT_LIST_HEAD(base->tv5.vec + j);
|
||||||
@ -1316,8 +1308,8 @@ static void __cpuinit migrate_timers(int cpu)
|
|||||||
new_base = get_cpu_var(tvec_bases);
|
new_base = get_cpu_var(tvec_bases);
|
||||||
|
|
||||||
local_irq_disable();
|
local_irq_disable();
|
||||||
double_spin_lock(&new_base->lock, &old_base->lock,
|
spin_lock(&new_base->lock);
|
||||||
smp_processor_id() < cpu);
|
spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
|
||||||
|
|
||||||
BUG_ON(old_base->running_timer);
|
BUG_ON(old_base->running_timer);
|
||||||
|
|
||||||
@ -1330,8 +1322,8 @@ static void __cpuinit migrate_timers(int cpu)
|
|||||||
migrate_timer_list(new_base, old_base->tv5.vec + i);
|
migrate_timer_list(new_base, old_base->tv5.vec + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
double_spin_unlock(&new_base->lock, &old_base->lock,
|
spin_unlock(&old_base->lock);
|
||||||
smp_processor_id() < cpu);
|
spin_unlock(&new_base->lock);
|
||||||
local_irq_enable();
|
local_irq_enable();
|
||||||
put_cpu_var(tvec_bases);
|
put_cpu_var(tvec_bases);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user