On 11/30/2015 12:41 PM, Seth Arnold wrote: > On Sat, Nov 28, 2015 at 11:08:05AM -0800, John Johansen wrote: >> +static void setup_parallel_compile(void) >> +{ >> + /* jobs_count and paralell_max set by default, config or args */ >> + long n = sysconf(_SC_NPROCESSORS_ONLN); > > We should handle an error return here ..
yep > >> + if (jobs_count == JOBS_AUTO) >> + jobs_count = n; >> + if (jobs_max == JOBS_AUTO) >> + jobs_max = n; >> + /* jobs_max will be used internally */ >> + jobs_max = min(jobs_count, jobs_max); >> + if (jobs_max > 8*n) { >> + PERROR("%s: Invalid maximum number of jobs '%ld' > 8 * # of >> cpus", >> + progname, jobs_max); >> + exit(1); >> + } >> + else if (jobs_max < 1) { >> + PERROR("%s: Invalid maximum number of jobs '%ld'", >> + progname, jobs_max); >> + exit(1); >> + } > > .. because this test could be tripped with a -1 return from sysconf(). > > If sysconf() fails we should probably just go with n = 2 or something > conservative. > > I like the cap on eight times the number of CPUs. > > Thanks > > > -- AppArmor mailing list AppArmor@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor