[apparmor] [PATCH] [parser] Fix jobs not scaling up to meet available resources when cpus are brought online during compilation

Seth Arnold seth.arnold at canonical.com
Tue Apr 5 22:38:28 UTC 2016

On Wed, Apr 06, 2016 at 12:02:13AM +0200, Christian Boltz wrote:
> I wonder if we really need to implement this ourself - finding out how 
> many threads should be used / how many CPUs are actually available 
> sounds like something that has been done before ;-)

That's the thing, _SC_NPROCESSORS_CONF reports how many are available,
_SC_NPROCESSORS_ONLN reports how many are online, and we need to choose
how many to use in light of the fact that how many are online may be
variable based on the workload.

Probably most people are content to stick to ONLN.

One possible solution is to inspect /proc/sched_stats and determine
how many extra apparmor_parser processes are runnable but not running
and avoid starting new children when there's runnable processes that
aren't getting CPU time.

However, parsing /proc/sched_stats is probably more expensive than
periodically bumping the goal up or down based on occasional calls
to .._ONLN.

It's not common to have workload affect the number of online CPUs, so I
suspect there's not much else to steal code from.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20160405/c24c8f0a/attachment.pgp>

More information about the AppArmor mailing list