* [PATCH 1/2] fix compilation with --disable-pthreads
@ 2014-10-11 14:42 Etienne Buira
2014-10-11 14:46 ` [PATCH 2/2] Remove spurious 'no threads support' warnings Etienne Buira
2014-10-13 19:10 ` [PATCH 1/2] fix compilation with --disable-pthreads Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Etienne Buira @ 2014-10-11 14:42 UTC (permalink / raw)
To: git; +Cc: Etienne Buira
Signed-off-by: Etienne Buira <etienne.buira@gmail.com>
---
builtin/index-pack.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index eebf1a8..0f88f4b 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -185,6 +185,9 @@ static void cleanup_thread(void)
#define deepest_delta_lock()
#define deepest_delta_unlock()
+#define type_cas_lock()
+#define type_cas_unlock()
+
#endif
--
1.8.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] Remove spurious 'no threads support' warnings
2014-10-11 14:42 [PATCH 1/2] fix compilation with --disable-pthreads Etienne Buira
@ 2014-10-11 14:46 ` Etienne Buira
2014-10-13 19:54 ` Junio C Hamano
2014-10-13 19:10 ` [PATCH 1/2] fix compilation with --disable-pthreads Junio C Hamano
1 sibling, 1 reply; 5+ messages in thread
From: Etienne Buira @ 2014-10-11 14:46 UTC (permalink / raw)
To: git; +Cc: Etienne Buira
Threads count being defaulted to 0 (autodetect), and --disable-pthreads
build checking that thread count==1, there were spurious warnings about
threads being ignored, despite not specified on command line/conf.
Fixes tests 5521 and 5526 that were broken in --disable-pthreads builds
because of those warnings.
Signed-off-by: Etienne Buira <etienne.buira@gmail.com>
---
builtin/pack-objects.c | 2 +-
thread-utils.h | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index b59f5d8..7b51453 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -51,7 +51,7 @@ static int progress = 1;
static int window = 10;
static unsigned long pack_size_limit;
static int depth = 50;
-static int delta_search_threads;
+static int delta_search_threads = THREAD_COMPAT_DEFAULT_THREAD_NBR;
static int pack_to_stdout;
static int num_preferred_base;
static struct progress *progress_state;
diff --git a/thread-utils.h b/thread-utils.h
index 6fb98c3..4f5e802 100644
--- a/thread-utils.h
+++ b/thread-utils.h
@@ -7,5 +7,8 @@
extern int online_cpus(void);
extern int init_recursive_mutex(pthread_mutex_t*);
+#define THREAD_COMPAT_DEFAULT_THREAD_NBR 0
+#else
+#define THREAD_COMPAT_DEFAULT_THREAD_NBR 1
#endif
#endif /* THREAD_COMPAT_H */
--
1.8.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] fix compilation with --disable-pthreads
2014-10-11 14:42 [PATCH 1/2] fix compilation with --disable-pthreads Etienne Buira
2014-10-11 14:46 ` [PATCH 2/2] Remove spurious 'no threads support' warnings Etienne Buira
@ 2014-10-13 19:10 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2014-10-13 19:10 UTC (permalink / raw)
To: Etienne Buira; +Cc: git
Etienne Buira <etienne.buira@gmail.com> writes:
> Subject: Re: [PATCH 1/2] fix compilation with --disable-pthreads
That probably is a typo of "NO_PTHREADS=NoThanks" or something.
Thanks.
Just out of curiosity, are you porting to some exotic platforms?
> Signed-off-by: Etienne Buira <etienne.buira@gmail.com>
> ---
> builtin/index-pack.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/builtin/index-pack.c b/builtin/index-pack.c
> index eebf1a8..0f88f4b 100644
> --- a/builtin/index-pack.c
> +++ b/builtin/index-pack.c
> @@ -185,6 +185,9 @@ static void cleanup_thread(void)
> #define deepest_delta_lock()
> #define deepest_delta_unlock()
>
> +#define type_cas_lock()
> +#define type_cas_unlock()
> +
> #endif
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Remove spurious 'no threads support' warnings
2014-10-11 14:46 ` [PATCH 2/2] Remove spurious 'no threads support' warnings Etienne Buira
@ 2014-10-13 19:54 ` Junio C Hamano
2014-10-14 14:46 ` Etienne Buira
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2014-10-13 19:54 UTC (permalink / raw)
To: Etienne Buira; +Cc: git
Etienne Buira <etienne.buira@gmail.com> writes:
> Threads count being defaulted to 0 (autodetect), and --disable-pthreads
> build checking that thread count==1, there were spurious warnings about
> threads being ignored, despite not specified on command line/conf.
>
> Fixes tests 5521 and 5526 that were broken in --disable-pthreads builds
> because of those warnings.
>
> Signed-off-by: Etienne Buira <etienne.buira@gmail.com>
> ---
I am not sure if this is the right fix.
Shouldn't a --threads=0 from the command line (when there is a
pack.threads configuration hardcoding some number to override it)
give a chance to the auto detection codepath to ask online_cpus()
and receive 1 on NO_PTHREADS build to avoid triggering the same
warning you are squelching with this patch?
That is, something like this instead, perhaps?
-- >8 --
Subject: [PATCH] pack-objects: set number of threads before checking and warning
Under NO_PTHREADS build, we warn when delta_search_threads is not
set to 1, because that is the only sensible value on a single
threaded build.
However, the auto detection that kicks in when that variable is set
to 0 (e.g. there is no configuration variable or command line option,
or an explicit --threads=0 is given from the command line to override
the pack.threads configuration to force auto-detection) was not done
before the condition to issue this warning was tested.
Move the auto-detection code and place it at an appropriate spot.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin/pack-objects.c | 6 ++++--
thread-utils.h | 4 ++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index d391934..a715237 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -1972,8 +1972,6 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
init_threaded_search();
- if (!delta_search_threads) /* --threads=0 means autodetect */
- delta_search_threads = online_cpus();
if (delta_search_threads <= 1) {
find_deltas(list, &list_size, window, depth, processed);
cleanup_threaded_search();
@@ -2685,6 +2683,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
pack_compression_level = Z_DEFAULT_COMPRESSION;
else if (pack_compression_level < 0 || pack_compression_level > Z_BEST_COMPRESSION)
die("bad pack compression level %d", pack_compression_level);
+
+ if (!delta_search_threads) /* --threads=0 means autodetect */
+ delta_search_threads = online_cpus();
+
#ifdef NO_PTHREADS
if (delta_search_threads != 1)
warning("no threads support, ignoring --threads");
diff --git a/thread-utils.h b/thread-utils.h
index 6fb98c3..d9a769d 100644
--- a/thread-utils.h
+++ b/thread-utils.h
@@ -7,5 +7,9 @@
extern int online_cpus(void);
extern int init_recursive_mutex(pthread_mutex_t*);
+#else
+
+#define online_cpus() 1
+
#endif
#endif /* THREAD_COMPAT_H */
--
2.1.2-468-g1a77c5b
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Remove spurious 'no threads support' warnings
2014-10-13 19:54 ` Junio C Hamano
@ 2014-10-14 14:46 ` Etienne Buira
0 siblings, 0 replies; 5+ messages in thread
From: Etienne Buira @ 2014-10-14 14:46 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Mon, Oct 13, 2014 at 9:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Etienne Buira <etienne.buira@gmail.com> writes:
>
>> Threads count being defaulted to 0 (autodetect), and --disable-pthreads
>> build checking that thread count==1, there were spurious warnings about
>> threads being ignored, despite not specified on command line/conf.
>>
>> Fixes tests 5521 and 5526 that were broken in --disable-pthreads builds
>> because of those warnings.
>>
>> Signed-off-by: Etienne Buira <etienne.buira@gmail.com>
>> ---
>
> I am not sure if this is the right fix.
>
> Shouldn't a --threads=0 from the command line (when there is a
> pack.threads configuration hardcoding some number to override it)
> give a chance to the auto detection codepath to ask online_cpus()
> and receive 1 on NO_PTHREADS build to avoid triggering the same
> warning you are squelching with this patch?
>
> That is, something like this instead, perhaps?
Indeed, your patch is better.
> -- >8 --
> Subject: [PATCH] pack-objects: set number of threads before checking and warning
>
> Under NO_PTHREADS build, we warn when delta_search_threads is not
> set to 1, because that is the only sensible value on a single
> threaded build.
>
> However, the auto detection that kicks in when that variable is set
> to 0 (e.g. there is no configuration variable or command line option,
> or an explicit --threads=0 is given from the command line to override
> the pack.threads configuration to force auto-detection) was not done
> before the condition to issue this warning was tested.
>
> Move the auto-detection code and place it at an appropriate spot.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> builtin/pack-objects.c | 6 ++++--
> thread-utils.h | 4 ++++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index d391934..a715237 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -1972,8 +1972,6 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
>
> init_threaded_search();
>
> - if (!delta_search_threads) /* --threads=0 means autodetect */
> - delta_search_threads = online_cpus();
> if (delta_search_threads <= 1) {
> find_deltas(list, &list_size, window, depth, processed);
> cleanup_threaded_search();
> @@ -2685,6 +2683,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
> pack_compression_level = Z_DEFAULT_COMPRESSION;
> else if (pack_compression_level < 0 || pack_compression_level > Z_BEST_COMPRESSION)
> die("bad pack compression level %d", pack_compression_level);
> +
> + if (!delta_search_threads) /* --threads=0 means autodetect */
> + delta_search_threads = online_cpus();
> +
> #ifdef NO_PTHREADS
> if (delta_search_threads != 1)
> warning("no threads support, ignoring --threads");
> diff --git a/thread-utils.h b/thread-utils.h
> index 6fb98c3..d9a769d 100644
> --- a/thread-utils.h
> +++ b/thread-utils.h
> @@ -7,5 +7,9 @@
> extern int online_cpus(void);
> extern int init_recursive_mutex(pthread_mutex_t*);
>
> +#else
> +
> +#define online_cpus() 1
> +
> #endif
> #endif /* THREAD_COMPAT_H */
> --
> 2.1.2-468-g1a77c5b
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-10-14 14:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-11 14:42 [PATCH 1/2] fix compilation with --disable-pthreads Etienne Buira
2014-10-11 14:46 ` [PATCH 2/2] Remove spurious 'no threads support' warnings Etienne Buira
2014-10-13 19:54 ` Junio C Hamano
2014-10-14 14:46 ` Etienne Buira
2014-10-13 19:10 ` [PATCH 1/2] fix compilation with --disable-pthreads Junio C Hamano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.