aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2014-02-04 20:24:19 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2014-02-04 20:24:19 -0500
commite089f30105729fa683bcc2e7faef36bcc93673b3 (patch)
tree48847dd6084d244cada5b3b0659daecbceeaf384
parent2771d317c25e63a94fd6b3fc5166e6b8d1c9cda4 (diff)
P-FP: Export cluster configuration to /proc.
This patch updated P-FP to support get_domain_proc_info().
-rw-r--r--litmus/sched_pfp.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/litmus/sched_pfp.c b/litmus/sched_pfp.c
index 01ac97d7f161..3a0157851702 100644
--- a/litmus/sched_pfp.c
+++ b/litmus/sched_pfp.c
@@ -21,6 +21,8 @@
21#include <litmus/trace.h> 21#include <litmus/trace.h>
22#include <litmus/budget.h> 22#include <litmus/budget.h>
23 23
24/* to set up domain/cpu mappings */
25#include <litmus/litmus_proc.h>
24#include <linux/uaccess.h> 26#include <linux/uaccess.h>
25 27
26 28
@@ -1681,6 +1683,43 @@ static long pfp_admit_task(struct task_struct* tsk)
1681 return -EINVAL; 1683 return -EINVAL;
1682} 1684}
1683 1685
1686static struct domain_proc_info pfp_domain_proc_info;
1687static long pfp_get_domain_proc_info(struct domain_proc_info **ret)
1688{
1689 *ret = &pfp_domain_proc_info;
1690 return 0;
1691}
1692
1693static void pfp_setup_domain_proc(void)
1694{
1695 int i, cpu;
1696 int release_master =
1697#ifdef CONFIG_RELEASE_MASTER
1698 atomic_read(&release_master_cpu);
1699#else
1700 NO_CPU;
1701#endif
1702 int num_rt_cpus = num_online_cpus() - (release_master != NO_CPU);
1703 struct cd_mapping *cpu_map, *domain_map;
1704
1705 memset(&pfp_domain_proc_info, sizeof(pfp_domain_proc_info), 0);
1706 init_domain_proc_info(&pfp_domain_proc_info, num_rt_cpus, num_rt_cpus);
1707 pfp_domain_proc_info.num_cpus = num_rt_cpus;
1708 pfp_domain_proc_info.num_domains = num_rt_cpus;
1709 for (cpu = 0, i = 0; cpu < num_online_cpus(); ++cpu) {
1710 if (cpu == release_master)
1711 continue;
1712 cpu_map = &pfp_domain_proc_info.cpu_to_domains[i];
1713 domain_map = &pfp_domain_proc_info.domain_to_cpus[i];
1714
1715 cpu_map->id = cpu;
1716 domain_map->id = i; /* enumerate w/o counting the release master */
1717 cpumask_set_cpu(i, cpu_map->mask);
1718 cpumask_set_cpu(cpu, domain_map->mask);
1719 ++i;
1720 }
1721}
1722
1684static long pfp_activate_plugin(void) 1723static long pfp_activate_plugin(void)
1685{ 1724{
1686#if defined(CONFIG_RELEASE_MASTER) || defined(CONFIG_LITMUS_LOCKING) 1725#if defined(CONFIG_RELEASE_MASTER) || defined(CONFIG_LITMUS_LOCKING)
@@ -1706,9 +1745,16 @@ static long pfp_activate_plugin(void)
1706 1745
1707#endif 1746#endif
1708 1747
1748 pfp_setup_domain_proc();
1749
1709 return 0; 1750 return 0;
1710} 1751}
1711 1752
1753static long pfp_deactivate_plugin(void)
1754{
1755 destroy_domain_proc_info(&pfp_domain_proc_info);
1756 return 0;
1757}
1712 1758
1713/* Plugin object */ 1759/* Plugin object */
1714static struct sched_plugin pfp_plugin __cacheline_aligned_in_smp = { 1760static struct sched_plugin pfp_plugin __cacheline_aligned_in_smp = {
@@ -1722,6 +1768,8 @@ static struct sched_plugin pfp_plugin __cacheline_aligned_in_smp = {
1722 .task_block = pfp_task_block, 1768 .task_block = pfp_task_block,
1723 .admit_task = pfp_admit_task, 1769 .admit_task = pfp_admit_task,
1724 .activate_plugin = pfp_activate_plugin, 1770 .activate_plugin = pfp_activate_plugin,
1771 .deactivate_plugin = pfp_deactivate_plugin,
1772 .get_domain_proc_info = pfp_get_domain_proc_info,
1725#ifdef CONFIG_LITMUS_LOCKING 1773#ifdef CONFIG_LITMUS_LOCKING
1726 .allocate_lock = pfp_allocate_lock, 1774 .allocate_lock = pfp_allocate_lock,
1727 .finish_switch = pfp_finish_switch, 1775 .finish_switch = pfp_finish_switch,