changeset 1475:eee4f68409dd draft

bound default malloc
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 16 Jul 2012 13:07:50 +0900
parents b158873485f6
children 0094cd28bf41
files TaskManager/ChangeLog TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTaskBase.h
diffstat 3 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/ChangeLog	Mon Jul 16 11:01:40 2012 +0900
+++ b/TaskManager/ChangeLog	Mon Jul 16 13:07:50 2012 +0900
@@ -9,6 +9,8 @@
 	SpeTaskManager が必要なのは、SchedTask のAPIのため。ってことは、SpeTaskManager は Impl を継承してはいけない。
 	TaskManager には interface だけ定義されるべき。
 
+	inListData とかは DMA しないなら不要なんだよな。切れるようにするべきか?
+
 2012-7-15 Shinji KONO <kono@ie.u-ryukyu.ac.jp>
 
 	inData をmallocしないで、小さいものは SchedTask に入れておく方が良い。
--- a/TaskManager/kernel/schedule/SchedTask.cc	Mon Jul 16 11:01:40 2012 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.cc	Mon Jul 16 13:07:50 2012 +0900
@@ -21,7 +21,7 @@
     writebuf    = NULL;
     scheduler   = NULL;
     cur_index   = 0;
-    din[0] = dout[0] = 0;
+    // din[0] = dout[0] = 0;
     this->stdout_ = stdout;
     this->stderr_ = stderr;
     this->stdin_ = stdin;
@@ -65,7 +65,6 @@
 
 }
 
-
 void
 SchedTask::read()
 {
@@ -81,8 +80,8 @@
     inListData.length = atask->inData_count;
     inListData.size = atask->inData_total_size();
     inListData.element = atask->inData(0);
-    inListData.bound = (int*)manager->allocate(inListData.length*sizeof(int));
-
+    if (inListData.length>DefaultBoundSize)
+        inListData.bound = (int*)manager->allocate(inListData.length*sizeof(int));
     // load Input Data
     // inListData.print();
     readbuf = connector->dma_loadList(scheduler, &inListData, (DMA_READ + this->tag));
@@ -98,7 +97,8 @@
     // atask->outData_offset += cur_index + 1 ;  // to avoid compiler bug
     outListData.element = atask->outData(0);
     // if (outListData.bound!=dout) free(outListData.bound);
-    outListData.bound = (int*)manager->allocate(outListData.length*sizeof(int));
+    if (outListData.length>DefaultBoundSize)
+        outListData.bound = (int*)manager->allocate(outListData.length*sizeof(int));
     connector->bound(&outListData);
     writebuf = connector->get_writebuf(scheduler, (memaddr)outListData.element[0].addr, outListData.size);
 }
--- a/TaskManager/kernel/schedule/SchedTaskBase.h	Mon Jul 16 11:01:40 2012 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskBase.h	Mon Jul 16 13:07:50 2012 +0900
@@ -107,9 +107,9 @@
      */
     void *readbuf;
     void *writebuf;
-
-    int din[1];
-    int dout[1];
+#define DefaultBoundSize (8)
+    int din[DefaultBoundSize];
+    int dout[DefaultBoundSize];
 
     /* system call */