From b14a30bebd82bfd62fa1e34904982bf86a7b604e Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Sun, 12 May 2013 14:17:44 +0200 Subject: kern/thread: update kernel thread naming rules --- kern/thread.c | 22 +++++++++++----------- kern/thread.h | 10 +++++----- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/kern/thread.c b/kern/thread.c index e24e024b..0dd62e9e 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -1481,7 +1481,7 @@ thread_destroy(struct thread *thread) } static void -thread_reaper(void *arg) +thread_reap(void *arg) { struct thread_reap_waiter *tmp; struct list waiters; @@ -1521,17 +1521,17 @@ thread_setup_reaper(void) list_init(&thread_reap_list); attr.task = NULL; - attr.name = "x15_reaper"; + attr.name = "x15_thread_reap"; attr.policy = THREAD_SCHED_POLICY_TS; attr.priority = THREAD_SCHED_TS_PRIO_DEFAULT; - error = thread_create(&thread, &attr, thread_reaper, NULL); + error = thread_create(&thread, &attr, thread_reap, NULL); if (error) panic("thread: unable to create reaper thread"); } static void -thread_balancer_idle_tick(struct thread_runq *runq) +thread_balance_idle_tick(struct thread_runq *runq) { assert(runq->idle_balance_ticks != 0); @@ -1549,7 +1549,7 @@ thread_balancer_idle_tick(struct thread_runq *runq) } static void -thread_balancer(void *arg) +thread_balance(void *arg) { struct thread_runq *runq; struct thread *self; @@ -1585,12 +1585,12 @@ thread_setup_balancer(struct thread_runq *runq) struct thread *balancer; int error; - snprintf(name, sizeof(name), "x15_balancer/%u", thread_runq_id(runq)); + snprintf(name, sizeof(name), "x15_thread_balance/%u", thread_runq_id(runq)); attr.task = NULL; attr.name = name; attr.policy = THREAD_SCHED_POLICY_RR; attr.priority = THREAD_SCHED_RT_PRIO_MIN; - error = thread_create(&balancer, &attr, thread_balancer, runq); + error = thread_create(&balancer, &attr, thread_balance, runq); if (error) panic("thread: unable to create balancer thread"); @@ -1619,7 +1619,7 @@ thread_setup_balancer(struct thread_runq *runq) } static void -thread_idler(void *arg) +thread_idle(void *arg) { (void)arg; @@ -1645,11 +1645,11 @@ thread_setup_idler(struct thread_runq *runq) if (stack == NULL) panic("thread: unable to allocate idler thread stack"); - snprintf(name, sizeof(name), "x15_idler/%u", thread_runq_id(runq)); + snprintf(name, sizeof(name), "x15_thread_idle/%u", thread_runq_id(runq)); attr.task = kernel_task; attr.name = name; attr.policy = THREAD_SCHED_POLICY_IDLE; - thread_init(idler, stack, &attr, thread_idler, NULL); + thread_init(idler, stack, &attr, thread_idle, NULL); /* An idler thread needs special tuning */ idler->state = THREAD_RUNNING; @@ -1870,7 +1870,7 @@ thread_tick(void) spinlock_lock(&runq->lock); if (runq->nr_threads == 0) - thread_balancer_idle_tick(runq); + thread_balance_idle_tick(runq); thread_sched_ops[thread->sched_class].tick(runq, thread); diff --git a/kern/thread.h b/kern/thread.h index 2671d2dc..be2fcf36 100644 --- a/kern/thread.h +++ b/kern/thread.h @@ -24,11 +24,11 @@ * can be used for the normal SCHED_OTHER policy. The idle policy is reserved * for idling kernel threads. * - * By convention, the name of a kernel thread is built by prefixing the - * kernel name and adding the name of the start function, without the module - * name ("thread"). Threads that are bound to a processor also include the - * "/cpu_id" suffix. For example, "x15_balancer/1" is the name of the - * inter-processor balancing thread of the second processor. + * By convention, the name of a kernel thread is built by concatenating the + * kernel name and the name of the start function, separated with an underscore. + * Threads that are bound to a processor also include the "/cpu_id" suffix. + * For example, "x15_thread_balance/1" is the name of the inter-processor + * balancer thread of the second processor. */ #ifndef _KERN_THREAD_H -- cgit v1.2.3