Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rusty: Use cpumask kfuncs in cpumask_intersects_domain() #328

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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