diff options
| author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-20 16:14:00 -0400 |
|---|---|---|
| committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 11:28:20 -0400 |
| commit | de2d5dfa2dce8ec40555b3bb6dfe21627e472c52 (patch) | |
| tree | 9dd7909e70b4f3c669ce3c58be75396cad0ed820 | |
| parent | 6f89d4f31485546674187cf3b4d472f230b263d0 (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.c | 6 | ||||
| -rw-r--r-- | litmus/sched_cedf.c | 38 |
2 files changed, 31 insertions, 13 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c index 86ad5b375934..b71fc819eb51 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 82c9682eefbd..f5b77080cc4f 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. |
| @@ -643,17 +647,23 @@ static long cedf_activate_plugin(void) | |||
| 643 | if(!zalloc_cpumask_var(&mask, GFP_ATOMIC)) | 647 | if(!zalloc_cpumask_var(&mask, GFP_ATOMIC)) |
| 644 | return -ENOMEM; | 648 | return -ENOMEM; |
| 645 | 649 | ||
| 646 | chk = get_shared_cpu_map(mask, 0, cluster_cache_index); | 650 | if (unlikely(cluster_cache_index == num_online_cpus())) { |
| 647 | if (chk) { | 651 | |
| 648 | /* if chk != 0 then it is the max allowed index */ | 652 | cluster_size = num_online_cpus(); |
| 649 | printk(KERN_INFO "C-EDF: Cannot support cache index = %d\n", | 653 | } else { |
| 650 | cluster_cache_index); | ||
| 651 | printk(KERN_INFO "C-EDF: Using cache index = %d\n", | ||
| 652 | chk); | ||
| 653 | cluster_cache_index = chk; | ||
| 654 | } | ||
| 655 | 654 | ||
| 656 | cluster_size = cpumask_weight(mask); | 655 | chk = get_shared_cpu_map(mask, 0, cluster_cache_index); |
| 656 | if (chk) { | ||
| 657 | /* if chk != 0 then it is the max allowed index */ | ||
| 658 | printk(KERN_INFO "C-EDF: Cannot support cache index = %d\n", | ||
| 659 | cluster_cache_index); | ||
| 660 | printk(KERN_INFO "C-EDF: Using cache index = %d\n", | ||
| 661 | chk); | ||
| 662 | cluster_cache_index = chk; | ||
| 663 | } | ||
| 664 | |||
| 665 | cluster_size = cpumask_weight(mask); | ||
| 666 | } | ||
| 657 | 667 | ||
| 658 | if ((num_online_cpus() % cluster_size) != 0) { | 668 | if ((num_online_cpus() % cluster_size) != 0) { |
| 659 | /* this can't be right, some cpus are left out */ | 669 | /* this can't be right, some cpus are left out */ |
| @@ -696,7 +706,11 @@ static long cedf_activate_plugin(void) | |||
| 696 | 706 | ||
| 697 | /* this cpu isn't in any cluster */ | 707 | /* this cpu isn't in any cluster */ |
| 698 | /* get the shared cpus */ | 708 | /* get the shared cpus */ |
| 699 | get_shared_cpu_map(mask, cpu, cluster_cache_index); | 709 | if (unlikely(cluster_cache_index == num_online_cpus())) |
| 710 | cpumask_copy(mask, cpu_online_mask); | ||
| 711 | else | ||
| 712 | get_shared_cpu_map(mask, cpu, cluster_cache_index); | ||
| 713 | |||
| 700 | cpumask_copy(cedf[i].cpu_map, mask); | 714 | cpumask_copy(cedf[i].cpu_map, mask); |
| 701 | #ifdef VERBOSE_INIT | 715 | #ifdef VERBOSE_INIT |
| 702 | print_cluster_topology(mask, cpu); | 716 | print_cluster_topology(mask, cpu); |
