Changeset 4c23fa4 in rtems


Ignore:
Timestamp:
Apr 22, 2014, 5:46:47 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
861346d1
Parents:
774edf2c
git-author:
Sebastian Huber <sebastian.huber@…> (04/22/14 05:46:47)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/22/14 06:34:45)
Message:

score: Simplify Giant lock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/threaddispatchdisablelevel.c

    r774edf2c r4c23fa4  
    2121#include <rtems/score/sysstate.h>
    2222
    23 #define NO_OWNER_CPU 0xffffffffU
     23#define NO_OWNER_CPU NULL
    2424
    2525typedef struct {
    2626  SMP_lock_Control lock;
    27   uint32_t owner_cpu;
     27  Per_CPU_Control *owner_cpu;
    2828  uint32_t nest_level;
    2929} Giant_Control;
     
    3838{
    3939  Giant_Control *giant = &_Giant;
    40   uint32_t self_cpu_index = _Per_CPU_Get_index( self_cpu );
    4140
    42   if ( giant->owner_cpu != self_cpu_index ) {
     41  if ( giant->owner_cpu != self_cpu ) {
    4342    _SMP_lock_Acquire( &giant->lock, &self_cpu->Giant_lock_context );
    44     giant->owner_cpu = self_cpu_index;
     43    giant->owner_cpu = self_cpu;
    4544    giant->nest_level = 1;
    4645  } else {
     
    6362{
    6463  Giant_Control *giant = &_Giant;
    65   uint32_t self_cpu_index = _Per_CPU_Get_index( self_cpu );
    6664
    6765  _Assert( _ISR_Get_level() != 0 );
    6866
    69   if ( giant->owner_cpu == self_cpu_index ) {
     67  if ( giant->owner_cpu == self_cpu ) {
    7068    giant->nest_level = 0;
    7169    giant->owner_cpu = NO_OWNER_CPU;
     
    114112
    115113  _Giant_Do_release( self_cpu );
    116   _Assert( disable_level != 0 || _Giant.owner_cpu == NO_OWNER_CPU );
     114  _Assert( disable_level != 0 || _Giant.owner_cpu != self_cpu );
    117115
    118116  _Profiling_Thread_dispatch_enable( self_cpu, disable_level );
     
    147145  Giant_Control *giant = &_Giant;
    148146
    149   return giant->owner_cpu == _SMP_Get_current_processor()
     147  return giant->owner_cpu == _Per_CPU_Get_snapshot()
    150148    || !_System_state_Is_up( _System_state_Get() );
    151149}
Note: See TracChangeset for help on using the changeset viewer.