aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_cedf.c
diff options
context:
space:
mode:
Diffstat (limited to 'litmus/sched_cedf.c')
-rw-r--r--litmus/sched_cedf.c64
1 files changed, 62 insertions, 2 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index 10ada7edadf2..33ea89e81eff 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -753,6 +753,55 @@ static void cleanup_cedf(void)
753 } 753 }
754} 754}
755 755
756static struct domain_proc_info cedf_domain_proc_info;
757static long cedf_get_domain_proc_info(struct domain_proc_info **ret)
758{
759 *ret = &cedf_domain_proc_info;
760 return 0;
761}
762
763static void cedf_setup_domain_proc(void)
764{
765 int i, cpu, domain;
766#ifdef CONFIG_RELEASE_MASTER
767 int release_master = atomic_read(&release_master_cpu);
768 /* skip over the domain with the release master if cluster size is 1 */
769 int skip_domain = (1 == cluster_size && release_master != NO_CPU) ?
770 release_master : NO_CPU;
771#else
772 int release_master = NO_CPU;
773 int skip_domain = NO_CPU;
774#endif
775 int num_rt_cpus = num_online_cpus() - (release_master != NO_CPU);
776 int num_rt_domains = num_clusters - (skip_domain != NO_CPU);
777 struct cd_mapping *map;
778
779 memset(&cedf_domain_proc_info, sizeof(cedf_domain_proc_info), 0);
780 init_domain_proc_info(&cedf_domain_proc_info, num_rt_cpus, num_rt_domains);
781 cedf_domain_proc_info.num_cpus = num_rt_cpus;
782 cedf_domain_proc_info.num_domains = num_rt_domains;
783
784 for (cpu = 0, i = 0; cpu < num_online_cpus(); ++cpu) {
785 if (cpu == release_master)
786 continue;
787 map = &cedf_domain_proc_info.cpu_to_domains[i];
788 /* pointer math to figure out the domain index */
789 domain = remote_cluster(cpu) - cedf;
790 map->id = cpu;
791 cpumask_set_cpu(domain, map->mask);
792 ++i;
793 }
794
795 for (domain = 0, i = 0; domain < num_clusters; ++domain) {
796 if (domain == skip_domain)
797 continue;
798 map = &cedf_domain_proc_info.domain_to_cpus[i];
799 map->id = i;
800 cpumask_copy(map->mask, cedf[domain].cpu_map);
801 ++i;
802 }
803}
804
756static long cedf_activate_plugin(void) 805static long cedf_activate_plugin(void)
757{ 806{
758 int i, j, cpu, ccpu, cpu_count; 807 int i, j, cpu, ccpu, cpu_count;
@@ -771,7 +820,7 @@ static long cedf_activate_plugin(void)
771 if(!zalloc_cpumask_var(&mask, GFP_ATOMIC)) 820 if(!zalloc_cpumask_var(&mask, GFP_ATOMIC))
772 return -ENOMEM; 821 return -ENOMEM;
773 822
774 if (unlikely(cluster_config == GLOBAL_CLUSTER)) { 823 if (cluster_config == GLOBAL_CLUSTER) {
775 cluster_size = num_online_cpus(); 824 cluster_size = num_online_cpus();
776 } else { 825 } else {
777 chk = get_shared_cpu_map(mask, 0, cluster_config); 826 chk = get_shared_cpu_map(mask, 0, cluster_config);
@@ -869,8 +918,17 @@ static long cedf_activate_plugin(void)
869 } 918 }
870 } 919 }
871 920
872 free_cpumask_var(mask);
873 clusters_allocated = 1; 921 clusters_allocated = 1;
922 free_cpumask_var(mask);
923
924 cedf_setup_domain_proc();
925
926 return 0;
927}
928
929static long cedf_deactivate_plugin(void)
930{
931 destroy_domain_proc_info(&cedf_domain_proc_info);
874 return 0; 932 return 0;
875} 933}
876 934
@@ -887,6 +945,8 @@ static struct sched_plugin cedf_plugin __cacheline_aligned_in_smp = {
887 .task_block = cedf_task_block, 945 .task_block = cedf_task_block,
888 .admit_task = cedf_admit_task, 946 .admit_task = cedf_admit_task,
889 .activate_plugin = cedf_activate_plugin, 947 .activate_plugin = cedf_activate_plugin,
948 .deactivate_plugin = cedf_deactivate_plugin,
949 .get_domain_proc_info = cedf_get_domain_proc_info,
890}; 950};
891 951
892static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL; 952static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL;