diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-08-25 14:56:51 -0400 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2011-08-25 14:56:51 -0400 |
commit | 0e059210db4aef3ed1cff173652c23f257ccfa20 (patch) | |
tree | d2a2ffcd1547f89ddbec5fdcb0866f13ebfd9ed0 | |
parent | 9f11e21f64d2398c1215bea3db1e2f1c76bb9030 (diff) |
fixed release_master in domains
-rw-r--r-- | litmus/sched_cedf.c | 112 | ||||
-rw-r--r-- | 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 = { | |||
769 | 769 | ||
770 | static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL; | 770 | static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL; |
771 | 771 | ||
772 | /* proc file interface to configure the cluster size */ | ||
773 | |||
774 | static int proc_read_cluster_size(char *page, char **start, | ||
775 | off_t off, int count, | ||
776 | int *eof, void *data) | ||
777 | { | ||
778 | int len; | ||
779 | if (cluster_index >= 1 && cluster_index <= 3) | ||
780 | len = snprintf(page, PAGE_SIZE, "L%d\n", cluster_index); | ||
781 | else | ||
782 | len = snprintf(page, PAGE_SIZE, "ALL\n"); | ||
783 | |||
784 | return len; | ||
785 | } | ||
786 | |||
787 | static int proc_write_cluster_size(struct file *file, | ||
788 | const char *buffer, | ||
789 | unsigned long count, | ||
790 | void *data) | ||
791 | { | ||
792 | int len; | ||
793 | /* L2, L3 */ | ||
794 | char cache_name[33]; | ||
795 | |||
796 | if(count > 32) | ||
797 | len = 32; | ||
798 | else | ||
799 | len = count; | ||
800 | |||
801 | if(copy_from_user(cache_name, buffer, len)) | ||
802 | return -EFAULT; | ||
803 | |||
804 | cache_name[len] = '\0'; | ||
805 | /* chomp name */ | ||
806 | if (len > 1 && cache_name[len - 1] == '\n') | ||
807 | cache_name[len - 1] = '\0'; | ||
808 | |||
809 | /* do a quick and dirty comparison to find the cluster size */ | ||
810 | if (!strcmp(cache_name, "L2")) | ||
811 | cluster_index = 2; | ||
812 | else if (!strcmp(cache_name, "L3")) | ||
813 | cluster_index = 3; | ||
814 | else if (!strcmp(cache_name, "L1")) | ||
815 | cluster_index = 1; | ||
816 | else if (!strcmp(cache_name, "ALL")) | ||
817 | cluster_index = num_online_cpus(); | ||
818 | else | ||
819 | printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name); | ||
820 | |||
821 | return len; | ||
822 | } | ||
823 | |||
824 | |||
825 | static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL; | ||
826 | |||
827 | |||
828 | /* proc file interface to configure the cluster size */ | ||
829 | |||
830 | static int proc_read_cluster_size(char *page, char **start, | ||
831 | off_t off, int count, | ||
832 | int *eof, void *data) | ||
833 | { | ||
834 | int len; | ||
835 | if (cluster_index >= 1 && cluster_index <= 3) | ||
836 | len = snprintf(page, PAGE_SIZE, "L%d\n", cluster_index); | ||
837 | else | ||
838 | len = snprintf(page, PAGE_SIZE, "ALL\n"); | ||
839 | |||
840 | return len; | ||
841 | } | ||
842 | |||
843 | static int proc_write_cluster_size(struct file *file, | ||
844 | const char *buffer, | ||
845 | unsigned long count, | ||
846 | void *data) | ||
847 | { | ||
848 | int len; | ||
849 | /* L2, L3 */ | ||
850 | char cache_name[33]; | ||
851 | |||
852 | if(count > 32) | ||
853 | len = 32; | ||
854 | else | ||
855 | len = count; | ||
856 | |||
857 | if(copy_from_user(cache_name, buffer, len)) | ||
858 | return -EFAULT; | ||
859 | |||
860 | cache_name[len] = '\0'; | ||
861 | /* chomp name */ | ||
862 | if (len > 1 && cache_name[len - 1] == '\n') | ||
863 | cache_name[len - 1] = '\0'; | ||
864 | |||
865 | /* do a quick and dirty comparison to find the cluster size */ | ||
866 | if (!strcmp(cache_name, "L2")) | ||
867 | cluster_index = 2; | ||
868 | else if (!strcmp(cache_name, "L3")) | ||
869 | cluster_index = 3; | ||
870 | else if (!strcmp(cache_name, "L1")) | ||
871 | cluster_index = 1; | ||
872 | else if (!strcmp(cache_name, "ALL")) | ||
873 | cluster_index = num_online_cpus(); | ||
874 | else | ||
875 | printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name); | ||
876 | |||
877 | return len; | ||
878 | } | ||
879 | |||
880 | |||
881 | static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL; | ||
882 | |||
883 | |||
884 | static int __init init_cedf(void) | 772 | static int __init init_cedf(void) |
885 | { | 773 | { |
886 | int err, fs; | 774 | 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]; | |||
125 | #define is_ghost(t) (tsk_rt(t)->job_params.is_ghost) | 125 | #define is_ghost(t) (tsk_rt(t)->job_params.is_ghost) |
126 | 126 | ||
127 | 127 | ||
128 | |||
128 | /* the cpus queue themselves according to priority in here */ | 129 | /* the cpus queue themselves according to priority in here */ |
129 | static struct bheap_node mc_heap_node_c[NR_CPUS], mc_heap_node_d[NR_CPUS]; | 130 | static struct bheap_node mc_heap_node_c[NR_CPUS], mc_heap_node_d[NR_CPUS]; |
130 | static struct bheap mc_cpu_heap_c, mc_cpu_heap_d; | 131 | static struct bheap mc_cpu_heap_c, mc_cpu_heap_d; |
@@ -143,8 +144,9 @@ DEFINE_PER_CPU(rt_domain_t, crit_b); | |||
143 | static rt_domain_t crit_c; | 144 | static rt_domain_t crit_c; |
144 | static rt_domain_t crit_d; | 145 | static rt_domain_t crit_d; |
145 | 146 | ||
146 | /* We use crit_c.ready_lock as a global lock */ | 147 | /* We use crit_c for shared globals */ |
147 | #define global_lock (crit_c.ready_lock) | 148 | #define global_lock (crit_c.ready_lock) |
149 | #define mc_release_master (crit_c.release_master) | ||
148 | 150 | ||
149 | /* BEGIN clone of edf_common.c to allow shared C/D run queue*/ | 151 | /* BEGIN clone of edf_common.c to allow shared C/D run queue*/ |
150 | 152 | ||
@@ -531,7 +533,7 @@ static noinline void unlink(struct task_struct* t) | |||
531 | struct watchdog_timer *timer; | 533 | struct watchdog_timer *timer; |
532 | 534 | ||
533 | if (unlikely(!t)) { | 535 | if (unlikely(!t)) { |
534 | TRACE_BUG_ON(!t); | 536 | BUG_ON(1); |
535 | return; | 537 | return; |
536 | } | 538 | } |
537 | 539 | ||
@@ -904,7 +906,7 @@ static struct task_struct* mc_schedule(struct task_struct * prev) | |||
904 | /* Bail out early if we are the release master. | 906 | /* Bail out early if we are the release master. |
905 | * The release master never schedules any real-time tasks. | 907 | * The release master never schedules any real-time tasks. |
906 | */ | 908 | */ |
907 | if (mc.release_master == entry->cpu) | 909 | if (mc_release_master == entry->cpu) |
908 | return NULL; | 910 | return NULL; |
909 | #endif | 911 | #endif |
910 | 912 | ||
@@ -1089,7 +1091,7 @@ static void mc_task_new(struct task_struct * t, int on_rq, int running) | |||
1089 | BUG_ON(entry->scheduled); | 1091 | BUG_ON(entry->scheduled); |
1090 | 1092 | ||
1091 | #ifdef CONFIG_RELEASE_MASTER | 1093 | #ifdef CONFIG_RELEASE_MASTER |
1092 | if (entry->cpu != mc.release_master) { | 1094 | if (entry->cpu != mc_release_master) { |
1093 | #endif | 1095 | #endif |
1094 | entry->scheduled = t; | 1096 | entry->scheduled = t; |
1095 | tsk_rt(t)->scheduled_on = task_cpu(t); | 1097 | tsk_rt(t)->scheduled_on = task_cpu(t); |
@@ -1201,7 +1203,8 @@ static long mc_activate_plugin(void) | |||
1201 | bheap_init(&mc_cpu_heap_c); | 1203 | bheap_init(&mc_cpu_heap_c); |
1202 | bheap_init(&mc_cpu_heap_d); | 1204 | bheap_init(&mc_cpu_heap_d); |
1203 | #ifdef CONFIG_RELEASE_MASTER | 1205 | #ifdef CONFIG_RELEASE_MASTER |
1204 | mc.release_master = atomic_read(&release_master_cpu); | 1206 | crit_c.release_master = atomic_read(&release_master_cpu); |
1207 | crit_d.release_master = crit_c.release_master; | ||
1205 | #endif | 1208 | #endif |
1206 | 1209 | ||
1207 | for_each_online_cpu(cpu) { | 1210 | for_each_online_cpu(cpu) { |
@@ -1212,7 +1215,7 @@ static long mc_activate_plugin(void) | |||
1212 | entry->linked = NULL; | 1215 | entry->linked = NULL; |
1213 | entry->scheduled = NULL; | 1216 | entry->scheduled = NULL; |
1214 | #ifdef CONFIG_RELEASE_MASTER | 1217 | #ifdef CONFIG_RELEASE_MASTER |
1215 | if (cpu != mc.release_master) { | 1218 | if (cpu != mc_release_master) { |
1216 | #endif | 1219 | #endif |
1217 | TRACE("MC: Initializing CPU #%d.\n", cpu); | 1220 | TRACE("MC: Initializing CPU #%d.\n", cpu); |
1218 | update_cpu_position(entry); | 1221 | update_cpu_position(entry); |