affinity stressor sets affinity of stress-ng and stops all cpus from being exercised

Bug #1803322 reported by Colin Ian King on 2018-11-14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Colin Ian King
stress-ng (Ubuntu)
Colin Ian King

Bug Description

SRU Request [Cosmic]

== Justification ==

When running stress-ng with the affinity stressor, the autodetection of sched_setaffinity currently sets affinity to CPU 0 meaning that the stressors run in the session are pinned to CPU 0.

== Fix ==

Upstream commit

== Testing ==


stress-ng --affinity 1 --cpu 4

use top and see that only CPU 0 is being maxed out, other CPUs are less loaded. With the fix at least 4 CPUs are running the cpu stressor

== Regression Potential ==

The fix restores the stress-ng behavior prior to commit 31c7658927, the change is just in the affinity stressor and impact on other stressors with changed functionality is zero. Users of stress-ng with this fix will see their machines being loaded in a more fair and balanced way and stress-ng will max out CPUs, as was originally intended. Regression potential is therefore machines will hit thermal maximums on their CPUs.


the stress-affinity stressor checks to see if sched_setaffinity works, however, in doing so sets the CPU affinity to CPU 0 for all stressors because this is performed at the start of stress-ng and other stressors inherit this affinity setting. Fix this by getting and then setting the same affinity.

Changed in stress-ng:
importance: Undecided → High
assignee: nobody → Colin Ian King (colin-king)
status: New → Fix Committed
description: updated
Timo Aaltonen (tjaalton) wrote :

please add the distro package to bugs, so that uploads to the devel series close bugs automatically and the SRU reviewer wouldn't have to go check what is fixed there

Changed in stress-ng (Ubuntu):
status: New → Fix Released
Changed in stress-ng (Ubuntu Cosmic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-cosmic

Hello Colin, or anyone else affected,

Accepted stress-ng into cosmic-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-cosmic to verification-done-cosmic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-cosmic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Colin Ian King (colin-king) wrote :

verified fixed with 0.09.42-1ubuntu1 on cosmic

tags: added: verification-done verification-done-cosmic
removed: verification-needed verification-needed-cosmic
Changed in stress-ng:
status: Fix Committed → Fix Released
Changed in stress-ng (Ubuntu Cosmic):
assignee: nobody → Colin Ian King (colin-king)
importance: Undecided → High

The verification of the Stable Release Update for stress-ng has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package stress-ng - 0.09.42-1ubuntu1

stress-ng (0.09.42-1ubuntu1) cosmic; urgency=medium

  * stress-affinity: fix set affinity setting across all
    stressors (LP: #1803322)
    - fixes --seq 0 affinity setting stopping all CPUs from being used
  * stress-seccomp: add sanity check to see if SECCOMP_SET_MODE_FILTER
    works (LP: #1801856)
    - fixes false failure errors if filtering is not enabled
  * stress-dev: remove FIBMAP ioctl on device (LP: #1800609)
    - fixes error of incorrect ioctl on block device
  * stress-revio: ensure fiemap extent struct is zero'd (LP: #1798566)
    - fixes fiemap ioctl failures because of garbage in struct

 -- Colin King <email address hidden> Wed, 14 Nov 2018 17:28:22 +0000

Changed in stress-ng (Ubuntu Cosmic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers