
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/ICAOAT -------------------------------- Add spinlock interference track support Signed-off-by: Pu Lehui <pulehui@huawei.com> --- include/linux/cgroup.h | 1 + kernel/cgroup/ifs.c | 3 +++ kernel/locking/qspinlock.c | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 0e21c8b3fec0..f8d65dedcd85 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -862,6 +862,7 @@ void cgroup_move_task_to_root(struct task_struct *tsk); #endif enum ifs_types { + IFS_SPINLOCK, IFS_SMT, IFS_RUNDELAY, IFS_WAKELAT, diff --git a/kernel/cgroup/ifs.c b/kernel/cgroup/ifs.c index 0c5c7c3c01ae..82817c7d821a 100644 --- a/kernel/cgroup/ifs.c +++ b/kernel/cgroup/ifs.c @@ -198,6 +198,9 @@ static const char *ifs_type_name(int type) char *name = NULL; switch (type) { + case IFS_SPINLOCK: + name = "spinlock"; + break; case IFS_SMT: name = "smt"; break; diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c index c1818fec34f2..e46f7c62bdd0 100644 --- a/kernel/locking/qspinlock.c +++ b/kernel/locking/qspinlock.c @@ -16,6 +16,7 @@ #include <linux/smp.h> #include <linux/bug.h> #include <linux/cpumask.h> +#include <linux/cgroup.h> #include <linux/percpu.h> #include <linux/hardirq.h> #include <linux/mutex.h> @@ -348,6 +349,7 @@ void __lockfunc queued_spin_lock_slowpath(struct qspinlock *lock, u32 val) { struct mcs_spinlock *prev, *next, *node; u32 old, tail; + u64 ifs_clock; int idx; BUILD_BUG_ON(CONFIG_NR_CPUS >= (1U << _Q_TAIL_CPU_BITS)); @@ -434,6 +436,7 @@ void __lockfunc queued_spin_lock_slowpath(struct qspinlock *lock, u32 val) tail = encode_tail(smp_processor_id(), idx); trace_contention_begin(lock, LCB_F_SPIN); + cgroup_ifs_enter_lock(&ifs_clock); /* * 4 nodes are allocated based on the assumption that there will @@ -588,6 +591,7 @@ void __lockfunc queued_spin_lock_slowpath(struct qspinlock *lock, u32 val) pv_kick_node(lock, next); release: + cgroup_ifs_leave_lock(ifs_clock, IFS_SPINLOCK); trace_contention_end(lock, 0); /* -- 2.34.1