aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-20 16:31:20 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-20 16:31:20 -0400
commit960145eb829ae7a7b2d029e987f99a6be7a78d6b (patch)
tree1cf511e0758b3e2d033a03e6bccf5df7784626af
parent8b637fddc7f9a91febdb7fb398ac0a5f97d491ee (diff)
parent22ee2a4c8fe3f66dc46e8ed9063301af42217351 (diff)
Merge branch 'wip-cedf-merge-master'
-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 8b8f2c171a5e..5bf848386e1c 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -582,8 +582,10 @@ static int proc_read_cluster_size(char *page, char **start,
582 len = snprintf(page, PAGE_SIZE, "L2\n"); 582 len = snprintf(page, PAGE_SIZE, "L2\n");
583 else if (cluster_cache_index == 3) 583 else if (cluster_cache_index == 3)
584 len = snprintf(page, PAGE_SIZE, "L3\n"); 584 len = snprintf(page, PAGE_SIZE, "L3\n");
585 else /* (cluster_cache_index == 1) */ 585 else if (cluster_cache_index == 1)
586 len = snprintf(page, PAGE_SIZE, "L1\n"); 586 len = snprintf(page, PAGE_SIZE, "L1\n");
587 else
588 len = snprintf(page, PAGE_SIZE, "ALL\n");
587 589
588 return len; 590 return len;
589} 591}
@@ -617,6 +619,8 @@ static int proc_write_cluster_size(struct file *file,
617 cluster_cache_index = 3; 619 cluster_cache_index = 3;
618 else if (!strcmp(cache_name, "L1")) 620 else if (!strcmp(cache_name, "L1"))
619 cluster_cache_index = 1; 621 cluster_cache_index = 1;
622 else if (!strcmp(cache_name, "ALL"))
623 cluster_cache_index = num_online_cpus();
620 else 624 else
621 printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name); 625 printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name);
622 626
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index 76706a29245e..e57a11afda16 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.
@@ -642,17 +646,23 @@ static long cedf_activate_plugin(void)
642 if(!zalloc_cpumask_var(&mask, GFP_ATOMIC)) 646 if(!zalloc_cpumask_var(&mask, GFP_ATOMIC))
643 return -ENOMEM; 647 return -ENOMEM;
644 648
645 chk = get_shared_cpu_map(mask, 0, cluster_cache_index); 649 if (unlikely(cluster_cache_index == num_online_cpus())) {
646 if (chk) { 650
647 /* if chk != 0 then it is the max allowed index */ 651 cluster_size = num_online_cpus();
648 printk(KERN_INFO "C-EDF: Cannot support cache index = %d\n", 652 } else {
649 cluster_cache_index);
650 printk(KERN_INFO "C-EDF: Using cache index = %d\n",
651 chk);
652 cluster_cache_index = chk;
653 }
654 653
655 cluster_size = cpumask_weight(mask); 654 chk = get_shared_cpu_map(mask, 0, cluster_cache_index);
655 if (chk) {
656 /* if chk != 0 then it is the max allowed index */
657 printk(KERN_INFO "C-EDF: Cannot support cache index = %d\n",
658 cluster_cache_index);
659 printk(KERN_INFO "C-EDF: Using cache index = %d\n",
660 chk);
661 cluster_cache_index = chk;
662 }
663
664 cluster_size = cpumask_weight(mask);
665 }
656 666
657 if ((num_online_cpus() % cluster_size) != 0) { 667 if ((num_online_cpus() % cluster_size) != 0) {
658 /* this can't be right, some cpus are left out */ 668 /* this can't be right, some cpus are left out */
@@ -695,7 +705,11 @@ static long cedf_activate_plugin(void)
695 705
696 /* this cpu isn't in any cluster */ 706 /* this cpu isn't in any cluster */
697 /* get the shared cpus */ 707 /* get the shared cpus */
698 get_shared_cpu_map(mask, cpu, cluster_cache_index); 708 if (unlikely(cluster_cache_index == num_online_cpus()))
709 cpumask_copy(mask, cpu_online_mask);
710 else
711 get_shared_cpu_map(mask, cpu, cluster_cache_index);
712
699 cpumask_copy(cedf[i].cpu_map, mask); 713 cpumask_copy(cedf[i].cpu_map, mask);
700#ifdef VERBOSE_INIT 714#ifdef VERBOSE_INIT
701 print_cluster_topology(mask, cpu); 715 print_cluster_topology(mask, cpu);