summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2014-01-02 23:38:19 +0100
committerRichard Braun <rbraun@sceen.net>2014-01-02 23:38:19 +0100
commit8ad09341a41f54c846296a4265d0914f24e5a69b (patch)
tree46b1454b40e530c414d8ffa1466ac58ce10f6da3 /kern
parent73cb08aea72483f509d774630a63006b9338c1ad (diff)
Declare variables as read mostly where appropriate
Diffstat (limited to 'kern')
-rw-r--r--kern/kmem.c4
-rw-r--r--kern/task.c5
-rw-r--r--kern/thread.c8
-rw-r--r--kern/work.c5
4 files changed, 13 insertions, 9 deletions
diff --git a/kern/kmem.c b/kern/kmem.c
index 0a5562a1..b5293335 100644
--- a/kern/kmem.c
+++ b/kern/kmem.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2011, 2012, 2013 Richard Braun.
+ * Copyright (c) 2010-2014 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -124,7 +124,7 @@
*
* See struct kmem_cpu_pool_type for a description of the values.
*/
-static struct kmem_cpu_pool_type kmem_cpu_pool_types[] = {
+static struct kmem_cpu_pool_type kmem_cpu_pool_types[] __read_mostly = {
{ 32768, 1, 0, NULL },
{ 4096, 8, CPU_L1_SIZE, NULL },
{ 256, 64, CPU_L1_SIZE, NULL },
diff --git a/kern/task.c b/kern/task.c
index 6909cb32..4cc87ca7 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012 Richard Braun.
+ * Copyright (c) 2012-2014 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
#include <kern/init.h>
#include <kern/kmem.h>
#include <kern/list.h>
+#include <kern/param.h>
#include <kern/spinlock.h>
#include <kern/stddef.h>
#include <kern/string.h>
@@ -31,7 +32,7 @@
* Kernel task and storage.
*/
static struct task kernel_task_store;
-struct task *kernel_task = &kernel_task_store;
+struct task *kernel_task __read_mostly = &kernel_task_store;
/*
* Cache for allocated tasks.
diff --git a/kern/thread.c b/kern/thread.c
index 3ee8da93..c0b18cde 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2013 Richard Braun.
+ * Copyright (c) 2012-2014 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -234,12 +234,14 @@ static struct kmem_cache thread_stack_cache;
/*
* Table used to quickly map policies to classes.
*/
-static unsigned char thread_policy_table[THREAD_NR_SCHED_POLICIES];
+static unsigned char thread_policy_table[THREAD_NR_SCHED_POLICIES]
+ __read_mostly;
/*
* Scheduling class operations.
*/
-static struct thread_sched_ops thread_sched_ops[THREAD_NR_SCHED_CLASSES];
+static struct thread_sched_ops thread_sched_ops[THREAD_NR_SCHED_CLASSES]
+ __read_mostly;
/*
* Map of run queues for which a processor is running.
diff --git a/kern/work.c b/kern/work.c
index 433f6383..2a08cee0 100644
--- a/kern/work.c
+++ b/kern/work.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013 Richard Braun.
+ * Copyright (c) 2013-2014 Richard Braun.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -23,6 +23,7 @@
#include <kern/list.h>
#include <kern/mutex.h>
#include <kern/panic.h>
+#include <kern/param.h>
#include <kern/printk.h>
#include <kern/rdxtree.h>
#include <kern/spinlock.h>
@@ -97,7 +98,7 @@ static struct work_pool work_pool_highprio;
static struct kmem_cache work_thread_cache;
-static unsigned int work_max_threads;
+static unsigned int work_max_threads __read_mostly;
static int
work_pool_alloc_id(struct work_pool *pool, struct work_thread *worker,