1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 16:47:45 +00:00

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
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 };