Skip to content

Make thread pool capacity configurable via YAML#202

Merged
Kartik Nema (kartnema) merged 8 commits into
qualcomm:mainfrom
tnidigan:thread-pool-config-via-yaml
Mar 4, 2026
Merged

Make thread pool capacity configurable via YAML#202
Kartik Nema (kartnema) merged 8 commits into
qualcomm:mainfrom
tnidigan:thread-pool-config-via-yaml

Conversation

@tnidigan

Copy link
Copy Markdown
Contributor

Makes thread pool capacity configurable through YAML properties instead of hardcoded constants, enabling per-system tuning without recompilation.

Changes Made

  1. Added New YAML Properties
  • 'resource_tuner.thread_pool.desired_capacity' (default: 5)
    • Initial number of worker threads in the thread pool
  • 'resource_tuner.thread_pool.max_scaling_capacity' (default: 10)
    • Maximum threads the pool can scale to under load
  1. Code Changes
  • Utils.h: Added property name constants

    • 'THREAD_POOL_DESIRED_CAPACITY'
    • 'THREAD_POOL_MAX_SCALING_CAPACITY'
  • UrmSettings.h:

    • Added fields to 'MetaConfigs' structure
    • Removed hardcoded constants 'desiredThreadCount' and 'maxScalingCapacity'
  • RestuneInit.cpp:

    • Added property loading in fetchMetaConfigs()
    • Added validation for thread count values
    • Updated 'preAllocateWorkers()' to use configurable values

Comment thread resource-tuner/init/RestuneInit.cpp Outdated
UrmSettings::metaConfigs.mPluginCount = (uint32_t)std::stol(resultBuffer);

if(UrmSettings::metaConfigs.mDesiredThreadCount < 1) {
TYPELOGV(META_CONFIG_PARSE_FAILURE, "desiredThreadCount must be >= 1, setting to default value (5)");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need these logs on 181, 186

Comment thread resource-tuner/init/RestuneInit.cpp Outdated
static ErrCode preAllocateWorkers() {
int32_t desiredThreadCapacity = UrmSettings::desiredThreadCount;
int32_t maxScalingCapacity = UrmSettings::maxScalingCapacity;
int32_t desiredThreadCapacity = UrmSettings::metaConfigs.mDesiredThreadCount;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make these uint32_t and correct indentation

@kartnema

Kartik Nema (kartnema) commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Tarun Balaji Nidiganti (@tnidigan) can you fix the merge conflict

Signed-off-by: Tarun Balaji Nidiganti <tnidigan@qti.qualcomm.com>
@kartnema Kartik Nema (kartnema) merged commit 33c3c5f into qualcomm:main Mar 4, 2026
12 of 14 checks passed
@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No CR Numbers Found

Error: No Change Request numbers were found.

Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests.

1 similar comment
@qswat-orbit-external

Copy link
Copy Markdown

Merge Check Failed: No CR Numbers Found

Error: No Change Request numbers were found.

Please add Change Request numbers to your pull request description in the format CRs-Fixed: 12345 or link GitHub issues that are associated with Change Requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants