KiUpdateMinimumWeight

VOID __stdcall KiUpdateMinimumWeight(_KSCHEDULING_GROUP_TYPE Type, UINT64 Exhaustive, _KSCHEDULING_GROUP *Parent){
  char v3; 
  unsigned int ChildMinRate; 
  unsigned int v6; 
  _LIST_ENTRY *p_ChildList; 
  _LIST_ENTRY *Flink; 
  unsigned int v9; 
  int v10; 
  unsigned int Blink_low; 

  v3 = Exhaustive;
  if( Type )
  {
    if( Parent )
      ChildMinRate = Parent->ChildMinRate;
    else
      ChildMinRate = KiGroupSchedulingMinimumRate;
    v6 = 10000;
  }
  else
  {
    if( Parent )
      ChildMinRate = Parent->ChildMinWeight;
    else
      ChildMinRate = KiGroupSchedulingMinimumWeight;
    v6 = 9;
  }
  p_ChildList = &Parent->ChildList;
  if( !Parent )
    p_ChildList = (_LIST_ENTRY *)&KiSchedulingGroupList;
  Flink = p_ChildList->Flink;
  v9 = 0;
  v10 = 0;
  do
  {
    if( (HIDWORD(Flink[-4].Blink) & 1) == Type )
    {
      if( !v3 && LOWORD(Flink[-4].Blink) == ChildMinRate )
        return;
      Blink_low = LOWORD(Flink[-4].Blink);
      ++v10;
      v9 += Blink_low;
      if( Blink_low >= v6 )
        Blink_low = v6;
      v6 = Blink_low;
    }
    Flink = Flink->Flink;
  }
  while( Flink != p_ChildList );
  if( Type )
  {
    if( v10 )
    {
      if( Parent )
        Parent->ChildMinRate = v6;
      else
        KiGroupSchedulingMinimumRate = v6;
    }
    else if( Parent )
    {
      Parent->ChildMinRate = 0;
    }
    else
    {
      KiGroupSchedulingMinimumRate = 0;
    }
  }
  else if( v10 )
  {
    if( Parent )
    {
      Parent->ChildMinWeight = v6;
      if( v3 )
        Parent->ChildTotalWeight = v9;
    }
    else
    {
      KiGroupSchedulingMinimumWeight = v6;
      if( v3 )
        KiGroupSchedulingTotalWeight = v9;
    }
  }
  else if( Parent )
  {
    Parent->ChildMinWeight = 0;
    Parent->ChildTotalWeight = 0;
  }
  else
  {
    KiGroupSchedulingMinimumWeight = 0;
    KiGroupSchedulingTotalWeight = 0;
  }
}

Referenced by:

KeRemoveSchedulingGroup
KeSetSchedulingGroupCpuRates
KeSetSchedulingGroupWeights