Kernel+LibC+WindowServer: Remove unused thread/process boost mechanism

The priority boosting mechanism has been broken for a very long time.
Let's remove it from the codebase and we can bring it back the day
someone feels like implementing it in a working way. :^)
This commit is contained in:
Andreas Kling 2021-01-16 14:48:32 +01:00
parent 43109f9614
commit 01c2480eb3
Notes: sideshowbarker 2024-07-18 23:11:07 +09:00
9 changed files with 1 additions and 96 deletions

View File

@ -177,8 +177,6 @@ namespace Kernel {
S(profiling_enable) \
S(profiling_disable) \
S(futex) \
S(set_thread_boost) \
S(set_process_boost) \
S(chroot) \
S(pledge) \
S(unveil) \

View File

@ -350,8 +350,6 @@ public:
int sys$profiling_enable(pid_t);
int sys$profiling_disable(pid_t);
int sys$futex(Userspace<const Syscall::SC_futex_params*>);
int sys$set_thread_boost(pid_t tid, int amount);
int sys$set_process_boost(pid_t, int amount);
int sys$chroot(Userspace<const char*> path, size_t path_length, int mount_flags);
int sys$pledge(Userspace<const Syscall::SC_pledge_params*>);
int sys$unveil(Userspace<const Syscall::SC_unveil_params*>);
@ -467,11 +465,6 @@ public:
return m_big_lock;
}
u32 priority_boost() const
{
return m_priority_boost;
}
Custody& root_directory();
Custody& root_directory_relative_to_global_root();
void set_root_directory(const Custody&);
@ -646,8 +639,6 @@ private:
RefPtr<Timer> m_alarm_timer;
u32 m_priority_boost { 0 };
u32 m_promises { 0 };
u32 m_execpromises { 0 };
@ -771,7 +762,7 @@ inline const LogStream& operator<<(const LogStream& stream, const Process& proce
inline u32 Thread::effective_priority() const
{
return m_priority + m_process->priority_boost() + m_priority_boost + m_extra_priority;
return m_priority + m_extra_priority;
}
#define REQUIRE_NO_PROMISES \

View File

@ -104,36 +104,4 @@ int Process::sys$sched_getparam(pid_t pid, Userspace<struct sched_param*> user_p
return 0;
}
int Process::sys$set_thread_boost(pid_t tid, int amount)
{
REQUIRE_PROMISE(proc);
if (amount < 0 || amount > 20)
return -EINVAL;
ScopedSpinLock lock(g_scheduler_lock);
auto thread = Thread::from_tid(tid);
if (!thread)
return -ESRCH;
if (thread->state() == Thread::State::Dead || thread->state() == Thread::State::Dying)
return -ESRCH;
if (!is_superuser() && thread->process().uid() != euid())
return -EPERM;
thread->set_priority_boost(amount);
return 0;
}
int Process::sys$set_process_boost(pid_t pid, int amount)
{
REQUIRE_PROMISE(proc);
if (amount < 0 || amount > 20)
return -EINVAL;
ScopedSpinLock lock(g_processes_lock);
auto process = Process::from_pid(pid);
if (!process || process->is_dead())
return -ESRCH;
if (!is_superuser() && process->uid() != euid())
return -EPERM;
process->m_priority_boost = amount;
return 0;
}
}

View File

@ -102,9 +102,6 @@ public:
void set_priority(u32 p) { m_priority = p; }
u32 priority() const { return m_priority; }
void set_priority_boost(u32 boost) { m_priority_boost = boost; }
u32 priority_boost() const { return m_priority_boost; }
u32 effective_priority() const;
void detach()
@ -1199,7 +1196,6 @@ private:
String m_name;
u32 m_priority { THREAD_PRIORITY_NORMAL };
u32 m_extra_priority { 0 };
u32 m_priority_boost { 0 };
State m_stop_state { Invalid };

View File

@ -60,18 +60,6 @@ int profiling_disable(pid_t pid)
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int set_thread_boost(pid_t tid, int amount)
{
int rc = syscall(SC_set_thread_boost, tid, amount);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int set_process_boost(pid_t tid, int amount)
{
int rc = syscall(SC_set_process_boost, tid, amount);
__RETURN_WITH_ERRNO(rc, rc, -1);
}
int futex(int32_t* userspace_address, int futex_op, int32_t value, const struct timespec* timeout)
{
Syscall::SC_futex_params params { userspace_address, futex_op, value, timeout };

View File

@ -52,9 +52,6 @@ int profiling_disable(pid_t);
#define THREAD_PRIORITY_HIGH 50
#define THREAD_PRIORITY_MAX 99
int set_thread_boost(pid_t tid, int amount);
int set_process_boost(pid_t, int amount);
#define FUTEX_WAIT 1
#define FUTEX_WAKE 2

View File

@ -770,24 +770,6 @@ OwnPtr<Messages::WindowServer::GetSystemThemeResponse> ClientConnection::handle(
return make<Messages::WindowServer::GetSystemThemeResponse>(name);
}
void ClientConnection::boost()
{
// FIXME: Re-enable this when we have a solution for boosting.
#if 0
if (set_process_boost(client_pid(), 10) < 0)
perror("boost: set_process_boost");
#endif
}
void ClientConnection::deboost()
{
// FIXME: Re-enable this when we have a solution for boosting.
#if 0
if (set_process_boost(client_pid(), 0) < 0)
perror("deboost: set_process_boost");
#endif
}
OwnPtr<Messages::WindowServer::SetWindowBaseSizeAndSizeIncrementResponse> ClientConnection::handle(const Messages::WindowServer::SetWindowBaseSizeAndSizeIncrement& message)
{
auto it = m_windows.find(message.window_id());

View File

@ -54,9 +54,6 @@ public:
bool is_unresponsive() const { return m_unresponsive; }
void boost();
void deboost();
static ClientConnection* from_client_id(int client_id);
static void for_each_client(Function<void(ClientConnection&)>);

View File

@ -1239,11 +1239,7 @@ void WindowManager::set_active_window(Window* window, bool make_input)
auto* previously_active_window = m_active_window.ptr();
ClientConnection* previously_active_client = nullptr;
ClientConnection* active_client = nullptr;
if (previously_active_window) {
previously_active_client = previously_active_window->client();
Core::EventLoop::current().post_event(*previously_active_window, make<Event>(Event::WindowDeactivated));
previously_active_window->invalidate();
m_active_window = nullptr;
@ -1253,7 +1249,6 @@ void WindowManager::set_active_window(Window* window, bool make_input)
if (window) {
m_active_window = *window;
active_client = m_active_window->client();
Core::EventLoop::current().post_event(*m_active_window, make<Event>(Event::WindowActivated));
m_active_window->invalidate();
if (auto* client = window->client()) {
@ -1265,13 +1260,6 @@ void WindowManager::set_active_window(Window* window, bool make_input)
} else {
MenuManager::the().set_current_menubar(nullptr);
}
if (active_client != previously_active_client) {
if (previously_active_client)
previously_active_client->deboost();
if (active_client)
active_client->boost();
}
}
void WindowManager::set_hovered_window(Window* window)