diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2014-02-04 20:24:57 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2014-02-04 20:24:57 -0500 |
commit | 99c500a966d2a94a6e012b00b4d4e324cfb6aa1c (patch) | |
tree | 96c5c4f82c733dc6ac8408e9b3d8f8920922babd | |
parent | e089f30105729fa683bcc2e7faef36bcc93673b3 (diff) |
PFAIR: Export cluster configuration to /proc.
This patch updated PFAIR to support get_domain_proc_info().
-rw-r--r-- | litmus/sched_pfair.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/litmus/sched_pfair.c b/litmus/sched_pfair.c index efe5e130da15..269049861362 100644 --- a/litmus/sched_pfair.c +++ b/litmus/sched_pfair.c | |||
@@ -940,6 +940,66 @@ static void cleanup_clusters(void) | |||
940 | } | 940 | } |
941 | } | 941 | } |
942 | 942 | ||
943 | static struct domain_proc_info pfair_domain_proc_info; | ||
944 | static long pfair_get_domain_proc_info(struct domain_proc_info **ret) | ||
945 | { | ||
946 | *ret = &pfair_domain_proc_info; | ||
947 | return 0; | ||
948 | } | ||
949 | |||
950 | static void pfair_setup_domain_proc(void) | ||
951 | { | ||
952 | int i, cpu, domain; | ||
953 | #ifdef CONFIG_RELEASE_MASTER | ||
954 | int release_master = atomic_read(&release_master_cpu); | ||
955 | /* skip over the domain with the release master if cluster size is 1 */ | ||
956 | int cluster_size = num_online_cpus() / num_pfair_clusters; | ||
957 | int skip_domain = (1 == cluster_size && release_master != NO_CPU) ? | ||
958 | release_master : NO_CPU; | ||
959 | #else | ||
960 | int release_master = NO_CPU; | ||
961 | int skip_domain = NO_CPU; | ||
962 | #endif | ||
963 | int num_rt_cpus = num_online_cpus() - (release_master != NO_CPU); | ||
964 | int num_rt_domains = num_pfair_clusters - (skip_domain != NO_CPU); | ||
965 | struct cd_mapping *map; | ||
966 | |||
967 | memset(&pfair_domain_proc_info, sizeof(pfair_domain_proc_info), 0); | ||
968 | init_domain_proc_info(&pfair_domain_proc_info, num_rt_cpus, num_pfair_clusters); | ||
969 | pfair_domain_proc_info.num_cpus = num_rt_cpus; | ||
970 | pfair_domain_proc_info.num_domains = num_rt_domains; | ||
971 | |||
972 | for (cpu = 0, i = 0; cpu < num_online_cpus(); ++cpu) { | ||
973 | if (cpu == release_master) | ||
974 | continue; | ||
975 | map = &pfair_domain_proc_info.cpu_to_domains[i]; | ||
976 | /* pointer math to figure out the domain index */ | ||
977 | domain = cpu_cluster(&per_cpu(pfair_state, cpu)) - pfair_clusters; | ||
978 | map->id = cpu; | ||
979 | cpumask_set_cpu(domain, map->mask); | ||
980 | ++i; | ||
981 | } | ||
982 | |||
983 | for (domain = 0, i = 0; domain < num_pfair_clusters; ++domain) { | ||
984 | struct pfair_cluster *cluster; | ||
985 | struct list_head *pos; | ||
986 | |||
987 | if (domain == skip_domain) | ||
988 | continue; | ||
989 | |||
990 | cluster = &pfair_clusters[domain]; | ||
991 | map = &pfair_domain_proc_info.domain_to_cpus[i]; | ||
992 | map->id = i; | ||
993 | |||
994 | list_for_each(pos, &cluster->topology.cpus) { | ||
995 | cpu = cpu_id(from_cluster_list(pos)); | ||
996 | if (cpu != release_master) | ||
997 | cpumask_set_cpu(cpu, map->mask); | ||
998 | } | ||
999 | ++i; | ||
1000 | } | ||
1001 | } | ||
1002 | |||
943 | static long pfair_activate_plugin(void) | 1003 | static long pfair_activate_plugin(void) |
944 | { | 1004 | { |
945 | int err, i; | 1005 | int err, i; |
@@ -994,6 +1054,8 @@ static long pfair_activate_plugin(void) | |||
994 | 1054 | ||
995 | if (err < 0) | 1055 | if (err < 0) |
996 | cleanup_clusters(); | 1056 | cleanup_clusters(); |
1057 | else | ||
1058 | pfair_setup_domain_proc(); | ||
997 | 1059 | ||
998 | return err; | 1060 | return err; |
999 | } | 1061 | } |
@@ -1001,6 +1063,7 @@ static long pfair_activate_plugin(void) | |||
1001 | static long pfair_deactivate_plugin(void) | 1063 | static long pfair_deactivate_plugin(void) |
1002 | { | 1064 | { |
1003 | cleanup_clusters(); | 1065 | cleanup_clusters(); |
1066 | destroy_domain_proc_info(&pfair_domain_proc_info); | ||
1004 | return 0; | 1067 | return 0; |
1005 | } | 1068 | } |
1006 | 1069 | ||
@@ -1018,6 +1081,7 @@ static struct sched_plugin pfair_plugin __cacheline_aligned_in_smp = { | |||
1018 | .complete_job = complete_job, | 1081 | .complete_job = complete_job, |
1019 | .activate_plugin = pfair_activate_plugin, | 1082 | .activate_plugin = pfair_activate_plugin, |
1020 | .deactivate_plugin = pfair_deactivate_plugin, | 1083 | .deactivate_plugin = pfair_deactivate_plugin, |
1084 | .get_domain_proc_info = pfair_get_domain_proc_info, | ||
1021 | }; | 1085 | }; |
1022 | 1086 | ||
1023 | 1087 | ||