1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:37:35 +00:00

Kernel: Protect processes' master TLS with a fine-grained spinlock

This moves it out of the scope of the big process lock, and allows us
to wean some syscalls off it, starting with sys$allocate_tls.
This commit is contained in:
Idan Horowitz 2023-12-16 12:37:28 +02:00 committed by Andreas Kling
parent cd56ec6e5c
commit 6a4b93b3e0
7 changed files with 91 additions and 86 deletions

View file

@ -924,8 +924,6 @@ private:
Vector<NonnullOwnPtr<KString>> m_arguments;
Vector<NonnullOwnPtr<KString>> m_environment;
LockWeakPtr<Memory::Region> m_master_tls_region;
IntrusiveListNode<Process> m_jail_process_list_node;
IntrusiveListNode<Process> m_all_processes_list_node;
@ -937,8 +935,12 @@ private:
SpinlockProtected<RefPtr<ProcessList>, LockRank::None> m_jail_process_list;
SpinlockProtected<RefPtr<Jail>, LockRank::Process> m_attached_jail {};
size_t m_master_tls_size { 0 };
size_t m_master_tls_alignment { 0 };
struct MasterThreadLocalStorage {
LockWeakPtr<Memory::Region> region;
size_t size { 0 };
size_t alignment { 0 };
};
SpinlockProtected<MasterThreadLocalStorage, LockRank::None> m_master_tls;
Mutex m_big_lock { "Process"sv, Mutex::MutexBehavior::BigLock };
Mutex m_ptrace_lock { "ptrace"sv };