Skip to content

Commit

Permalink
Correct behavior on deactivated permit (#1308)
Browse files Browse the repository at this point in the history
* Correct behavior on deactivated permit

---------

Signed-off-by: Isaev, Ilya <[email protected]>
Co-authored-by: Pavel Kumbrasev <[email protected]>
  • Loading branch information
isaevil and Pavel Kumbrasev authored Feb 5, 2024
1 parent fabaaa6 commit 627cac6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/tbb/tcm_adaptor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2023 Intel Corporation
Copyright (c) 2023-2024 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -137,11 +137,9 @@ class tcm_client : public pm_client {
// The permit has changed during the reading, so the callback will be invoked soon one more time and
// we can just skip this renegotiation iteration.
if (!new_permit.flags.stale) {
__TBB_ASSERT(
new_permit.state != TCM_PERMIT_STATE_INACTIVE || new_concurrency == 0,
"TCM did not nullify resources while deactivating the permit"
);
delta = update_concurrency(new_concurrency);
// If there is no other demand in TCM, the permit may still have granted concurrency but
// be in the deactivated state thus we enforce 0 allotment to preserve arena invariants.
delta = update_concurrency(new_permit.state != TCM_PERMIT_STATE_INACTIVE ? new_concurrency : 0);
}
}
if (delta) {
Expand Down

0 comments on commit 627cac6

Please sign in to comment.