Re: [PATCH 2/2] sched_ext: Specialize the scheduler hashtable compare

From: bot+bpf-ci

Date: Mon Sep 21 2026 - 22:16:26 EST


> diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
> index 124bf827791ed..705a937268505 100644
> --- a/kernel/sched/ext/ext.c
> +++ b/kernel/sched/ext/ext.c
> @@ -41,10 +41,21 @@ struct scx_sched __rcu *scx_root;
> LIST_HEAD(scx_sched_all);
>
> #ifdef CONFIG_EXT_SUB_SCHED
> +static __always_inline int scx_sched_cmpfn(struct rhashtable_compare_arg *arg,
> + const void *ptr)
> +{
> + const struct scx_sched *sch = ptr;
> +
> + BUILD_BUG_ON(sizeof_field(struct scx_sched, ops.sub_cgroup_id) != sizeof(u64));
> +
> + return sch->ops.sub_cgroup_id != *(const u64 *)arg->key;
> +}
> +

This isn't a bug, but scx_sched_cmpfn() and scx_tid_cmpfn() (added in
the preceding patch, twenty lines below in this file) differ only in the
container type and field -- would a small generator macro be worth it
here, or is spelling both out clearer at two instances?

> const struct rhashtable_params scx_sched_hash_params = {
> .key_len = sizeof_field(struct scx_sched, ops.sub_cgroup_id),
> .key_offset = offsetof(struct scx_sched, ops.sub_cgroup_id),
> .head_offset = offsetof(struct scx_sched, hash_node),
> + .obj_cmpfn = scx_sched_cmpfn,
> .insecure_elasticity = true, /* inserted under scx_sched_lock */
> };


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/35676595280