RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1920041 - [RFE] Reduce stalld CPU usage: Make it single threaded (or almost)
Summary: [RFE] Reduce stalld CPU usage: Make it single threaded (or almost)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: stalld
Version: 8.4
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: 8.0
Assignee: Clark Williams
QA Contact: Mark Simmons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-25 15:54 UTC by Daniel Bristot de Oliveira
Modified: 2021-11-10 00:41 UTC (History)
4 users (show)

Fixed In Version: stalld-1.13-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 18:41:43 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4252 0 None None None 2021-11-09 18:42:00 UTC

Description Daniel Bristot de Oliveira 2021-01-25 15:54:56 UTC
Description of problem:

On large systems, stalld is consuming a noticeable amount of CPU time, mainly when many CPUs are running busy-loop rt-task.

The reason being is that it starts a thread to monitor each CPU that is about to stall, parsing the cpu debug file on each thread independently. While this was a shortcut to make stalld PoC, this is now causing unneeded CPU usage, and we plan to make it single-threaded.


Version-Release number of selected component (if applicable):
1.4

How reproducible:
Always


Steps to Reproduce:
1. Start stalld
2. Make N CPUs busy running busy-loop rt workload
3. Check the number of stalld threads

Actual results:
N+1 threads


Expected results:
one or two threads.

Additional info:

Comment 4 Daniel Bristot de Oliveira 2021-07-08 07:37:43 UTC
Hi Fernando,

The main cause for the high CPU usage was the parsing of sched_debug. Previously, it ran at least once every second, and at most M times every second, where M is the number of processors running busy-loop RT tasks (e.g., it was linear to the number of processors).

The granularity option reduced the frequency from "every second" to at every "config granularity," with granularity at five-second by default.

The idle detection reduces the at least "once every granularity" sched_debug parsing to no parse at all if no busy loop task is running.

The single-threaded mode reduced the "M times every granularity" to "once at every granularity" - while boosting only one thread per boost duration. With this, stalld became constant w.r.t the number of processors.

With the boost duration lower than the granularity, the single-threaded was less precise than the multi-threaded in the case of more than one thread starving.

This limitation was removed with the overload control, with a small penalty: instead of being once every granularity, it became min(boost period, granularity) in the worst scenario - still good enough given the default values.

Now stalld is parsing the sched_debug, at least none, and most at min(boost period, granularity). Regarding the min(), the first case happens when the system is running busy loop rt tasks with *more than one starving thread on a CPU*, and the second case when the system has rt busy loop, but with *only one thread starving per cpu*, which seems to be the best trade-off between resource usage and precision.

So, answering your question: yes, it does.

-- Daniel

Comment 5 Fernando Pacheco 2021-07-08 15:16:54 UTC
This has been completed with MR42 now merged.
Will be included as part of v1.13.0 build.

Comment 12 errata-xmlrpc 2021-11-09 18:41:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (stalld bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4252


Note You need to log in before you can comment on or make changes to this bug.