aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2014-02-04 20:22:45 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2014-02-04 20:22:45 -0500
commit4bf793ee5c824c37313e7d20350d021d8c74b206 (patch)
tree1091dd338fc36631ddff8a99121424585506414c
parent473fb750671951ce18d886b8e11a1db05aea46a9 (diff)
G-EDF: Export cluster configuration to /proc
This patch updates G-EDF to support get_domain_proc_info().
-rw-r--r--litmus/sched_gsn_edf.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c
index 66ffa3e7a7bd..34e6cff9753e 100644
--- a/litmus/sched_gsn_edf.c
+++ b/litmus/sched_gsn_edf.c
@@ -29,6 +29,9 @@
29#include <litmus/affinity.h> 29#include <litmus/affinity.h>
30#endif 30#endif
31 31
32/* to set up domain/cpu mappings */
33#include <litmus/litmus_proc.h>
34
32#include <linux/module.h> 35#include <linux/module.h>
33 36
34/* Overview of GSN-EDF operations. 37/* Overview of GSN-EDF operations.
@@ -964,6 +967,44 @@ static long gsnedf_allocate_lock(struct litmus_lock **lock, int type,
964 967
965#endif 968#endif
966 969
970static struct domain_proc_info gsnedf_domain_proc_info;
971static long gsnedf_get_domain_proc_info(struct domain_proc_info **ret)
972{
973 *ret = &gsnedf_domain_proc_info;
974 return 0;
975}
976
977static void gsnedf_setup_domain_proc(void)
978{
979 int i, cpu;
980 int release_master =
981#ifdef CONFIG_RELEASE_MASTER
982 atomic_read(&release_master_cpu);
983#else
984 NO_CPU;
985#endif
986 int num_rt_cpus = num_online_cpus() - (release_master != NO_CPU);
987 struct cd_mapping *map;
988
989 memset(&gsnedf_domain_proc_info, sizeof(gsnedf_domain_proc_info), 0);
990 init_domain_proc_info(&gsnedf_domain_proc_info, num_rt_cpus, 1);
991 gsnedf_domain_proc_info.num_cpus = num_rt_cpus;
992 gsnedf_domain_proc_info.num_domains = 1;
993
994 gsnedf_domain_proc_info.domain_to_cpus[0].id = 0;
995 for (cpu = 0, i = 0; cpu < num_online_cpus(); ++cpu) {
996 if (cpu == release_master)
997 continue;
998 map = &gsnedf_domain_proc_info.cpu_to_domains[i];
999 map->id = cpu;
1000 cpumask_set_cpu(0, map->mask);
1001 ++i;
1002
1003 /* add cpu to the domain */
1004 cpumask_set_cpu(cpu,
1005 gsnedf_domain_proc_info.domain_to_cpus[0].mask);
1006 }
1007}
967 1008
968static long gsnedf_activate_plugin(void) 1009static long gsnedf_activate_plugin(void)
969{ 1010{
@@ -991,6 +1032,15 @@ static long gsnedf_activate_plugin(void)
991 } 1032 }
992#endif 1033#endif
993 } 1034 }
1035
1036 gsnedf_setup_domain_proc();
1037
1038 return 0;
1039}
1040
1041static long gsnedf_deactivate_plugin(void)
1042{
1043 destroy_domain_proc_info(&gsnedf_domain_proc_info);
994 return 0; 1044 return 0;
995} 1045}
996 1046
@@ -1007,6 +1057,8 @@ static struct sched_plugin gsn_edf_plugin __cacheline_aligned_in_smp = {
1007 .task_block = gsnedf_task_block, 1057 .task_block = gsnedf_task_block,
1008 .admit_task = gsnedf_admit_task, 1058 .admit_task = gsnedf_admit_task,
1009 .activate_plugin = gsnedf_activate_plugin, 1059 .activate_plugin = gsnedf_activate_plugin,
1060 .deactivate_plugin = gsnedf_deactivate_plugin,
1061 .get_domain_proc_info = gsnedf_get_domain_proc_info,
1010#ifdef CONFIG_LITMUS_LOCKING 1062#ifdef CONFIG_LITMUS_LOCKING
1011 .allocate_lock = gsnedf_allocate_lock, 1063 .allocate_lock = gsnedf_allocate_lock,
1012#endif 1064#endif