Make unique task_struct variables private
PATCH 17/28 Make unique task_struct variables private
Make unique task_struct variables private
The task_struct needs to be flexible enough to have private entries unique to each cpu scheduler design. Remove the variables that are likely to differ between designs and put them in a separate per-scheduler struct enclosed within a common union.
Remove the private data from INIT_TASK and place it into sched_init().
Update all entries in sched.c to reflect the new task_struct design.
Signed-off-by Con Kolivas <[email protected]>
include/linux/init_task.h +0 -5
@@ -72,14 +72,10 @@ extern struct group_info init_groups; .usage = ATOMIC_INIT(2), \ .flags = 0, \ .lock_depth = -1, \ - .prio = MAX_PRIO-20, \ - .static_prio = MAX_PRIO-20, \ .policy = SCHED_NORMAL, \ .cpus_allowed = CPU_MASK_ALL, \ .mm = NULL, \ .active_mm = &init_mm, \ - .run_list = LIST_HEAD_INIT(tsk.run_list), \ - .time_slice = HZ, \ .tasks = LIST_HEAD_INIT(tsk.tasks), \ .ptrace_children= LIST_HEAD_INIT(tsk.ptrace_children), \ .ptrace_list = LIST_HEAD_INIT(tsk.ptrace_list), \
@@ -115,5 +111,4 @@ extern struct group_info init_groups; .private_pages = LIST_HEAD_INIT(tsk.private_pages), \ .private_pages_count = 0, \ } -#endif
include/linux/sched.h +4 -9
@@ -524,18 +524,13 @@ struct task_struct {int lock_depth;/* Lock depth */ -int prio, static_prio; -struct list_head run_list; -prio_array_t *array; - -unsigned long sleep_avg; -long interactive_credit; -unsigned long long timestamp, last_ran; -int activated; +int static_prio;/* A commonality between cpu schedulers */ +union { +struct cpusched_ingo ingosched; + } u;unsigned long policy;cpumask_t cpus_allowed; -unsigned int time_slice, first_time_slice;#ifdef CONFIG_SCHEDSTATS struct sched_info sched_info;
include/linux/scheduler.h +13 -0
@@ -36,3 +36,16 @@ struct sched_drvvoid (*cpu_attach_domain)(struct sched_domain *,int );#endif }; + +struct cpusched_ingo { +int prio; +struct list_head run_list; +prio_array_t *array; +unsigned int time_slice; +unsigned int first_time_slice; +unsigned long sleep_avg; +long interactive_credit; +unsigned long timestamp; +unsigned long long last_ran; +int activated; +};
kernel/sched.c +129 -122
647 lines not on this page · raw message