mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] sched_ext: Specialize TID and scheduler hashtable compares
@ 2026-09-21 18:59 Usama Arif
  2026-09-21 18:59 ` [PATCH 1/2] sched_ext: Specialize the TID hashtable compare Usama Arif
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Usama Arif @ 2026-09-21 18:59 UTC (permalink / raw)
  To: arighi, bpf, bsegall, changwoo, dietmar.eggemann, etsal,
	juri.lelli, kprateek.nayak, linux-kernel, mgorman, mingo, peterz,
	rostedt, sched-ext, tj, vincent.guittot, void, vschneid,
	yphbchou0911
  Cc: Usama Arif

scx_tid_hash and scx_sched_hash both use naturally aligned u64 keys but
do not provide obj_cmpfn callbacks. As a result, rhashtable falls back
to rhashtable_compare() for each object visited during a lookup:

  memcmp(ptr + ht->p.key_offset, arg->key, ht->p.key_len)

Although only eight bytes are compared, the generic path loads the key
offset and length at runtime and emits an out-of-line memcmp() call.

The first patch adds a specialized comparison for scx_tid_hash. This
turns comparisons in scx_bpf_tid_to_task() into direct equality tests
against scx->tid. The kfunc can be used from hot scheduling paths, so
avoiding the generic comparison is particularly useful there. The
specialized comparison also covers duplicate checks during insertion.

The second patch specializes scx_sched_hash by comparing keys directly
against ops.sub_cgroup_id. This removes the generic comparison from
scx_find_sub_sched(), which is used when dispatching child schedulers
and by the sub-scheduler capability and management kfuncs.

In both cases, the const rhashtable parameters allow the compiler to
inline the callback and reduce each object comparison to a single u64
compare. Disassembly confirms that the lookup loops no longer call
memcmp() or an out-of-line comparator.

No functional change intended.

Usama Arif (2):
  sched_ext: Specialize the TID hashtable compare
  sched_ext: Specialize the scheduler hashtable compare

 kernel/sched/ext/ext.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

-- 
2.53.0-Meta


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-22  2:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-21 18:59 [PATCH 0/2] sched_ext: Specialize TID and scheduler hashtable compares Usama Arif
2026-09-21 18:59 ` [PATCH 1/2] sched_ext: Specialize the TID hashtable compare Usama Arif
2026-09-21 18:59 ` [PATCH 2/2] sched_ext: Specialize the scheduler " Usama Arif
2026-09-22  2:15   ` bot+bpf-ci
2026-09-21 19:15 ` [PATCH 0/2] sched_ext: Specialize TID and scheduler hashtable compares Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®