[PATCH v2 2/3] score: Place object controls into .noinit sections

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Jul 15 06:38:47 UTC 2022


Place the statically allocated object control blocks, local tables, and thread
queue heads into the dedicated .noinit intput sections.  The output section is
not zero initialized.  Placing these elements into the .noinit section reduces
the system initialization time by decreasing the .bss section size.

It may improve the cache efficiency since the mostly read local tables are
placed in a contiguous memory area.

Update #4678.
---
 cpukit/include/rtems/score/objectdata.h | 7 +++++--
 cpukit/include/rtems/score/thread.h     | 9 ++++++---
 testsuites/sptests/sp01/init.c          | 3 ++-
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/cpukit/include/rtems/score/objectdata.h b/cpukit/include/rtems/score/objectdata.h
index d624f182f9..dc03f23461 100644
--- a/cpukit/include/rtems/score/objectdata.h
+++ b/cpukit/include/rtems/score/objectdata.h
@@ -447,9 +447,12 @@ Objects_Information name##_Information = { \
  *   multiprocessing (RTEMS_MULTIPROCESSING) is enabled.
  */
 #define OBJECTS_INFORMATION_DEFINE( name, api, cls, type, max, nl, ex ) \
-static Objects_Control * \
+static RTEMS_SECTION( ".noinit.rtems.content.local_table" ) \
+Objects_Control * \
 name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
-static type name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
+static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \
+type \
+name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
 Objects_Information name##_Information = { \
   _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
   name##_Local_table, \
diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h
index 94eab18ea3..f5a56887a4 100644
--- a/cpukit/include/rtems/score/thread.h
+++ b/cpukit/include/rtems/score/thread.h
@@ -1149,11 +1149,14 @@ Thread_Information name##_Information = { \
 Objects_Control *_Thread_Allocate_unlimited( Objects_Information *information );
 
 #define THREAD_INFORMATION_DEFINE( name, api, cls, max ) \
-static Objects_Control * \
+static RTEMS_SECTION( ".noinit.rtems.content.local_table" ) \
+Objects_Control * \
 name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
-static Thread_Configured_control \
+static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \
+Thread_Configured_control \
 name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
-static Thread_queue_Configured_heads \
+static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \
+Thread_queue_Configured_heads \
 name##_Heads[ _Objects_Maximum_per_allocation( max ) ]; \
 Thread_Information name##_Information = { \
   { \
diff --git a/testsuites/sptests/sp01/init.c b/testsuites/sptests/sp01/init.c
index 2384430824..26d715b0ba 100644
--- a/testsuites/sptests/sp01/init.c
+++ b/testsuites/sptests/sp01/init.c
@@ -35,7 +35,8 @@
 
 const char rtems_test_name[] = "SP 1";
 
-RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char Task_1_storage[
+static RTEMS_NOINIT RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) char
+Task_1_storage[
   RTEMS_TASK_STORAGE_SIZE( 2 * RTEMS_MINIMUM_STACK_SIZE, RTEMS_FLOATING_POINT )
 ];
 
-- 
2.35.3



More information about the devel mailing list