Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:llunak:my
icecream
l-niceness-no-scheduler.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File l-niceness-no-scheduler.patch of Package icecream
From 2fba514faa0e7ca1c22ce7804aac90721948b96e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@centrum.cz> Date: Mon, 30 May 2022 08:13:21 +0200 Subject: [PATCH] prioritize jobs with higher priority also if there's no scheduler a80e74343e958c0d5f486a763f14f756c3f8efeb made scheduler choose jobs with lower nice value first, but if there's no scheduler, a daemon was still serving requests in first-come-first-serve fashion. Make daemons serve requests additionally based on the nice value as well. --- daemon/main.cpp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/daemon/main.cpp b/daemon/main.cpp index 75d540f..0f77817 100644 --- a/daemon/main.cpp +++ b/daemon/main.cpp @@ -36,6 +36,7 @@ #include <errno.h> #include <netdb.h> #include <getopt.h> +#include <limits> #include <signal.h> #include <sys/stat.h> @@ -137,6 +138,7 @@ public: job = nullptr; usecsmsg = nullptr; client_id = 0; + niceness = 0; status = UNKNOWN; pipe_from_child = -1; pipe_to_child = -1; @@ -205,6 +207,7 @@ public: UseCSMsg *usecsmsg; CompileJob *job; int client_id; + uint32_t niceness; // nice priority (0-20), for PENDING_USE_CS // pipe from child process with end status, only valid if WAITFORCHILD or TOINSTALL/WAITINSTALL int pipe_from_child; // pipe to child process, only valid if TOINSTALL/WAITINSTALL @@ -228,21 +231,16 @@ public: case WAITCREATEENV: return ret + " " + toString(client_id) + " " + pending_create_env; default: - + ret += " ClientID: " + toString(client_id); if (job_id) { - string jobs; - - if (usecsmsg) { - jobs = " CompileServer: " + usecsmsg->hostname; - } - - return ret + " ClientID: " + toString(client_id) + " Job ID: " + toString(job_id) + jobs; - } else { - return ret + " ClientID: " + toString(client_id); + ret += " Job ID: " + toString(job_id); + if (usecsmsg) + ret += " CompileServer: " + usecsmsg->hostname; } + if (niceness != 0) + ret += " Nice: " + toString(niceness); + return ret; } - - return ret; } }; @@ -323,11 +321,14 @@ public: // TODO: possibly speed this up in adding some sorted lists Client *client = nullptr; int min_client_id = 0; + uint32_t min_niceness = std::numeric_limits<uint32_t>::max(); for (auto it : *this) { - if (it.second->status == s && (!min_client_id || min_client_id > it.second->client_id)) { + if (it.second->status == s && (!min_client_id || min_client_id > it.second->client_id) + && it.second->niceness < min_niceness ) { client = it.second; min_client_id = client->client_id; + min_niceness = client->niceness; } } @@ -1850,6 +1851,7 @@ bool Daemon::handle_get_cs(Client *client, Msg *msg) GetCSMsg *umsg = dynamic_cast<GetCSMsg *>(msg); assert(client); client->status = Client::WAITFORCS; + client->niceness = umsg->niceness; umsg->client_id = client->client_id; trace() << "handle_get_cs " << umsg->client_id << endl; -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor