aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/sched_cedf.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-12-12 16:38:55 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-12-12 16:38:55 -0500
commit2ccc2c4cc981a68e703082e6e32f5483ad87b61c (patch)
tree8cc9c32d0909f6543080d3f125df0084ed9f6b82 /litmus/sched_cedf.c
parent9207c7f874e7754391fdf184187fc763455466c5 (diff)
Use num_online_gpus()
Note that num_online_gpus() merely reports the staticly configured maximum number of available GPUs. Will make dynamic in the future.
Diffstat (limited to 'litmus/sched_cedf.c')
-rw-r--r--litmus/sched_cedf.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index 35ea1544ce69..46de8041cf59 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -157,6 +157,13 @@ static unsigned int cluster_size;
157 157
158static int clusters_allocated = 0; 158static int clusters_allocated = 0;
159 159
160
161#if defined(CONFIG_LITMUS_NVIDIA) && defined(CONFIG_LITMUS_SOFTIRQD)
162static int num_gpu_clusters;
163static unsigned int gpu_cluster_size;
164#endif
165
166
160#ifdef CONFIG_LITMUS_DGL_SUPPORT 167#ifdef CONFIG_LITMUS_DGL_SUPPORT
161static raw_spinlock_t* cedf_get_dgl_spinlock(struct task_struct *t) 168static raw_spinlock_t* cedf_get_dgl_spinlock(struct task_struct *t)
162{ 169{
@@ -1653,18 +1660,11 @@ static void cleanup_cedf(void)
1653} 1660}
1654 1661
1655#if defined(CONFIG_LITMUS_NVIDIA) && defined(CONFIG_LITMUS_SOFTIRQD) 1662#if defined(CONFIG_LITMUS_NVIDIA) && defined(CONFIG_LITMUS_SOFTIRQD)
1656static int cedf_map_gpu_to_cpu(int gpu, int num_gpus) 1663static int cedf_map_gpu_to_cpu(int gpu)
1657{ 1664{
1658 /* TODO: Some sort of smart clustering on the PCIe bus topology */
1659 int num_gpu_clusters = num_clusters;
1660 unsigned int gpu_cluster_size = num_gpus / num_gpu_clusters;
1661 int cpu_cluster = gpu / gpu_cluster_size; 1665 int cpu_cluster = gpu / gpu_cluster_size;
1662 int default_cpu = cedf[cpu_cluster].cpus[0]->cpu; // first CPU in given cluster 1666 int default_cpu = cedf[cpu_cluster].cpus[0]->cpu; // first CPU in given cluster
1663 1667
1664 if(num_gpus % num_gpu_clusters != 0) {
1665 TRACE("GPU clusters are of non-uniform size!\n");
1666 }
1667
1668 TRACE("CPU %d is default for GPU %d interrupt threads.\n", default_cpu, gpu); 1668 TRACE("CPU %d is default for GPU %d interrupt threads.\n", default_cpu, gpu);
1669 1669
1670 return default_cpu; 1670 return default_cpu;
@@ -1717,6 +1717,17 @@ static long cedf_activate_plugin(void)
1717 printk(KERN_INFO "C-EDF: %d cluster(s) of size = %d\n", 1717 printk(KERN_INFO "C-EDF: %d cluster(s) of size = %d\n",
1718 num_clusters, cluster_size); 1718 num_clusters, cluster_size);
1719 1719
1720
1721#if defined(CONFIG_LITMUS_NVIDIA) && defined(CONFIG_LITMUS_SOFTIRQD)
1722 num_gpu_clusters = min(num_clusters, num_online_gpus());
1723 gpu_cluster_size = num_online_gpus() / num_gpu_clusters;
1724
1725 if (((num_online_gpus() % gpu_cluster_size) != 0) ||
1726 (num_gpu_clusters != num_clusters)) {
1727 printk(KERN_WARNING "C-EDF: GPUs not uniformly distributed among CPU clusters.\n");
1728 }
1729#endif
1730
1720 /* initialize clusters */ 1731 /* initialize clusters */
1721 cedf = kmalloc(num_clusters * sizeof(cedf_domain_t), GFP_ATOMIC); 1732 cedf = kmalloc(num_clusters * sizeof(cedf_domain_t), GFP_ATOMIC);
1722 for (i = 0; i < num_clusters; i++) { 1733 for (i = 0; i < num_clusters; i++) {