提交 acf66d70 编写于 作者: S Steve Sistare 提交者: Zheng Zengkai

sched/fair: Provide can_migrate_task_llc

hulk inclusion
category: feature
bugzilla: 38261, https://gitee.com/openeuler/kernel/issues/I49XPZ
CVE: NA

---------------------------

Define a simpler version of can_migrate_task called can_migrate_task_llc
which does not require a struct lb_env argument, and judges whether a
migration from one CPU to another within the same LLC should be allowed.
Signed-off-by: NSteve Sistare <steven.sistare@oracle.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: NChen Hui <judy.chenhui@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 183bcfbb
......@@ -7942,6 +7942,34 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
return 0;
}
/*
* Return true if task @p can migrate from @rq to @dst_rq in the same LLC.
* No need to test for co-locality, and no need to test task_hot(), as sharing
* LLC provides cache warmth at that level.
*/
static bool
can_migrate_task_llc(struct task_struct *p, struct rq *rq, struct rq *dst_rq)
{
int dst_cpu = dst_rq->cpu;
lockdep_assert_held(&rq->lock);
if (throttled_lb_pair(task_group(p), cpu_of(rq), dst_cpu))
return false;
if (!cpumask_test_cpu(dst_cpu, p->cpus_ptr)) {
schedstat_inc(p->se.statistics.nr_failed_migrations_affine);
return false;
}
if (task_running(rq, p)) {
schedstat_inc(p->se.statistics.nr_failed_migrations_running);
return false;
}
return true;
}
/*
* detach_task() -- detach the task for the migration from @src_rq to @dst_cpu.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册