git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/6] thread lazy_init_name_hash

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 22, 2017, 20:54 UTC
Message-ID
<xmqq60j1jalv.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqshm5je4d.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 8 quoted lines
>> This patch series replaces my earlier
>>      * jh/memihash-opt (2017-02-17) 5 commits
>> patch series.
>
> Ahh.  I was scratching my head trying to remember why some of these
> look so familiar.  [PATCH v2 ...] would have helped.
>
> Thank you for an update.

One notable difference I noticed since the previous round is that this no longer adds precomputed hash to "struct cache_entry". As you are aiming to manage an index with a large number of entries, this is a welcome change that makes sense.

$ make NO_PTHREADS=NoThanks name-hash.o
    CC name-hash.o
name-hash.c: In function 'lazy_init_name_hash':
name-hash.c:573:3: error: implicit declaration of function 'threaded_lazy_init_name_hash' [-Werror=implicit-function-declaration]
   threaded_lazy_init_name_hash(istate);
   ^
name-hash.c: In function 'test_lazy_init_name_hash':
name-hash.c:595:2: error: 'lazy_nr_dir_threads' undeclared (first use in this function)
  lazy_nr_dir_threads = 0;
  ^
name-hash.c:595:2: note: each undeclared identifier is reported only once for each function it appears in
name-hash.c:596:2: error: 'lazy_try_threaded' undeclared (first use in this function)
  lazy_try_threaded = try_threaded;
  ^
name-hash.c:601:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^
cc1: all warnings being treated as errors
make: *** [name-hash.o] Error 1

still has to be addressed. Perhaps squash pieces of these into appropriate patches in the series?

 name-hash.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/name-hash.c b/name-hash.c
index a5826505e0..725ac22886 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -118,9 +118,16 @@ static int cache_entry_cmp(const struct cache_entry *ce1,
 	return remove ? !(ce1 == ce2) : 0;
 }
 
+static int lazy_try_threaded = 1;
+static int lazy_nr_dir_threads = 0;
 
 #ifdef NO_PTHREADS
 
+static void threaded_lazy_init_name_hash(struct index_state *istate)
+{
+	; /* nothing */
+}
+
 static int lookup_lazy_params(struct index_state *istate)
 {
 	return 0;
@@ -153,8 +160,6 @@ static int lookup_lazy_params(struct index_state *istate)
  */
 #define LAZY_MAX_MUTEX   (32)
 
-static int lazy_try_threaded = 1;
-static int lazy_nr_dir_threads = 0;
 static pthread_mutex_t *lazy_dir_mutex_array;
 
 /*
Previous: Junio C HamanoNext: Jeff Hostetler
Message 11 of 14 in “thread lazy_init_name_hash”
  1. 0/6 thread lazy_init_name_hashgit@jeffhostetler.com, Mar 22, 2017
  2. 3/6 hashmap: Add disallow_rehash settinggit@jeffhostetler.com, Mar 22, 2017
  3. 4/6 name-hash: perf improvement for lazy_init_name_hashgit@jeffhostetler.com, Mar 22, 2017
  4. 1/6 name-hash: specify initial size for istate.dir_hash tablegit@jeffhostetler.com, Mar 22, 2017
  5. 2/6 hashmap: allow memihash computation to be continuedgit@jeffhostetler.com, Mar 22, 2017
  6. 6/6 name-hash: add perf test for lazy_init_name_hashgit@jeffhostetler.com, Mar 22, 2017
  7. 5/6 name-hash: add test-lazy-init-name-hashgit@jeffhostetler.com, Mar 22, 2017
  8. Stefan BellerMar 22, 2017
  9. Jeff HostetlerMar 22, 2017
  10. Junio C HamanoMar 22, 2017
  11. Junio C HamanoMar 22, 2017
  12. Jeff HostetlerMar 22, 2017
  13. Junio C HamanoMar 22, 2017
  14. Junio C HamanoMar 22, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.