Re: [PATCH 01/12] grep: add ability to disable threading with --threads=0 or grep.threads=0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 08, 2017 at 01:24:55PM +0000, Ævar Arnfjörð Bjarmason wrote:

> Add the ability to entirely disable threading by having grep.threads=0
> in the config or --threads=0 on the command-line.

In pack-objects and index-pack, --threads=0 means "auto-detect". It
seems like we should try to keep this consistent.

Wouldn't --threads=1 be a better way to disable threading? Pack-objects
is smart enough to just use the non-threaded code path entirely in that
case (rather than wasting time spawning a single worker thread). Grep
should probably do the same.

> +static int thread_callback(const struct option *opt,
> +			   const char *arg, int unset)
> +{
> +	int *threads = (int*)opt->value;
> +	char *end;
> +
> +	if (unset) {
> +		*threads = GREP_NUM_THREADS_DEFAULT;
> +		return 0;
> +	}

This means that "--no-threads" will use 8 threads. Which _kind of_ makes
sense in that it cancels any previous "--threads", but I wonder if it
should be the same as "--threads=1".

This isn't really a change in behavior from the existing code, though
(OPT_INTEGER will set it to 0 in that case, too, and we'd later pick up
the default value).

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]