Skip to content

Commit

Permalink
Merge pull request #328 from sched-ext/rusty_cpumask_overlap
Browse files Browse the repository at this point in the history
rusty: Use cpumask kfuncs in cpumask_intersects_domain()
  • Loading branch information
Byte-Lab authored Jun 3, 2024
2 parents dfc642b + 0ae676a commit a26d3f2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions scheds/rust/scx_rusty/src/bpf/main.bpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1144,17 +1144,18 @@ void BPF_STRUCT_OPS(rusty_enqueue, struct task_struct *p, u64 enq_flags)

static bool cpumask_intersects_domain(const struct cpumask *cpumask, u32 dom_id)
{
s32 cpu;
struct dom_ctx *domc;
struct bpf_cpumask *dmask;

domc = lookup_dom_ctx(dom_id);
if (!domc)
return false;

if (dom_id >= MAX_DOMS)
dmask = domc->cpumask;
if (!dmask)
return false;

bpf_for(cpu, 0, nr_cpus_possible) {
if (bpf_cpumask_test_cpu(cpu, cpumask) &&
(dom_cpumasks[dom_id][cpu / 64] & (1LLU << (cpu % 64))))
return true;
}
return false;
return bpf_cpumask_intersects(cpumask, (const struct cpumask *)dmask);
}

u32 dom_node_id(u32 dom_id)
Expand Down

0 comments on commit a26d3f2

Please sign in to comment.