[apparmor] [patch] v4 - parser: add basic support for parallel compiles and loads
Christian Boltz
apparmor at cboltz.de
Sat Dec 12 00:01:14 UTC 2015
Hello,
Am Freitag, 11. Dezember 2015 schrieb John Johansen:
> revised v4 version of patch
>
> * replace * with x in -j syntax to avoid shell processing problems
> ie. -j*4 is now -jx4
>
> * -j now requires an option, so that -jx is not potentially confused
> with possible future -x option
...
> --max_jobs=n
You probably did s/_/-/ locally already.
> allows setting hard cap on the number of jobs that can be
> specified by --jobs. It defaults to the number of processors in the
> system * 8. It supports the "auto" and "max" keywords, and using *n
s/*n/xn/
> --- a/parser/parser_main.c
> +++ b/parser/parser_main.c
...
> "-O [n], --Optimize Control dfa optimizations\n"
> "-h [cmd], --help[=cmd] Display this text or info about
> cmd\n"
> + "-j [n], --jobs [n] Set the number of compile threads\n"
> + "--max-jobs [n] Hard cap on --jobs. Default 8*cpus\n"
With the parameter being required, shouldn't that be "-j n", "--jobs n"
and "--max-jobs n"?
> +static long process_jobs_arg(const char *arg, const char *val) {
> + char *end;
> + long n;
> +
> + if (!val || strcmp(val, "auto") == 0)
> + n = JOBS_AUTO;
> + else if (strcmp(val, "max") == 0)
> + n = LONG_MAX;
> + else {
> + bool multiple = false;
> + if (*val == 'x') {
> + multiple = true;
> + val++;
So you are doing pointer math to skip the first char?
That reminds me of
http://45.media.tumblr.com/e545c444e8e28687ce9363e84017e7d5/tumblr_nz3134g9dT1rn7bzro1_500.gif
;-)
> + }
> + n = strtol(val, &end, 0);
> + if (!(*val && val != end && *end == '\0')) {
> + PERROR("%s: Invalid option %s=%s%s\n", progname, arg,
multiple ?
> "*" : "", val); + exit(1);
That "*" should probably be "x" to avoid confusion.
> + }
> + if (multiple)
> + n = n * -1;
Just curious - why not
n = -n
? (The result is the same.)
> +static void setup_parallel_compile(void)
...
> + if (jobs > jobs_max) {
> + pwarn("%s: Warning caping number of jobs to %ld * # of cpus ==
I'm not the native speaker here, but my guess would have been "capping".
> @@ -939,6 +1115,7 @@ int main(int argc, char *argv[])
> }
> }
>
> +
> retval = last_error = 0;
Is that additinal newline intentional?
Regards,
Christian Boltz
--
> /etc/sysconfig/powersave/cpufreq contains the line:
> # the next lover CPU frequency. Increasing this value lowers the
^^^^^
we should keep that one ;)
[Michael Gross in https://bugzilla.novell.com/show_bug.cgi?id=183704]
More information about the AppArmor
mailing list