Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

scx: Prepare for BPF DSQ iterator #182

Closed
wants to merge 8 commits into from
Closed

Conversation

htejun
Copy link
Collaborator

@htejun htejun commented Apr 19, 2024

  • Clean up SCX_KF usages.
  • Always keep tasks on dsq->list in dispatch order whether the DSQ is FIFO or PRIQ.
  • Other prepatory changes.

The function takes @Mask but ignores it and uses hard-coded
__SCX_KF_RQ_LOCKED instead. Fix it. The only user was calling with
__SCX_KF_RQ_LOCKED, so this doesn't cause any behavior changes.
It's currently marked ops-only but can actually be called from any context.
Let's make it safe.
None of the functions in scx_kfunc_set_ops_only set are ops-only.
scx_bpf_select_cpu_dfl() is select_cpu-only and the rest can be called from
anywhere. Remove the set and move the kfuncs to scx_kfunc_set_any and the
new scx_kfunc_set_select_cpu.

No functional changes intended.
We'll use the list_head for both fifo and priq. Let's rename it to list.

No functional changes intended.
priq will updated so that the tasks are added to the list in vtime order
too. Thus, caching the first node won't be necessary. Let's switch to
uncached variant.
When a DSQ is used as a PRIQ, tasks were only kept on dsq->priq. This
requires all other paths to check both dsq->priq and dsq->list. A task's
scx.dsq_node.list is available when the task is on a PRIQ DSQ anyway, let's
always put tasks on dsq->list whether it's used as a PRIQ or FIFO by
inserting into dsq->list in vtime order on PRIQs.

This means that dsq->list is always in dispatch order whether the DSQ is
FIFO or PRIQ and the only paths that need to worry about the DSQ type are
dispatch_enqueue() and task_unlink_from_dsq().
- Relocate scx_task_iter definition so that it's together with iter
  functions.

- Add find_user_dsq() instead of open-coding rhashtable_lookup_fast().

No functional changes.
and give p->scx.dsq_node's type the name of scx_dsq_node. This will be used
to implement DSQ iterator.

This wastes 8 bytes on 64bit. Oh well.
@htejun htejun requested a review from Byte-Lab April 19, 2024 01:48
@htejun htejun closed this Apr 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant