Skip to content

Conversation

rrnewton
Copy link
Contributor

See commit description for the first diff, copied below.


[SCX][lavd] modify lavd to use new peek operation
Summary:

The per-cpu queues mode in LAVD checks multiple queues for potential steal targets.
These checks can be made more efficient with the forthcoming O(1) lockless peek operation.
This patch updates LAVD to use peek in three places:

  • try_to_steal: picking cpu with lowest vtime
  • on consume_task: checking the cpu DSQ
  • on consume_task: checking the domain DSQ

Note that these usages are necessarily racy because no lock is held. That is, we
could peek a low vtime, but the task may have moved or completed by the time we
attempt to steal it.

Test Plan:

  • ran schbench under a VM [1 cpdom, 50cpus]

Reviewers: daidavid

@rrnewton rrnewton marked this pull request as draft August 25, 2025 14:37
@rrnewton
Copy link
Contributor Author

@daidavid - I'll post some more baremetal perf results here. Under a VM with 50 cpus, 1 cpudom, 120 GB ram, it really doesn't move schbench score.

@daidavid
Copy link
Contributor

@rrnewton Yes, let's get the numbers with baremetal. VM numbers are noisy and not very meaningful, a few things to keep in mind:

  • I wouldn't expect the new load balancing to help with schbench that much since vtime ordering isn't that important for a microbenchmark. I'd test it on some real workloads if you can.
  • I have doubts about how often the task steal path actually gets used given all of the recent changes, it would be interesting to instrument that. We might need to update the enqueue logic as well.

Copy link
Contributor

@multics69 multics69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Ryan! I left a few comments for the next version.

One nitpicking is to use "scx_lavd" instead of "[SCX][LAVD]" as a prefix of the commit message for consistency.

@multics69 multics69 changed the title Use Peek operation in lavd (when it ships) scx_lavd: Use Peek operation in lavd (when it ships) Aug 26, 2025
rrnewton and others added 2 commits August 26, 2025 13:24
Summary:

The per-cpu queues mode in LAVD checks multiple queues for potential steal targets.
These checks can be made more efficient with the forthcoming O(1) lockless peek operation.
This patch updates LAVD to use peek in three places:

- try_to_steal: picking cpu with lowest vtime
- on consume_task: checking the cpu DSQ
- on consume_task: checking the domain DSQ

Note that these usages are necessarily racy because no lock is held. That is, we
could peek a low vtime, but the task may have moved or completed by the time we
attempt to steal it.

Test Plan:
 - ran schbench under a VM [1 cpdom, 50cpus]

Reviewers: daidavid
Summary:
This function was replaced with `pick_cpu_with_lowest_vtime`. Unless there is some other context we plan to use it in, let's get rid of it.
@rrnewton rrnewton changed the title scx_lavd: Use Peek operation in lavd (when it ships) scx_lavd: Use Peek operation in lavd if available Aug 26, 2025
@rrnewton
Copy link
Contributor Author

@multics69 - ok, comments resolved. Let me know if that looks good now.

@multics69
Copy link
Contributor

@multics69 - ok, comments resolved. Let me know if that looks good now.

Thanks for addressing the comments. It looks good now. Let's merge it to the main once the kernel patch is submitted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants