diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2014-02-19 15:43:30 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2014-02-19 15:43:30 -0500 |
commit | c973f7f4766dd9194e4c7a52e971e29b224b9720 (patch) | |
tree | f3bd9bee5baf6183d205e4ae4bdc4f5c1aca1100 | |
parent | 8b10d67cc74a4dbe67aa3cb9e17281710f0d6017 (diff) |
Add sched domain proc support to C-FL
-rw-r--r-- | litmus/sched_cfl_split.c | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/litmus/sched_cfl_split.c b/litmus/sched_cfl_split.c index 8dc72c39dcb2..eef10f46c7e1 100644 --- a/litmus/sched_cfl_split.c +++ b/litmus/sched_cfl_split.c | |||
@@ -914,6 +914,55 @@ static void cleanup_cflsplit(void) | |||
914 | } | 914 | } |
915 | } | 915 | } |
916 | 916 | ||
917 | static struct domain_proc_info cflsplit_domain_proc_info; | ||
918 | static long cflsplit_get_domain_proc_info(struct domain_proc_info **ret) | ||
919 | { | ||
920 | *ret = &cflsplit_domain_proc_info; | ||
921 | return 0; | ||
922 | } | ||
923 | |||
924 | static void cflsplit_setup_domain_proc(void) | ||
925 | { | ||
926 | int i, cpu, domain; | ||
927 | #ifdef CONFIG_RELEASE_MASTER | ||
928 | int release_master = atomic_read(&release_master_cpu); | ||
929 | /* skip over the domain with the release master if cluster size is 1 */ | ||
930 | int skip_domain = (1 == cluster_size && release_master != NO_CPU) ? | ||
931 | release_master : NO_CPU; | ||
932 | #else | ||
933 | int release_master = NO_CPU; | ||
934 | int skip_domain = NO_CPU; | ||
935 | #endif | ||
936 | int num_rt_cpus = num_online_cpus() - (release_master != NO_CPU); | ||
937 | int num_rt_domains = num_clusters - (skip_domain != NO_CPU); | ||
938 | struct cd_mapping *map; | ||
939 | |||
940 | memset(&cflsplit_domain_proc_info, sizeof(cflsplit_domain_proc_info), 0); | ||
941 | init_domain_proc_info(&cflsplit_domain_proc_info, num_rt_cpus, num_rt_domains); | ||
942 | cflsplit_domain_proc_info.num_cpus = num_rt_cpus; | ||
943 | cflsplit_domain_proc_info.num_domains = num_rt_domains; | ||
944 | |||
945 | for (cpu = 0, i = 0; cpu < num_online_cpus(); ++cpu) { | ||
946 | if (cpu == release_master) | ||
947 | continue; | ||
948 | map = &cflsplit_domain_proc_info.cpu_to_domains[i]; | ||
949 | /* pointer math to figure out the domain index */ | ||
950 | domain = remote_cluster(cpu) - cflsplit; | ||
951 | map->id = cpu; | ||
952 | cpumask_set_cpu(domain, map->mask); | ||
953 | ++i; | ||
954 | } | ||
955 | |||
956 | for (domain = 0, i = 0; domain < num_clusters; ++domain) { | ||
957 | if (domain == skip_domain) | ||
958 | continue; | ||
959 | map = &cflsplit_domain_proc_info.domain_to_cpus[i]; | ||
960 | map->id = i; | ||
961 | cpumask_copy(map->mask, cflsplit[domain].cpu_map); | ||
962 | ++i; | ||
963 | } | ||
964 | } | ||
965 | |||
917 | static long cflsplit_activate_plugin(void) | 966 | static long cflsplit_activate_plugin(void) |
918 | { | 967 | { |
919 | int i, j, cpu, ccpu, cpu_count; | 968 | int i, j, cpu, ccpu, cpu_count; |
@@ -1035,8 +1084,17 @@ static long cflsplit_activate_plugin(void) | |||
1035 | } | 1084 | } |
1036 | } | 1085 | } |
1037 | 1086 | ||
1038 | free_cpumask_var(mask); | ||
1039 | clusters_allocated = 1; | 1087 | clusters_allocated = 1; |
1088 | free_cpumask_var(mask); | ||
1089 | |||
1090 | cflsplit_setup_domain_proc(); | ||
1091 | |||
1092 | return 0; | ||
1093 | } | ||
1094 | |||
1095 | static long cflsplit_deactivate_plugin(void) | ||
1096 | { | ||
1097 | destroy_domain_proc_info(&cflsplit_domain_proc_info); | ||
1040 | return 0; | 1098 | return 0; |
1041 | } | 1099 | } |
1042 | 1100 | ||
@@ -1054,6 +1112,8 @@ static struct sched_plugin cflsplit_plugin __cacheline_aligned_in_smp = { | |||
1054 | .task_block = cflsplit_task_block, | 1112 | .task_block = cflsplit_task_block, |
1055 | .admit_task = cflsplit_admit_task, | 1113 | .admit_task = cflsplit_admit_task, |
1056 | .activate_plugin = cflsplit_activate_plugin, | 1114 | .activate_plugin = cflsplit_activate_plugin, |
1115 | .deactivate_plugin = cflsplit_deactivate_plugin, | ||
1116 | .get_domain_proc_info = cflsplit_get_domain_proc_info, | ||
1057 | }; | 1117 | }; |
1058 | 1118 | ||
1059 | static struct proc_dir_entry *cluster_file = NULL, *cflsplit_dir = NULL; | 1119 | static struct proc_dir_entry *cluster_file = NULL, *cflsplit_dir = NULL; |