From 0e059210db4aef3ed1cff173652c23f257ccfa20 Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Thu, 25 Aug 2011 14:56:51 -0400 Subject: fixed release_master in domains --- litmus/sched_cedf.c | 112 ---------------------------------------------------- litmus/sched_mc.c | 15 ++++--- 2 files changed, 9 insertions(+), 118 deletions(-) diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c index 16b09006a30b..73fe1c442a0d 100644 --- a/litmus/sched_cedf.c +++ b/litmus/sched_cedf.c @@ -769,118 +769,6 @@ static struct sched_plugin cedf_plugin __cacheline_aligned_in_smp = { static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL; -/* proc file interface to configure the cluster size */ - -static int proc_read_cluster_size(char *page, char **start, - off_t off, int count, - int *eof, void *data) -{ - int len; - if (cluster_index >= 1 && cluster_index <= 3) - len = snprintf(page, PAGE_SIZE, "L%d\n", cluster_index); - else - len = snprintf(page, PAGE_SIZE, "ALL\n"); - - return len; -} - -static int proc_write_cluster_size(struct file *file, - const char *buffer, - unsigned long count, - void *data) -{ - int len; - /* L2, L3 */ - char cache_name[33]; - - if(count > 32) - len = 32; - else - len = count; - - if(copy_from_user(cache_name, buffer, len)) - return -EFAULT; - - cache_name[len] = '\0'; - /* chomp name */ - if (len > 1 && cache_name[len - 1] == '\n') - cache_name[len - 1] = '\0'; - - /* do a quick and dirty comparison to find the cluster size */ - if (!strcmp(cache_name, "L2")) - cluster_index = 2; - else if (!strcmp(cache_name, "L3")) - cluster_index = 3; - else if (!strcmp(cache_name, "L1")) - cluster_index = 1; - else if (!strcmp(cache_name, "ALL")) - cluster_index = num_online_cpus(); - else - printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name); - - return len; -} - - -static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL; - - -/* proc file interface to configure the cluster size */ - -static int proc_read_cluster_size(char *page, char **start, - off_t off, int count, - int *eof, void *data) -{ - int len; - if (cluster_index >= 1 && cluster_index <= 3) - len = snprintf(page, PAGE_SIZE, "L%d\n", cluster_index); - else - len = snprintf(page, PAGE_SIZE, "ALL\n"); - - return len; -} - -static int proc_write_cluster_size(struct file *file, - const char *buffer, - unsigned long count, - void *data) -{ - int len; - /* L2, L3 */ - char cache_name[33]; - - if(count > 32) - len = 32; - else - len = count; - - if(copy_from_user(cache_name, buffer, len)) - return -EFAULT; - - cache_name[len] = '\0'; - /* chomp name */ - if (len > 1 && cache_name[len - 1] == '\n') - cache_name[len - 1] = '\0'; - - /* do a quick and dirty comparison to find the cluster size */ - if (!strcmp(cache_name, "L2")) - cluster_index = 2; - else if (!strcmp(cache_name, "L3")) - cluster_index = 3; - else if (!strcmp(cache_name, "L1")) - cluster_index = 1; - else if (!strcmp(cache_name, "ALL")) - cluster_index = num_online_cpus(); - else - printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name); - - return len; -} - - -static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL; - - static int __init init_cedf(void) { int err, fs; diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c index 3a4075371330..8e8ba0dfb870 100644 --- a/litmus/sched_mc.c +++ b/litmus/sched_mc.c @@ -125,6 +125,7 @@ cpu_entry_t* mc_cpus[NR_CPUS]; #define is_ghost(t) (tsk_rt(t)->job_params.is_ghost) + /* the cpus queue themselves according to priority in here */ static struct bheap_node mc_heap_node_c[NR_CPUS], mc_heap_node_d[NR_CPUS]; static struct bheap mc_cpu_heap_c, mc_cpu_heap_d; @@ -143,8 +144,9 @@ DEFINE_PER_CPU(rt_domain_t, crit_b); static rt_domain_t crit_c; static rt_domain_t crit_d; -/* We use crit_c.ready_lock as a global lock */ +/* We use crit_c for shared globals */ #define global_lock (crit_c.ready_lock) +#define mc_release_master (crit_c.release_master) /* BEGIN clone of edf_common.c to allow shared C/D run queue*/ @@ -531,7 +533,7 @@ static noinline void unlink(struct task_struct* t) struct watchdog_timer *timer; if (unlikely(!t)) { - TRACE_BUG_ON(!t); + BUG_ON(1); return; } @@ -904,7 +906,7 @@ static struct task_struct* mc_schedule(struct task_struct * prev) /* Bail out early if we are the release master. * The release master never schedules any real-time tasks. */ - if (mc.release_master == entry->cpu) + if (mc_release_master == entry->cpu) return NULL; #endif @@ -1089,7 +1091,7 @@ static void mc_task_new(struct task_struct * t, int on_rq, int running) BUG_ON(entry->scheduled); #ifdef CONFIG_RELEASE_MASTER - if (entry->cpu != mc.release_master) { + if (entry->cpu != mc_release_master) { #endif entry->scheduled = t; tsk_rt(t)->scheduled_on = task_cpu(t); @@ -1201,7 +1203,8 @@ static long mc_activate_plugin(void) bheap_init(&mc_cpu_heap_c); bheap_init(&mc_cpu_heap_d); #ifdef CONFIG_RELEASE_MASTER - mc.release_master = atomic_read(&release_master_cpu); + crit_c.release_master = atomic_read(&release_master_cpu); + crit_d.release_master = crit_c.release_master; #endif for_each_online_cpu(cpu) { @@ -1212,7 +1215,7 @@ static long mc_activate_plugin(void) entry->linked = NULL; entry->scheduled = NULL; #ifdef CONFIG_RELEASE_MASTER - if (cpu != mc.release_master) { + if (cpu != mc_release_master) { #endif TRACE("MC: Initializing CPU #%d.\n", cpu); update_cpu_position(entry); -- cgit v1.2.2