Skip to content

Commit 8b77b59

Browse files
committed
DPL: combine resource offers to reduce processing latency
1 parent 109c166 commit 8b77b59

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

Framework/Core/src/ComputingQuotaEvaluator.cxx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,18 @@ void ComputingQuotaEvaluator::dispose(int taskId)
240240
if (offer.valid == false) {
241241
continue;
242242
}
243-
if (offer.sharedMemory <= 0) {
243+
// Decrement timeslices after each use and track if a decrement happened.
244+
// - SHM-only offers (ts=0 from start): no decrement, kept alive while shm > 0
245+
// - Timeslice-only offers (shm=0, ts>0): ts decremented, invalidated when shm <= 0
246+
// - Combined offers (shm>0, ts>0): ts decremented, invalidated when ts reaches 0
247+
bool timesliceConsumed = false;
248+
if (offer.timeslices > 0) {
249+
offer.timeslices--;
250+
timesliceConsumed = true;
251+
}
252+
if (offer.sharedMemory <= 0 || (timesliceConsumed && offer.timeslices <= 0)) {
244253
O2_SIGNPOST_ID_FROM_POINTER(oid, quota, (void*)(int64_t)(oi * 8));
245-
O2_SIGNPOST_END(quota, oid, "offers", "Offer %d back to not needed.", oi);
254+
O2_SIGNPOST_END(quota, oid, "offers", "Offer %d back to not needed (shm=%lli, ts=%lli).", oi, offer.sharedMemory, offer.timeslices);
246255
offer.valid = false;
247256
offer.score = OfferScore::Unneeded;
248257
}

0 commit comments

Comments
 (0)