diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2014-02-04 20:23:53 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2014-02-04 20:23:53 -0500 |
commit | 2771d317c25e63a94fd6b3fc5166e6b8d1c9cda4 (patch) | |
tree | 0425e909452bbe1c18b39c0301c08807a2bde288 | |
parent | 4bf793ee5c824c37313e7d20350d021d8c74b206 (diff) |
PSN-EDF: Export cluster configuration to /proc.
This patch updated PSN-EDF to support get_domain_proc_info().
-rw-r--r-- | litmus/sched_psn_edf.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/litmus/sched_psn_edf.c b/litmus/sched_psn_edf.c index 0873dc172651..7546dcb95317 100644 --- a/litmus/sched_psn_edf.c +++ b/litmus/sched_psn_edf.c | |||
@@ -23,6 +23,9 @@ | |||
23 | #include <litmus/sched_trace.h> | 23 | #include <litmus/sched_trace.h> |
24 | #include <litmus/trace.h> | 24 | #include <litmus/trace.h> |
25 | 25 | ||
26 | /* to set up domain/cpu mappings */ | ||
27 | #include <litmus/litmus_proc.h> | ||
28 | |||
26 | typedef struct { | 29 | typedef struct { |
27 | rt_domain_t domain; | 30 | rt_domain_t domain; |
28 | int cpu; | 31 | int cpu; |
@@ -599,6 +602,43 @@ static long psnedf_allocate_lock(struct litmus_lock **lock, int type, | |||
599 | 602 | ||
600 | #endif | 603 | #endif |
601 | 604 | ||
605 | static struct domain_proc_info psnedf_domain_proc_info; | ||
606 | static long psnedf_get_domain_proc_info(struct domain_proc_info **ret) | ||
607 | { | ||
608 | *ret = &psnedf_domain_proc_info; | ||
609 | return 0; | ||
610 | } | ||
611 | |||
612 | static void psnedf_setup_domain_proc(void) | ||
613 | { | ||
614 | int i, cpu; | ||
615 | int release_master = | ||
616 | #ifdef CONFIG_RELEASE_MASTER | ||
617 | atomic_read(&release_master_cpu); | ||
618 | #else | ||
619 | NO_CPU; | ||
620 | #endif | ||
621 | int num_rt_cpus = num_online_cpus() - (release_master != NO_CPU); | ||
622 | struct cd_mapping *cpu_map, *domain_map; | ||
623 | |||
624 | memset(&psnedf_domain_proc_info, sizeof(psnedf_domain_proc_info), 0); | ||
625 | init_domain_proc_info(&psnedf_domain_proc_info, num_rt_cpus, num_rt_cpus); | ||
626 | psnedf_domain_proc_info.num_cpus = num_rt_cpus; | ||
627 | psnedf_domain_proc_info.num_domains = num_rt_cpus; | ||
628 | |||
629 | for (cpu = 0, i = 0; cpu < num_online_cpus(); ++cpu) { | ||
630 | if (cpu == release_master) | ||
631 | continue; | ||
632 | cpu_map = &psnedf_domain_proc_info.cpu_to_domains[i]; | ||
633 | domain_map = &psnedf_domain_proc_info.domain_to_cpus[i]; | ||
634 | |||
635 | cpu_map->id = cpu; | ||
636 | domain_map->id = i; /* enumerate w/o counting the release master */ | ||
637 | cpumask_set_cpu(i, cpu_map->mask); | ||
638 | cpumask_set_cpu(cpu, domain_map->mask); | ||
639 | ++i; | ||
640 | } | ||
641 | } | ||
602 | 642 | ||
603 | static long psnedf_activate_plugin(void) | 643 | static long psnedf_activate_plugin(void) |
604 | { | 644 | { |
@@ -614,6 +654,14 @@ static long psnedf_activate_plugin(void) | |||
614 | get_srp_prio = psnedf_get_srp_prio; | 654 | get_srp_prio = psnedf_get_srp_prio; |
615 | #endif | 655 | #endif |
616 | 656 | ||
657 | psnedf_setup_domain_proc(); | ||
658 | |||
659 | return 0; | ||
660 | } | ||
661 | |||
662 | static long psnedf_deactivate_plugin(void) | ||
663 | { | ||
664 | destroy_domain_proc_info(&psnedf_domain_proc_info); | ||
617 | return 0; | 665 | return 0; |
618 | } | 666 | } |
619 | 667 | ||
@@ -642,6 +690,8 @@ static struct sched_plugin psn_edf_plugin __cacheline_aligned_in_smp = { | |||
642 | .task_block = psnedf_task_block, | 690 | .task_block = psnedf_task_block, |
643 | .admit_task = psnedf_admit_task, | 691 | .admit_task = psnedf_admit_task, |
644 | .activate_plugin = psnedf_activate_plugin, | 692 | .activate_plugin = psnedf_activate_plugin, |
693 | .deactivate_plugin = psnedf_deactivate_plugin, | ||
694 | .get_domain_proc_info = psnedf_get_domain_proc_info, | ||
645 | #ifdef CONFIG_LITMUS_LOCKING | 695 | #ifdef CONFIG_LITMUS_LOCKING |
646 | .allocate_lock = psnedf_allocate_lock, | 696 | .allocate_lock = psnedf_allocate_lock, |
647 | #endif | 697 | #endif |