Changeset 2d36931 in rtems


Ignore:
Timestamp:
Jun 11, 2014, 9:03:25 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
647b95d
Parents:
92635cb
git-author:
Sebastian Huber <sebastian.huber@…> (06/11/14 09:03:25)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/23/14 07:13:00)
Message:

score: Collect scheduler related fields in TCB

Add Thread_Scheduler_control to collect scheduler related fields of the
TCB.

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/include/confdefs.h

    r92635cb r2d36931  
    25822582  const Thread_Control_add_on _Thread_Control_add_ons[] = {
    25832583    {
    2584       offsetof( Configuration_Thread_control, Control.scheduler_node ),
     2584      offsetof( Configuration_Thread_control, Control.Scheduler.node ),
    25852585      offsetof( Configuration_Thread_control, Scheduler )
    25862586    }, {
  • cpukit/score/include/rtems/score/schedulerimpl.h

    r92635cb r2d36931  
    4848{
    4949#if defined(RTEMS_SMP)
    50   return the_thread->scheduler;
     50  return the_thread->Scheduler.control;
    5151#else
    5252  (void) the_thread;
     
    376376    _Thread_Set_state( the_thread, STATES_MIGRATING );
    377377    _Scheduler_Node_destroy( current_scheduler, the_thread );
    378     the_thread->scheduler = scheduler;
     378    the_thread->Scheduler.control = scheduler;
    379379    _Scheduler_Node_initialize( scheduler, the_thread );
    380380    _Scheduler_Update_priority( the_thread, the_thread->current_priority );
     
    650650)
    651651{
    652   return the_thread->scheduler_node;
     652  return the_thread->Scheduler.node;
    653653}
    654654
  • cpukit/score/include/rtems/score/schedulersmpimpl.h

    r92635cb r2d36931  
    421421    } else {
    422422      /* We have to force a migration to our processor set */
    423       _Assert( scheduled->debug_real_cpu->heir != scheduled );
     423      _Assert( scheduled->Scheduler.debug_real_cpu->heir != scheduled );
    424424      heir = scheduled;
    425425    }
  • cpukit/score/include/rtems/score/thread.h

    r92635cb r2d36931  
    447447
    448448/**
     449 * @brief Thread scheduler control.
     450 */
     451typedef struct {
     452#if defined(RTEMS_SMP)
     453  /**
     454   * @brief The current scheduler control of this thread.
     455   */
     456  const struct Scheduler_Control *control;
     457#endif
     458
     459  /**
     460   * @brief The current scheduler node of this thread.
     461   */
     462  struct Scheduler_Node *node;
     463
     464#if defined(RTEMS_SMP)
     465  /**
     466   * @brief The processor assigned by the current scheduler.
     467   */
     468  Per_CPU_Control *cpu;
     469
     470#if defined(RTEMS_DEBUG)
     471  /**
     472   * @brief The processor on which this thread executed the last time or is
     473   * executing.
     474   */
     475  Per_CPU_Control *debug_real_cpu;
     476#endif
     477#endif
     478} Thread_Scheduler_control;
     479
     480/**
    449481 *  This structure defines the Thread Control Block (TCB).
    450482 */
     
    488520  /** This field is true if the thread is preemptible. */
    489521  bool                                  is_preemptible;
    490 #if defined(RTEMS_SMP)
    491   /**
    492    * @brief The scheduler of this thread.
    493    */
    494   const struct Scheduler_Control       *scheduler;
    495 #endif
     522
     523  /**
     524   * @brief Scheduler related control.
     525   */
     526  Thread_Scheduler_control              Scheduler;
    496527
    497528#if __RTEMS_ADA__
     
    516547  Thread_CPU_usage_t                    cpu_time_used;
    517548
    518   /**
    519    * @brief The scheduler node of this thread for the real scheduler.
    520    */
    521   struct Scheduler_Node                *scheduler_node;
    522 
    523 #ifdef RTEMS_SMP
    524   /**
    525    * @brief The processor assigned by the scheduler.
    526    */
    527   Per_CPU_Control                      *cpu;
    528 
    529 #ifdef RTEMS_DEBUG
    530   /**
    531    * @brief The processor on which this thread executed the last time or is
    532    * executing.
    533    */
    534   Per_CPU_Control                      *debug_real_cpu;
    535 #endif
    536 #endif
    537 
    538549  /** This field contains information about the starting state of
    539550   *  this thread.
  • cpukit/score/include/rtems/score/threadimpl.h

    r92635cb r2d36931  
    409409{
    410410#if defined(RTEMS_SMP)
    411   return thread->cpu;
     411  return thread->Scheduler.cpu;
    412412#else
    413413  (void) thread;
     
    423423{
    424424#if defined(RTEMS_SMP)
    425   thread->cpu = cpu;
     425  thread->Scheduler.cpu = cpu;
    426426#else
    427427  (void) thread;
     
    805805{
    806806#if defined(RTEMS_SMP) && defined(RTEMS_DEBUG)
    807   the_thread->debug_real_cpu = cpu;
     807  the_thread->Scheduler.debug_real_cpu = cpu;
    808808#else
    809809  (void) the_thread;
  • cpukit/score/src/threadinitialize.c

    r92635cb r2d36931  
    160160   */
    161161
     162  the_thread->Start.isr_level        = isr_level;
    162163  the_thread->Start.is_preemptible   = is_preemptible;
    163164  the_thread->Start.budget_algorithm = budget_algorithm;
     
    180181  }
    181182
    182   the_thread->Start.isr_level         = isr_level;
    183 
    184183#if defined(RTEMS_SMP)
    185   the_thread->scheduler              = scheduler;
     184  the_thread->Scheduler.control = scheduler;
    186185  _Resource_Node_initialize( &the_thread->Resource_node );
    187186  _CPU_Context_Set_is_executing( &the_thread->Registers, false );
  • testsuites/smptests/smpscheduler01/init.c

    r92635cb r2d36931  
    1818
    1919#include <rtems.h>
     20#include <rtems/score/threadimpl.h>
    2021
    2122#include "tmacros.h"
     
    9091      }
    9192
    92       ok = ok && executing->cpu == cpu;
    93       ok = ok && heir->cpu == cpu;
     93      ok = ok && _Thread_Get_CPU( executing ) == cpu;
     94      ok = ok && _Thread_Get_CPU( heir ) == cpu;
    9495    }
    9596
Note: See TracChangeset for help on using the changeset viewer.