Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1894610

Summary: The [scheduler] plugin does not set affinity to newly fork()ed processes.
Product: Red Hat Enterprise Linux 8 Reporter: Jiří Mencák <jmencak>
Component: tunedAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Robin Hack <rhack>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.3CC: fiezzi, jeder, jskarvad, mapfelba, rhack
Target Milestone: rcKeywords: Patch, TestCaseProvided, Triaged, Upstream
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tuned-2.15.0-0.1.rc1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:05:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiří Mencák 2020-11-04 16:03:24 UTC
Description of problem:
The [scheduler] plugin of the Tuned daemon seems to set CPU affinity to only existing processes and misses newly fork()ed ones. 


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

How reproducible:
Always

Steps to Reproduce:
1. use the Tuned [scheduler] plugin
2. watch the affinity of existing processes correctly changed
3. in a terminal, change a cpu affinity of a bash process
4. run "sleep 7777777 &" 

Actual results:
5. tuned will miss to set the affinity to the newly forked process


Expected results:
5. tuned sets the affinity to the newly forked process correctly


Additional info:
The problem seems to be in the _thread_code() function.  An event perf.RECORD_FORK is being missed there.

Comment 1 Jaroslav Škarvada 2020-11-06 10:05:45 UTC
Currently, the event filter is catching exec calls and prctl(PR_SET_NAME). Even with such optimized event filter we have received several reports that the perf code overhead is quite big for some performance benchmarks (IIRC up to 30 %). I guess with the event filter extended of the fork events, the number of triggers of the perf code will probably increase by a magnitude. I am afraid it will kill the performance, because the overhead will be bigger. Also I think that the most of the perf triggers will be useless and will just waste CPU time, because usually the child process inherits the parent affinity.

I think we could add configuration switch to the scheduler plugin to add the fork to the event filter, but I think such configuration should be by default off.

There is also possibility to use the cgroups feature of the scheduler plugin which has been introduced in tuned-2.14.0.

Comment 4 Jaroslav Škarvada 2020-11-24 20:05:40 UTC
Upstream PR:
https://github.com/redhat-performance/tuned/pull/309

Added `perf_process_fork` parameter. If set to `true` it will also listen to perf.RECORD_FORK events, i.e. it will explicitly process child processes created by the fork system call. Usually, child processes inherit affinity from their parents, thus the `scheduler` plugin doesn't need to explicitly process them, that's why the `perf_process_fork` parameter is by default set to `false` and child processes aren't explicitly processed. This default setting may also save some CPU time especially on loaded systems.

Comment 11 errata-xmlrpc 2021-05-18 15:05:25 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 (tuned 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:1671