aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-10-22 22:47:09 -0400
committerJonathan Herman <hermanjl@cs.unc.edu>2011-08-25 14:41:17 -0400
commita58f17aabdeda160d85691a6db094e3828930bff (patch)
tree1bdd3afa4801124139c878fa630c1548b24aa37e
parentc05eaa8091d2cadc20363d44a85ee454262f4bc2 (diff)
C-EDF: move /proc/litmus/cluster_cache to /proc/litmus/plugins/C-EDF/cluster
Make use of the new per-plugin proc file infrastructure to avoid littering the global namespace. While at it, also move all the relevant bits to sched_cedf.c. In the future, each plugin's parameters should be handled in the respective plugin file.
-rw-r--r--litmus/sched_cedf.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/litmus/sched_cedf.c b/litmus/sched_cedf.c
index 73fe1c442a0d..e320e8f3bc02 100644
--- a/litmus/sched_cedf.c
+++ b/litmus/sched_cedf.c
@@ -769,6 +769,62 @@ static struct sched_plugin cedf_plugin __cacheline_aligned_in_smp = {
769 769
770static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL; 770static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL;
771 771
772/* proc file interface to configure the cluster size */
773
774static int proc_read_cluster_size(char *page, char **start,
775 off_t off, int count,
776 int *eof, void *data)
777{
778 int len;
779 if (cluster_index >= 1 && cluster_index <= 3)
780 len = snprintf(page, PAGE_SIZE, "L%d\n", cluster_index);
781 else
782 len = snprintf(page, PAGE_SIZE, "ALL\n");
783
784 return len;
785}
786
787static int proc_write_cluster_size(struct file *file,
788 const char *buffer,
789 unsigned long count,
790 void *data)
791{
792 int len;
793 /* L2, L3 */
794 char cache_name[33];
795
796 if(count > 32)
797 len = 32;
798 else
799 len = count;
800
801 if(copy_from_user(cache_name, buffer, len))
802 return -EFAULT;
803
804 cache_name[len] = '\0';
805 /* chomp name */
806 if (len > 1 && cache_name[len - 1] == '\n')
807 cache_name[len - 1] = '\0';
808
809 /* do a quick and dirty comparison to find the cluster size */
810 if (!strcmp(cache_name, "L2"))
811 cluster_index = 2;
812 else if (!strcmp(cache_name, "L3"))
813 cluster_index = 3;
814 else if (!strcmp(cache_name, "L1"))
815 cluster_index = 1;
816 else if (!strcmp(cache_name, "ALL"))
817 cluster_index = num_online_cpus();
818 else
819 printk(KERN_INFO "Cluster '%s' is unknown.\n", cache_name);
820
821 return len;
822}
823
824
825static struct proc_dir_entry *cluster_file = NULL, *cedf_dir = NULL;
826
827
772static int __init init_cedf(void) 828static int __init init_cedf(void)
773{ 829{
774 int err, fs; 830 int err, fs;