aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-20 16:14:00 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-20 16:14:00 -0400
commit22ee2a4c8fe3f66dc46e8ed9063301af42217351 (patch)
tree8d3d23f46f5db9e0534e585aa6bf9590f1d4aaba
parent31bda91ac81260e26a76ffa2b7004a2dbeab86fb (diff)
Add support for one single cluster (all cpus) on C-EDF
- With the "ALL" cluster size option the behavior of C-EDF is equivalent to G-EDF (one single cluster)
-rw-r--r--litmus/litmus.c6
-rw-r--r--litmus/sched_cedf.c38
2 files changed, 31 insertions, 13 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c
index e43596a5104c..c14203e6f611 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -575,8 +575,10 @@ static int proc_read_cluster_size(char *page, char **start,
575 len = snprintf(page, PAGE_SIZE, "L2\n"); 575 len = snprintf(page, PAGE_SIZE, "L2\n");
576 else if (cluster_cache_index == 3) 576 else if (cluster_cache_index == 3)
577 len = snprintf(page, PAGE_SIZE, "L3\n"); 577 len = snprintf(page, PAGE_SIZE, "L3\n");
578 else /* (cluster_cache_index == 1) */ 578 else if (cluster_cache_index == 1)
579 len = snprintf(page, PAGE_SIZE, "L1\n"); 579 len = snprintf(page, PAGE_SIZE, "L1\n");
580 else
581 len = snprintf(page, PAGE_SIZE, "ALL\n");
580 582
581 return len; 583 return len;
582} 584}
@@ -610,6 +612,8 @@ static int proc_write_cluster_size(struct file *file,
610 cluster_cache_index = 3; 612 cluster_cache_index = 3;
611 else if (!strcmp(cache_name, "L1")) 613 else if (!strcmp(cache_name, "L1"))
612 cluster_cache_index = 1; 614 cluster_cache_index = 1;
615 else if (!strcmp(cache_name, "ALL"))
616 cluster_cache_index = num_online_cpus();
613 else 617 else
614 printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name); 618 printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name);
615 619
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index da44b451c9ad..0e292aa7b97c 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -12,10 +12,14 @@
12 * the programmer needs to be aware of the topology to place tasks 12 * the programmer needs to be aware of the topology to place tasks
13 * in the desired cluster 13 * in the desired cluster
14 * - default clustering is around L2 cache (cache index = 2) 14 * - default clustering is around L2 cache (cache index = 2)
15 * supported clusters are: L1 (private cache: pedf), L2, L3 15 * supported clusters are: L1 (private cache: pedf), L2, L3, ALL (all
16 * online_cpus are placed in a single cluster).
16 * 17 *
17 * For details on functions, take a look at sched_gsn_edf.c 18 * For details on functions, take a look at sched_gsn_edf.c
18 * 19 *
20 * Currently, we do not support changes in the number of online cpus.
21 * If the num_online_cpus() dynamically changes, the plugin is broken.
22 *
19 * This version uses the simple approach and serializes all scheduling 23 * This version uses the simple approach and serializes all scheduling
20 * decisions by the use of a queue lock. This is probably not the 24 * decisions by the use of a queue lock. This is probably not the
21 * best way to do it, but it should suffice for now. 25 * best way to do it, but it should suffice for now.
@@ -640,17 +644,23 @@ static long cedf_activate_plugin(void)
640 if(!zalloc_cpumask_var(&mask, GFP_ATOMIC)) 644 if(!zalloc_cpumask_var(&mask, GFP_ATOMIC))
641 return -ENOMEM; 645 return -ENOMEM;
642 646
643 chk = get_shared_cpu_map(mask, 0, cluster_cache_index); 647 if (unlikely(cluster_cache_index == num_online_cpus())) {
644 if (chk) { 648
645 /* if chk != 0 then it is the max allowed index */ 649 cluster_size = num_online_cpus();
646 printk(KERN_INFO "C-EDF: Cannot support cache index = %d\n", 650 } else {
647 cluster_cache_index);
648 printk(KERN_INFO "C-EDF: Using cache index = %d\n",
649 chk);
650 cluster_cache_index = chk;
651 }
652 651
653 cluster_size = cpumask_weight(mask); 652 chk = get_shared_cpu_map(mask, 0, cluster_cache_index);
653 if (chk) {
654 /* if chk != 0 then it is the max allowed index */
655 printk(KERN_INFO "C-EDF: Cannot support cache index = %d\n",
656 cluster_cache_index);
657 printk(KERN_INFO "C-EDF: Using cache index = %d\n",
658 chk);
659 cluster_cache_index = chk;
660 }
661
662 cluster_size = cpumask_weight(mask);
663 }
654 664
655 if ((num_online_cpus() % cluster_size) != 0) { 665 if ((num_online_cpus() % cluster_size) != 0) {
656 /* this can't be right, some cpus are left out */ 666 /* this can't be right, some cpus are left out */
@@ -693,7 +703,11 @@ static long cedf_activate_plugin(void)
693 703
694 /* this cpu isn't in any cluster */ 704 /* this cpu isn't in any cluster */
695 /* get the shared cpus */ 705 /* get the shared cpus */
696 get_shared_cpu_map(mask, cpu, cluster_cache_index); 706 if (unlikely(cluster_cache_index == num_online_cpus()))
707 cpumask_copy(mask, cpu_online_mask);
708 else
709 get_shared_cpu_map(mask, cpu, cluster_cache_index);
710
697 cpumask_copy(cedf[i].cpu_map, mask); 711 cpumask_copy(cedf[i].cpu_map, mask);
698#ifdef VERBOSE_INIT 712#ifdef VERBOSE_INIT
699 print_cluster_topology(mask, cpu); 713 print_cluster_topology(mask, cpu);