Infrastructure for plugsched
PATCH 1/28 Infrastructure for plugsched
Infrastructure for plugsched
To create the architecture for private per-cpu-scheduler functions we create kernel/scheduler.c which is to contain functions common to all schedulers.
We add include/linux/scheduler.h as a common point to enter all per scheduler information. In that we create the global sched_drv struct which will contain the pointers to each private scheduler equivalent of the common functions.
The current kernel/sched.c will be the unique file for "ingosched" or the default scheduler. I apologise that I couldn't think up a different name for it after I nicknamed it :P
Signed-off-by Con Kolivas <[email protected]>
include/linux/sched.h +3 -1
@@ -463,12 +463,12 @@ struct sched_domain { #endif }; +extern void cpu_attach_domain (struct sched_domain *sd,int cpu);#ifdef ARCH_HAS_SCHED_DOMAIN /* Useful helpers that arch setup code may use. Defined in kernel/sched.c */ extern cpumask_t cpu_isolated_map;extern void init_sched_build_groups (struct sched_group groups[],cpumask_t span,int (*group_fn)(int cpu)); -extern void cpu_attach_domain (struct sched_domain *sd,int cpu);#endif /* ARCH_HAS_SCHED_DOMAIN */ #endif /* CONFIG_SMP */
@@ -513,6 +513,8 @@ int set_current_groups(struct group_infostruct audit_context ;/* See audit.c */ struct mempolicy ; +#include <linux/scheduler.h> +struct task_struct {volatile long state;/* -1 unrunnable, 0 runnable, >0 stopped */ struct thread_info *thread_info;
include/linux/scheduler.h +34 -0
@@ -0,0 +1,34 @@ +struct sched_drv +{ +void (*sched_idle_next)(void ); +void (*set_oom_timeslice)(task_t *); +unsigned long (*nr_running)(void ); +unsigned long (*nr_uninterruptible)(void ); +unsigned long long (*nr_context_switches)(void ); +unsigned long (*nr_iowait)(void ); +int (*idle_cpu)(int ); +void (*init_idle)(task_t *,int ); +void (*exit)(task_t *); +void (*fork)(task_t *); +void (*init)(void ); +void (*init_smp)(void ); +void (*schedule)(void ); +void (*tick)(void ); +void (*tail)(task_t *); +int (*setscheduler)(pid_t ,int ,struct sched_param __user *); +void (*set_user_nice)(task_t *,long ); +long (*rr_get_interval)(pid_t ,struct timespec __user *); +long (*yield)(void ); +int (*task_curr)(const task_t *); +int (*task_nice)(const task_t *); +int (*task_prio)(const task_t *); +int (*try_to_wake_up)(task_t *,unsigned ,int ); +void (*wake_up_new_task)(task_t *,unsigned long ); +#ifdef CONFIG_SMP +int (*migration_init)(void ); +void (*exec)(void ); +int (*set_cpus_allowed)(task_t *,cpumask_t ); +void (*wait_task_inactive)(task_t *); +void (*cpu_attach_domain)(struct sched_domain *,int ); +#endif +};
kernel/scheduler.c +197 -0
197 lines not on this page · raw message