Skip to content

Commit

Permalink
Fixed the issue that updateStatistics was not called for mlfq in …
Browse files Browse the repository at this point in the history
…`resource group queue` (#8414) (#8417)

close #8415
  • Loading branch information
ti-chi-bot authored Dec 14, 2023
1 parent aea0a9d commit bb119b5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,28 @@ bool ResourceControlQueue<NestedTaskQueueType>::take(TaskPtr & task)
}

template <typename NestedTaskQueueType>
void ResourceControlQueue<NestedTaskQueueType>::updateStatistics(const TaskPtr & task, ExecTaskStatus, UInt64 inc_value)
void ResourceControlQueue<NestedTaskQueueType>::updateStatistics(
const TaskPtr & task,
ExecTaskStatus exec_task_status,
UInt64 inc_value)
{
assert(task);
auto ru = cpuTimeToRU(inc_value);
const String & name = task->getResourceGroupName();
LOG_TRACE(logger, "resource group {} will consume {} RU(or {} cpu time in ns)", name, ru, inc_value);
LocalAdmissionController::global_instance->consumeCPUResource(name, ru, inc_value);
const String & resource_group_name = task->getResourceGroupName();
LOG_TRACE(logger, "resource group {} will consume {} RU(or {} cpu time in ns)", resource_group_name, ru, inc_value);
LocalAdmissionController::global_instance->consumeCPUResource(resource_group_name, ru, inc_value);

NestedTaskQueuePtr group_queue = nullptr;
{
std::lock_guard lock(mu);
auto iter = resource_group_task_queues.find(resource_group_name);
if (likely(iter != resource_group_task_queues.end()))
group_queue = iter->second;
else
return;
}
assert(group_queue);
group_queue->updateStatistics(task, exec_task_status, inc_value);
}

template <typename NestedTaskQueueType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ResourceControlQueue

bool take(TaskPtr & task) override;

void updateStatistics(const TaskPtr & task, ExecTaskStatus, UInt64 inc_value) override;
void updateStatistics(const TaskPtr & task, ExecTaskStatus exec_task_status, UInt64 inc_value) override;

bool empty() const override;

Expand Down

0 comments on commit bb119b5

Please sign in to comment.