Commit Graph

1238 Commits

Author SHA1 Message Date
Daniel Hodges
d9d0f14a41 meson: Add veristat script
Add a meson script to run veristat. This can later be used to generate
reports for BPF program complexity at PR time.

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2024-08-09 13:26:45 -07:00
Daniel Hodges
87b29a7465
Merge pull request #487 from hodgesds/developer-guide
docs: Add developer guide
2024-08-09 12:35:19 -04:00
Daniel Hodges
f5a8209b4e docs: Add developer guide
Add an intial version of a developer guide, where common tools and
documentation can be shared.

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2024-08-09 08:44:25 -07:00
Andrea Righi
4275fdb989
Merge pull request #482 from sched-ext/readme-update-ubuntu-deps
README: update list of build dependencies for Ubuntu
2024-08-09 15:34:19 +02:00
Andrea Righi
6b251bcbfa README: update list of build dependencies for Ubuntu
Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-09 08:41:24 +02:00
Tejun Heo
5e2500f7eb
Merge pull request #481 from sched-ext/htejun/versions
versions: Synchronize crate dependency versions
2024-08-08 14:46:19 -10:00
Tejun Heo
45f7fd13b7 versions: Synchronize crate dependency versions 2024-08-08 14:45:46 -10:00
Tejun Heo
b264787dde
Merge pull request #436 from danielocfb/topic/inlined-skeleton-members
rust Updated libbpf-rs & libbpf-cargo to 0.24
2024-08-08 14:41:47 -10:00
Tejun Heo
63c4a0191f
Merge branch 'main' into topic/inlined-skeleton-members 2024-08-08 14:23:37 -10:00
Tejun Heo
fd6aa89f41
Merge pull request #480 from sched-ext/htejun/bump-versions
Bump versions for 1.0.2 release
2024-08-08 14:12:54 -10:00
Tejun Heo
cd6a4d72c7 Bump versions for 1.0.2 release 2024-08-08 14:10:16 -10:00
Tejun Heo
c2e169dddc
Merge pull request #479 from sched-ext/htejun/version-tool
version-tool: Suppress spurious dependency version mismatch warning
2024-08-08 14:08:46 -10:00
Tejun Heo
38b1d1f1d7 version-tool: Suppress spurious dependency version mismatch warning
When updating in-tree crate versions, do_rust_ver() was returning the new
version string which is then put into rust_deps triggering version mismatch
warning in do_rust_deps().

There's no reason for do_meson_ver() and do_rust_ver() to return the new
version. Always return the old version.
2024-08-08 14:02:15 -10:00
Tejun Heo
94d79e8dad
Merge pull request #478 from sched-ext/htejun/version-tool
Add a tool to manage versions and synchronize crate dependency versions
2024-08-08 13:48:26 -10:00
Tejun Heo
7c3ffe96e1 Unify crate dependency versions
Different sub-projects are using different versions for the same crates.
Synchronize them to the latest.
2024-08-08 13:26:47 -10:00
Tejun Heo
a7ad2e62e1 version-tool.py: Add a tool to manage versions
It's error-prone to manage version updates with all the sub-projects. Add a
tool to check and update them together.
2024-08-08 13:22:08 -10:00
Andrea Righi
9d808ae206
Merge pull request #468 from sched-ext/rustland-refactoring
scx_rustland refactoring
2024-08-07 11:38:21 +02:00
Andrea Righi
51cfb69199 scx_rustland_core: re-introduce partial mode
Re-add the partial mode option that was dropped during the refactoring.

The partial option allows to apply the scheduler only to the tasks which
have their scheduling policy set to SCHED_EXT via sched_setscheduler().

Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-07 08:41:06 +02:00
Andrea Righi
e1f2b3822e scx_rustland_core: drop CPU ownership API
The API for determining which PID is running on a specific CPU is racy
and is unnecessary since this information can be obtained from user
space.

Additionally, it's not reliable for identifying idle CPUs.  Therefore,
it's better to remove this API and, in the future, provide a cpumask
alternative that can export the idle state of the CPUs to user space.

As a consequence also change scx_rustland to dispatch one task a time,
instead of dispatching tasks in batches of idle cores (that are usually
not accurate due to the racy nature of the CPU ownership interaface).

Dispatching one task at a time even makes the scheduler more performant,
due to the vruntime scheduling being applied to more tasks sitting in
the scheduler's queue.

Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-07 08:41:06 +02:00
Andrea Righi
9a0e7755df scx_rustland_core: export counter of online CPUs
Introduce a helper to get the amount of online CPUs tracked by the BPF
part.

Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-07 08:10:53 +02:00
Andrea Righi
d9c9f78e3e scx_rustland: re-align vruntime and time slice evaluation to scx_bpfland
Drop the slice boost logic and apply a vruntime and task time slice
evaluation approach similar to scx_bpfland (but implement this in the
user-space component instead of the BPF part).

Additionally, introduce a slice_us_min parameter to define the minimum
time slice that can be assigned to a task, also similar to scx_bpfland.

Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-07 08:10:53 +02:00
Andrea Righi
38a725ea34 scx_rlfifo: update copyright info
Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-07 08:10:53 +02:00
Andrea Righi
c963d5eb05 scx_rustland: update copyright info
Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-07 08:10:53 +02:00
Andrea Righi
e1e6e31208 scx_rustland_core: update copyright info
Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-07 08:10:53 +02:00
Andrea Righi
b87541a26e scx_rustland_core: refactor idle CPU selection logic
Use the same idle selection logic used in scx_bpfland also in
scx_rustland_core.

Also drop fifo_mode and always use the BPF idle selection logic by
default as long as the system is not saturated, unless full_user is
specified.

This approach allows user-space schedulers aiming for maximum
performance to leverage the BPF idle selection logic (bypassing
user-space), while those seeking full control can enable full_user to
bypass the BPF CPU idle selection logic and choose the target CPU for
each task from user-space.

Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-07 08:10:53 +02:00
Daniel Hodges
55ac9d1527
Merge pull request #474 from hodgesds/bpf-builder-fixes
scx_utils: Fix build args
2024-08-06 22:42:44 -04:00
Daniel Hodges
459ed82e6c scx_utils: Fix build args
Fix args to bpf_builder, existing warnings display for
"-Wno-compare-distinct-pointer-types'".

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2024-08-06 19:10:34 -07:00
Daniel Hodges
fee0995691
Merge pull request #472 from hodgesds/const-fixes
scx_layered: Fix cred declaration
2024-08-06 14:03:19 -04:00
Andrea Righi
d8985306f4 scx_rustland: user-space interactive task classifier
We don't need to send the number of voluntary context switches (nvcsw)
from BPF to user-space, as this information is already accessible in
user-space via procfs. Sending this data would only create unnecessary
overhead for schedulers that don't require it, and those that do can
easily retrieve it through procfs.

Therefore, drop this metric from scx_rustland_core and change
scx_rustland implementing an interactive task classifier fully in the
user-space part of the scheduler.

Also drop some options that are not provide any significant benefit
(also in preparation of a bigger refactoring to define a better API for
the user-space framework).

Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-06 17:56:58 +02:00
Andrea Righi
a8d14fc0c4
Merge pull request #471 from sched-ext/rustland-core-musl
scx_rustland_core: add support for musl
2024-08-06 17:56:19 +02:00
Andrea Righi
4c67e336e4
Merge pull request #473 from Kawanaao/rustland-fix-mutex-alloc
scx_rustland_core alloc: Replaced RefCell with Mutex
2024-08-06 16:26:05 +02:00
Kawanaao
c3109ebeed
scx_rustland_core alloc: Replaced RefCell with Mutex
Necessary for some multi-threaded cases
2024-08-06 13:10:21 +00:00
Daniel Hodges
d5efcd3245 scx_layered: Fix cred declaration
The use of the cred struct should be const.

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2024-08-06 05:22:12 -07:00
Andrea Righi
4c7fb5cdbd scx_rustland_core: add support for musl
It seems that musl glibc is not POSIX.1-2001, POSIX.1-2008 compliant and
using sched_setscheduler() just returns -ENOSYS:
https://git.musl-libc.org/cgit/musl/commit/src/sched/sched_setscheduler.c?id=1e21e78bf7a5c24c217446d8760be7b7188711c2

Switch to pthread_setschedparam() to properly support building
scx_rustland_core with musl.

This fixes #469.

Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-06 07:32:38 +02:00
Andrea Righi
493de4f5e8
Merge pull request #470 from sched-ext/rustland-core-import-timespec
scx_rustland_core: fix missing import (timespec)
2024-08-05 23:45:47 +02:00
Andrea Righi
d4005dd186 scx_rustland_core: fix missing import (timespec)
Explicitly import timespec to fix the following potential build error:

error[E0422]: cannot find struct, variant or union type `timespec` in this scope
 --> src/bpf.rs:365:35
    |
365 | sched_ss_repl_period: timespec {
    |                       ^^^^^^^^ not found in this scope
    |
help: consider importing this struct
    |
6 + use libc::timespec;
    |

This fixes issue #469.

Signed-off-by: Andrea Righi <andrea.righi@linux.dev>
2024-08-05 23:15:48 +02:00
Changwoo Min
38efa974a8
Merge pull request #467 from sched-ext/htejun/lavd-misc
scx_lavd: Make FlatTopology::new() a bit prettier
2024-08-05 10:43:48 +09:00
Tejun Heo
b226865b96 scx_lavd: Make FlatTopology::new() a bit prettier
- Use .enumerate() consistently while building the cpu_fids vector.

- Use .then_with() to chain .cmp() when sorting cpu_fids.

Both reduce visual clutter.
2024-08-04 11:16:19 -10:00
Changwoo Min
130ea97fbf
Merge pull request #464 from multics69/lavd-amp-v3
scx_lavd: improve the calculation of ineligibility duration
2024-08-03 09:57:41 +09:00
Daniel Hodges
d0355c4a88
Merge pull request #466 from hodgesds/dsq-lat
scripts: Add dsq latency script
2024-08-02 16:45:03 -04:00
Andrea Righi
3ad2875240
Merge pull request #463 from sched-ext/bpfland-update-dsq-vtime
scx_bpfland: always re-align task's vruntime to the global vruntime
2024-08-02 22:13:12 +02:00
Daniel Hodges
0197649af5
Merge pull request #465 from hodgesds/disable-numa-llc
scx_layered: Add support for disabling topology awareness
2024-08-02 15:28:54 -04:00
Daniel Hodges
b6054fb5f2 scripts: Add dsq latency script
This change adds a bpftrace script to monitor runq latency as well as
dsq latency.

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2024-08-02 12:19:41 -07:00
Daniel Hodges
1f922b9a73 scx_layered: Add support for disabling topology awareness
Add a parameter to disable topology awareness. This is useful when
trying to compare the scheduling performance of topology aware
scheduling compared to the previous scheduling strategy.

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2024-08-02 08:07:19 -07:00
Changwoo Min
f3fd6e9cb3 scx_lavd: drop 2-level-scheduling
With optimizations of calculatring ineligibility duration, now the
scheduler works well under heavy load without 2-level scheduling, so we
drop it for simplicitiy.

Signed-off-by: Changwoo Min <changwoo@igalia.com>
2024-08-02 21:46:07 +09:00
Changwoo Min
c38e749c36 scx_lavd: improve the equation for calculating ineligibility duration
This commit include a few changes:
- treat a new forked task more conservatively
- defer the execution of more tasks for longer time using ineligibility duration
- consider if a task is waken up in calculating ineligibility duration
2024-08-02 21:08:29 +09:00
Andrea Righi
bee0d699ef scx_bpfland: always re-align task's vruntime to the global vruntime
Immediately re-align p->scx.dsq_vtime to the global vruntime (+/- slice
lag) as soon as we are evaluating the task's vruntime.

This allows rapidly chase the minimum global vruntime, ensuring to not
over prioritize tasks tasks with a predominantly sleeping behavior
pattern.

Signed-off-by: Andrea Righi <righi.andrea@gmail.com>
2024-08-02 13:11:25 +02:00
Changwoo Min
5e194330f0 scx_lavd: consider task's wakeup and vruntime (starvation) more aggressively
Signed-off-by: Changwoo Min <changwoo@igalia.com>
2024-08-02 12:25:29 +09:00
Daniel Hodges
c3ce7f154e
Merge pull request #461 from hodgesds/layered-dsq-cleanup
scx_layered: Fix enqueue fallback CPU selection
2024-07-31 16:10:02 -04:00
Daniel Hodges
de7b5fe190 scx_layered: Fix dispatch fallback CPU selection
When the previous CPU for a task is not known do not fall back to
dispatching to CPU 0, use the current CPU.

Signed-off-by: Daniel Hodges <hodges.daniel.scott@gmail.com>
2024-07-31 12:35:22 -07:00