Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the scheduling policy individually per thread #135

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

kakra
Copy link
Contributor

@kakra kakra commented Nov 17, 2019

This removes the CPU scheduler setting from the systemd service and instead let's bees manage this on its own and individually per thread. That way, people not using the systemd service can also benefit from less system impact while using bees.

I'm not sure if we should provide a cmdline option for this. If we do so, maybe just an on/off switch. The user should not have to know the individual best settings.

Also, I'm not sure if I did everything right. The worker/consumer architecture forced me to constantly switch parameters because worker threads are constantly recycled to do a different bees task. Only "BeesThread" seems to be an exception. I had to take care not having a child thread linger around with the scheduler settings of the parent thread. Also, the decision for one or another scheduling policy may be wrong, please review.

@kakra kakra force-pushed the feature/thread-scheduling branch from 84f83c9 to 441d4af Compare May 29, 2021 13:05
@kakra kakra mentioned this pull request Jun 2, 2021
kakra referenced this pull request Nov 1, 2021
Fixes: commit 20b8f8a ("bees: use helper function for readahead")
Signed-off-by: Kai Krakow <kai@kaishome.de>
Instead of launching the whole process under one single scheduling
policy, let's better set these individually per thread.

The crawler, writeback, and prefetch threads will use SCHED_IDLE as we
only want them to use CPU when we have it available.

The progress and status threads use SCHED_OTHER as we want them to spool
their updates per best-effort.

Signed-off-by: Kai Krakow <kai@kaishome.de>
This refines the crawler threads which are actually two parts:

The subvolume crawler threads will use SCHED_BATCH if available to
better utilize CPU caches during number crunching: The kernel will give
those threads time slices of 1.5s and will only migrate them to another
core if really needed (e.g., if another process needs the core).

The crawler master will use SCHED_IDLE as we only want it to use CPU
when we have it available. It is only there to generate new work for its
sibling threads.

Signed-off-by: Kai Krakow <kai@kaishome.de>
We want the loadavg calculation to be almost real-time. If SCHED_ISO is
not supported, it will use whatever the service was started with
(SCHED_OTHER by default).

Signed-off-by: Kai Krakow <kai@kaishome.de>
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.

1 participant