tools/sched_ext: Add helper to check task migration state
Introduce a new helper for BPF schedulers to determine whether a task
can migrate or not (supporting both SMP and UP systems).
Fixes: e9fe182772
("sched_ext: selftests/dsp_local_on: Fix sporadic failures")
Signed-off-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
d6f3e7d564
commit
5f52bbf2f6
1 changed files with 11 additions and 0 deletions
|
@ -404,6 +404,17 @@ static __always_inline const struct cpumask *cast_mask(struct bpf_cpumask *mask)
|
||||||
return (const struct cpumask *)mask;
|
return (const struct cpumask *)mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return true if task @p cannot migrate to a different CPU, false
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
static inline bool is_migration_disabled(const struct task_struct *p)
|
||||||
|
{
|
||||||
|
if (bpf_core_field_exists(p->migration_disabled))
|
||||||
|
return p->migration_disabled;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/* rcu */
|
/* rcu */
|
||||||
void bpf_rcu_read_lock(void) __ksym;
|
void bpf_rcu_read_lock(void) __ksym;
|
||||||
void bpf_rcu_read_unlock(void) __ksym;
|
void bpf_rcu_read_unlock(void) __ksym;
|
||||||
|
|
Loading…
Add table
Reference in a new issue