Commit d94efc93 authored by Guan Jing's avatar Guan Jing Committed by Cheng Yu
Browse files

sched: programmable: Fix is_cpu_allowed build error

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8OIT1



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

Patch fixes build errors like this:
kernel/sched/sched.h:3625:13: error: inlining failed in
call to ‘always_inline’ ‘is_cpu_allowed’: function body
 not available

Signed-off-by: default avatarGuan Jing <guanjing6@huawei.com>
parent 8d727c54
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -2469,11 +2469,7 @@ static inline bool rq_has_pinned_tasks(struct rq *rq)
 * Per-CPU kthreads are allowed to run on !active && online CPUs, see
 * __set_cpus_allowed_ptr() and select_fallback_rq().
 */
#ifdef CONFIG_BPF_SCHED
inline bool is_cpu_allowed(struct task_struct *p, int cpu)
#else
static inline bool is_cpu_allowed(struct task_struct *p, int cpu)
#endif
{
	/* When not in the task's cpumask, no point in looking further. */
	if (!cpumask_test_cpu(cpu, p->cpus_ptr))
@@ -2499,6 +2495,13 @@ static inline bool is_cpu_allowed(struct task_struct *p, int cpu)
	return cpu_online(cpu);
}

#ifdef CONFIG_BPF_SCHED
bool bpf_sched_is_cpu_allowed(struct task_struct *p, int cpu)
{
	return is_cpu_allowed(p, cpu);
}
#endif

/*
 * This is how migration works:
 *
+1 −1
Original line number Diff line number Diff line
@@ -8523,7 +8523,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags)
		ctx.select_idle_mask = this_cpu_cpumask_var_ptr(select_idle_mask);

		ret = bpf_sched_cfs_select_rq(&ctx);
		if (ret >= 0 && is_cpu_allowed(p, ret)) {
		if (ret >= 0 && bpf_sched_is_cpu_allowed(p, ret)) {
			rcu_read_unlock();
			return ret;
		}
+1 −1
Original line number Diff line number Diff line
@@ -3622,7 +3622,7 @@ extern u64 avg_vruntime(struct cfs_rq *cfs_rq);
extern int entity_eligible(struct cfs_rq *cfs_rq, struct sched_entity *se);

#ifdef CONFIG_BPF_SCHED
inline bool is_cpu_allowed(struct task_struct *p, int cpu);
bool bpf_sched_is_cpu_allowed(struct task_struct *p, int cpu);
#endif

#endif /* _KERNEL_SCHED_SCHED_H */