MEDIUM: task: Split the tasklet list into two lists.
As using an mt_list for the tasklet list is costly, instead use a regular list,
but add an mt_list for tasklet woken up by other threads, to be run on the
current thread. At the beginning of process_runnable_tasks(), we just take
the new list, and merge it into the task_list.
This should give us performances comparable to before we started using a
mt_list, but allow us to use tasklet_wakeup() from other threads.
diff --git a/include/types/task.h b/include/types/task.h
index 40304ee..fbefeef 100644
--- a/include/types/task.h
+++ b/include/types/task.h
@@ -61,7 +61,8 @@
struct task_per_thread {
struct eb_root timers; /* tree constituting the per-thread wait queue */
struct eb_root rqueue; /* tree constituting the per-thread run queue */
- struct mt_list task_list; /* List of tasks to be run, mixing tasks and tasklets */
+ struct list task_list; /* List of tasks to be run, mixing tasks and tasklets */
+ struct mt_list shared_tasklet_list; /* Tasklet to be run, woken up by other threads */
int task_list_size; /* Number of tasks in the task_list */
int rqueue_size; /* Number of elements in the per-thread run queue */
struct task *current; /* current task (not tasklet) */
@@ -95,7 +96,7 @@
/* lightweight tasks, without priority, mainly used for I/Os */
struct tasklet {
TASK_COMMON; /* must be at the beginning! */
- struct mt_list list;
+ struct list list;
int tid; /* TID of the tasklet owner */
};