From 6b85b358f8fa7ab0c945202cb9c7a8c3d348e7b1 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Sat, 4 Jun 2022 21:44:48 -0700 Subject: [PATCH] Kernel: Unify Kernel task names for consistency This change unifies the naming convention for kernel tasks. The goal of this change is to: - Make the task names more descriptive, so users can more easily understand their purpose in System Monitor. - Unify the naming convention so they are consistent. --- Kernel/Bus/USB/UHCI/UHCIController.cpp | 2 +- Kernel/Net/NetworkTask.cpp | 2 +- Kernel/Scheduler.cpp | 2 +- Kernel/Tasks/FinalizerTask.cpp | 6 ++++-- Kernel/Tasks/SyncTask.cpp | 4 ++-- Kernel/WorkQueue.cpp | 2 +- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Kernel/Bus/USB/UHCI/UHCIController.cpp b/Kernel/Bus/USB/UHCI/UHCIController.cpp index aa35a8e0c42..8ea28e06e8e 100644 --- a/Kernel/Bus/USB/UHCI/UHCIController.cpp +++ b/Kernel/Bus/USB/UHCI/UHCIController.cpp @@ -509,7 +509,7 @@ size_t UHCIController::poll_transfer_queue(QueueHead& transfer_queue) ErrorOr UHCIController::spawn_port_process() { RefPtr usb_hotplug_thread; - (void)Process::create_kernel_process(usb_hotplug_thread, TRY(KString::try_create("UHCI hotplug")), [&] { + (void)Process::create_kernel_process(usb_hotplug_thread, TRY(KString::try_create("UHCI Hot Plug Task")), [&] { for (;;) { if (m_root_hub) m_root_hub->check_for_port_updates(); diff --git a/Kernel/Net/NetworkTask.cpp b/Kernel/Net/NetworkTask.cpp index d5996e0e6e2..632ca05beb6 100644 --- a/Kernel/Net/NetworkTask.cpp +++ b/Kernel/Net/NetworkTask.cpp @@ -43,7 +43,7 @@ static HashTable>* delayed_ack_sockets; void NetworkTask::spawn() { RefPtr thread; - auto name = KString::try_create("NetworkTask"); + auto name = KString::try_create("Network Task"); if (name.is_error()) TODO(); (void)Process::create_kernel_process(thread, name.release_value(), NetworkTask_main, nullptr); diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp index 7159e45fef8..8056c5a106e 100644 --- a/Kernel/Scheduler.cpp +++ b/Kernel/Scheduler.cpp @@ -405,7 +405,7 @@ UNMAP_AFTER_INIT void Scheduler::initialize() VERIFY(s_colonel_process); VERIFY(idle_thread); idle_thread->set_priority(THREAD_PRIORITY_MIN); - idle_thread->set_name(KString::must_create("idle thread #0")); + idle_thread->set_name(KString::must_create("Idle Task #0")); set_idle_thread(idle_thread); } diff --git a/Kernel/Tasks/FinalizerTask.cpp b/Kernel/Tasks/FinalizerTask.cpp index 23b1bb74a92..bf63e9388de 100644 --- a/Kernel/Tasks/FinalizerTask.cpp +++ b/Kernel/Tasks/FinalizerTask.cpp @@ -11,6 +11,8 @@ namespace Kernel { +static constexpr StringView finalizer_task_name = "Finalizer Task"sv; + static void finalizer_task(void*) { Thread::current()->set_priority(THREAD_PRIORITY_LOW); @@ -20,14 +22,14 @@ static void finalizer_task(void*) if (g_finalizer_has_work.exchange(false, AK::MemoryOrder::memory_order_acq_rel) == true) Thread::finalize_dying_threads(); else - g_finalizer_wait_queue->wait_forever("FinalizerTask"); + g_finalizer_wait_queue->wait_forever(finalizer_task_name); } }; UNMAP_AFTER_INIT void FinalizerTask::spawn() { RefPtr finalizer_thread; - auto finalizer_process = Process::create_kernel_process(finalizer_thread, KString::must_create("FinalizerTask"), finalizer_task, nullptr); + auto finalizer_process = Process::create_kernel_process(finalizer_thread, KString::must_create(finalizer_task_name), finalizer_task, nullptr); VERIFY(finalizer_process); g_finalizer = finalizer_thread; } diff --git a/Kernel/Tasks/SyncTask.cpp b/Kernel/Tasks/SyncTask.cpp index 7cb1dc20c5a..19fa77c4a91 100644 --- a/Kernel/Tasks/SyncTask.cpp +++ b/Kernel/Tasks/SyncTask.cpp @@ -15,8 +15,8 @@ namespace Kernel { UNMAP_AFTER_INIT void SyncTask::spawn() { RefPtr syncd_thread; - (void)Process::create_kernel_process(syncd_thread, KString::must_create("SyncTask"), [] { - dbgln("SyncTask is running"); + (void)Process::create_kernel_process(syncd_thread, KString::must_create("VFS Sync Task"), [] { + dbgln("VFS SyncTask is running"); for (;;) { VirtualFileSystem::sync(); (void)Thread::current()->sleep(Time::from_seconds(1)); diff --git a/Kernel/WorkQueue.cpp b/Kernel/WorkQueue.cpp index 71b3a2199fc..77978ff5ba7 100644 --- a/Kernel/WorkQueue.cpp +++ b/Kernel/WorkQueue.cpp @@ -16,7 +16,7 @@ WorkQueue* g_io_work; UNMAP_AFTER_INIT void WorkQueue::initialize() { - g_io_work = new WorkQueue("IO WorkQueue"); + g_io_work = new WorkQueue("IO WorkQueue Task"); } UNMAP_AFTER_INIT WorkQueue::WorkQueue(StringView name)