소스 검색

Kernel: When donating ticks to a lock holder, cap the donation.

When donating ticks to a lock holder, never donate more ticks than
that process would normally get from the scheduler.
Andreas Kling 6 년 전
부모
커밋
fa241747af
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      Kernel/Scheduler.cpp

+ 1 - 1
Kernel/Scheduler.cpp

@@ -211,7 +211,7 @@ bool Scheduler::donate_to(Process* beneficiary, const char* reason)
         return yield();
         return yield();
     }
     }
 
 
-    unsigned ticks_to_donate = ticks_left - 1;
+    unsigned ticks_to_donate = min(ticks_left - 1, time_slice_for(beneficiary->priority()));
 #ifdef SCHEDULER_DEBUG
 #ifdef SCHEDULER_DEBUG
     dbgprintf("%s(%u) donating %u ticks to %s(%u), reason=%s\n", current->name().characters(), current->pid(), ticks_to_donate, beneficiary->name().characters(), beneficiary->pid(), reason);
     dbgprintf("%s(%u) donating %u ticks to %s(%u), reason=%s\n", current->name().characters(), current->pid(), ticks_to_donate, beneficiary->name().characters(), beneficiary->pid(), reason);
 #endif
 #endif