diff options
Diffstat (limited to 'litmus/sched_gsn_edf.c')
-rw-r--r-- | litmus/sched_gsn_edf.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/litmus/sched_gsn_edf.c b/litmus/sched_gsn_edf.c index 073f0f4db821..207f4b65bcbc 100644 --- a/litmus/sched_gsn_edf.c +++ b/litmus/sched_gsn_edf.c | |||
@@ -28,6 +28,12 @@ | |||
28 | #ifdef CONFIG_SCHED_CPU_AFFINITY | 28 | #ifdef CONFIG_SCHED_CPU_AFFINITY |
29 | #include <litmus/affinity.h> | 29 | #include <litmus/affinity.h> |
30 | #endif | 30 | #endif |
31 | /* to set up domain/cpu mappings */ | ||
32 | #include <litmus/litmus_proc.h> | ||
33 | |||
34 | #ifdef CONFIG_SCHED_PGM | ||
35 | #include <litmus/pgm.h> | ||
36 | #endif | ||
31 | 37 | ||
32 | #ifdef CONFIG_SCHED_PGM | 38 | #ifdef CONFIG_SCHED_PGM |
33 | #include <litmus/pgm.h> | 39 | #include <litmus/pgm.h> |
@@ -1034,6 +1040,44 @@ static long gsnedf_allocate_lock(struct litmus_lock **lock, int type, | |||
1034 | 1040 | ||
1035 | #endif | 1041 | #endif |
1036 | 1042 | ||
1043 | static struct domain_proc_info gsnedf_domain_proc_info; | ||
1044 | static long gsnedf_get_domain_proc_info(struct domain_proc_info **ret) | ||
1045 | { | ||
1046 | *ret = &gsnedf_domain_proc_info; | ||
1047 | return 0; | ||
1048 | } | ||
1049 | |||
1050 | static void gsnedf_setup_domain_proc(void) | ||
1051 | { | ||
1052 | int i, cpu; | ||
1053 | int release_master = | ||
1054 | #ifdef CONFIG_RELEASE_MASTER | ||
1055 | atomic_read(&release_master_cpu); | ||
1056 | #else | ||
1057 | NO_CPU; | ||
1058 | #endif | ||
1059 | int num_rt_cpus = num_online_cpus() - (release_master != NO_CPU); | ||
1060 | struct cd_mapping *map; | ||
1061 | |||
1062 | memset(&gsnedf_domain_proc_info, sizeof(gsnedf_domain_proc_info), 0); | ||
1063 | init_domain_proc_info(&gsnedf_domain_proc_info, num_rt_cpus, 1); | ||
1064 | gsnedf_domain_proc_info.num_cpus = num_rt_cpus; | ||
1065 | gsnedf_domain_proc_info.num_domains = 1; | ||
1066 | |||
1067 | gsnedf_domain_proc_info.domain_to_cpus[0].id = 0; | ||
1068 | for (cpu = 0, i = 0; cpu < num_online_cpus(); ++cpu) { | ||
1069 | if (cpu == release_master) | ||
1070 | continue; | ||
1071 | map = &gsnedf_domain_proc_info.cpu_to_domains[i]; | ||
1072 | map->id = cpu; | ||
1073 | cpumask_set_cpu(0, map->mask); | ||
1074 | ++i; | ||
1075 | |||
1076 | /* add cpu to the domain */ | ||
1077 | cpumask_set_cpu(cpu, | ||
1078 | gsnedf_domain_proc_info.domain_to_cpus[0].mask); | ||
1079 | } | ||
1080 | } | ||
1037 | 1081 | ||
1038 | static long gsnedf_activate_plugin(void) | 1082 | static long gsnedf_activate_plugin(void) |
1039 | { | 1083 | { |
@@ -1061,6 +1105,15 @@ static long gsnedf_activate_plugin(void) | |||
1061 | } | 1105 | } |
1062 | #endif | 1106 | #endif |
1063 | } | 1107 | } |
1108 | |||
1109 | gsnedf_setup_domain_proc(); | ||
1110 | |||
1111 | return 0; | ||
1112 | } | ||
1113 | |||
1114 | static long gsnedf_deactivate_plugin(void) | ||
1115 | { | ||
1116 | destroy_domain_proc_info(&gsnedf_domain_proc_info); | ||
1064 | return 0; | 1117 | return 0; |
1065 | } | 1118 | } |
1066 | 1119 | ||
@@ -1077,6 +1130,8 @@ static struct sched_plugin gsn_edf_plugin __cacheline_aligned_in_smp = { | |||
1077 | .task_block = gsnedf_task_block, | 1130 | .task_block = gsnedf_task_block, |
1078 | .admit_task = gsnedf_admit_task, | 1131 | .admit_task = gsnedf_admit_task, |
1079 | .activate_plugin = gsnedf_activate_plugin, | 1132 | .activate_plugin = gsnedf_activate_plugin, |
1133 | .deactivate_plugin = gsnedf_deactivate_plugin, | ||
1134 | .get_domain_proc_info = gsnedf_get_domain_proc_info, | ||
1080 | #ifdef CONFIG_LITMUS_LOCKING | 1135 | #ifdef CONFIG_LITMUS_LOCKING |
1081 | .allocate_lock = gsnedf_allocate_lock, | 1136 | .allocate_lock = gsnedf_allocate_lock, |
1082 | #endif | 1137 | #endif |