aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/litmus.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-28 10:51:01 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-29 17:43:59 -0400
commit7c1ff4c544dd650cceff3cd69a04bcba60856678 (patch)
tree76d2dee2a96363f283b9440d46d1ed8be4fa3aff /litmus/litmus.c
parent425a6b5043bcc2142804107c853f978ac2fe3040 (diff)
Add C-EDF Plugin2010.1
Improved C-EDF plugin. C-EDF now supports different cluster sizes (based on L2 and L3 cache sharing) and supports dynamic changes of cluster size (this requires reloading the plugin).
Diffstat (limited to 'litmus/litmus.c')
-rw-r--r--litmus/litmus.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/litmus/litmus.c b/litmus/litmus.c
index 3ef2df8ffb50..e43596a5104c 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -566,6 +566,55 @@ static int proc_write_curr(struct file *file,
566 return len; 566 return len;
567} 567}
568 568
569static int proc_read_cluster_size(char *page, char **start,
570 off_t off, int count,
571 int *eof, void *data)
572{
573 int len;
574 if (cluster_cache_index == 2)
575 len = snprintf(page, PAGE_SIZE, "L2\n");
576 else if (cluster_cache_index == 3)
577 len = snprintf(page, PAGE_SIZE, "L3\n");
578 else /* (cluster_cache_index == 1) */
579 len = snprintf(page, PAGE_SIZE, "L1\n");
580
581 return len;
582}
583
584static int proc_write_cluster_size(struct file *file,
585 const char *buffer,
586 unsigned long count,
587 void *data)
588{
589 int len;
590 /* L2, L3 */
591 char cache_name[33];
592
593 if(count > 32)
594 len = 32;
595 else
596 len = count;
597
598 if(copy_from_user(cache_name, buffer, len))
599 return -EFAULT;
600
601 cache_name[len] = '\0';
602 /* chomp name */
603 if (len > 1 && cache_name[len - 1] == '\n')
604 cache_name[len - 1] = '\0';
605
606 /* do a quick and dirty comparison to find the cluster size */
607 if (!strcmp(cache_name, "L2"))
608 cluster_cache_index = 2;
609 else if (!strcmp(cache_name, "L3"))
610 cluster_cache_index = 3;
611 else if (!strcmp(cache_name, "L1"))
612 cluster_cache_index = 1;
613 else
614 printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name);
615
616 return len;
617}
569 618
570static int proc_read_release_master(char *page, char **start, 619static int proc_read_release_master(char *page, char **start,
571 off_t off, int count, 620 off_t off, int count,
@@ -621,6 +670,7 @@ static struct proc_dir_entry *litmus_dir = NULL,
621 *curr_file = NULL, 670 *curr_file = NULL,
622 *stat_file = NULL, 671 *stat_file = NULL,
623 *plugs_file = NULL, 672 *plugs_file = NULL,
673 *clus_cache_idx_file = NULL,
624 *release_master_file = NULL; 674 *release_master_file = NULL;
625 675
626static int __init init_litmus_proc(void) 676static int __init init_litmus_proc(void)
@@ -651,6 +701,16 @@ static int __init init_litmus_proc(void)
651 release_master_file->read_proc = proc_read_release_master; 701 release_master_file->read_proc = proc_read_release_master;
652 release_master_file->write_proc = proc_write_release_master; 702 release_master_file->write_proc = proc_write_release_master;
653 703
704 clus_cache_idx_file = create_proc_entry("cluster_cache",
705 0644, litmus_dir);
706 if (!clus_cache_idx_file) {
707 printk(KERN_ERR "Could not allocate cluster_cache "
708 "procfs entry.\n");
709 return -ENOMEM;
710 }
711 clus_cache_idx_file->read_proc = proc_read_cluster_size;
712 clus_cache_idx_file->write_proc = proc_write_cluster_size;
713
654 stat_file = create_proc_read_entry("stats", 0444, litmus_dir, 714 stat_file = create_proc_read_entry("stats", 0444, litmus_dir,
655 proc_read_stats, NULL); 715 proc_read_stats, NULL);
656 716
@@ -668,6 +728,10 @@ static void exit_litmus_proc(void)
668 remove_proc_entry("stats", litmus_dir); 728 remove_proc_entry("stats", litmus_dir);
669 if (curr_file) 729 if (curr_file)
670 remove_proc_entry("active_plugin", litmus_dir); 730 remove_proc_entry("active_plugin", litmus_dir);
731 if (clus_cache_idx_file)
732 remove_proc_entry("cluster_cache", litmus_dir);
733 if (release_master_file)
734 remove_proc_entry("release_master", litmus_dir);
671 if (litmus_dir) 735 if (litmus_dir)
672 remove_proc_entry("litmus", NULL); 736 remove_proc_entry("litmus", NULL);
673} 737}