From f5fa4a19c140d9b83bd8993e8ce7c9b7a13d994a Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Tue, 16 May 2023 09:33:23 +0200 Subject: [PATCH] client: speedup hashing --- kernel/mars_client.c | 6 ++++++ kernel/mars_client.h | 1 + 2 files changed, 7 insertions(+) diff --git a/kernel/mars_client.c b/kernel/mars_client.c index e01d5562..9d3892bf 100644 --- a/kernel/mars_client.c +++ b/kernel/mars_client.c @@ -563,6 +563,9 @@ void __hash_insert(struct client_output *output, int ref_id; unsigned int hash_index; + if (mref_a->is_hashed) + return; + list_del(&mref_a->hash_head); ref_id = READ_ONCE(mref->ref_id); if (!ref_id) { @@ -575,6 +578,7 @@ void __hash_insert(struct client_output *output, } hash_index = CLIENT_HASH_FN(ref_id); list_add_tail(&mref_a->hash_head, &output->hash_table[hash_index]); + mref_a->is_hashed = true; } static @@ -729,6 +733,7 @@ int receiver_thread(void *data) mref_a = tmp_mref_a; mref = tmp_mref; list_del_init(&mref_a->hash_head); + mref_a->is_hashed = false; list_del_init(&mref_a->io_head); /* Networking produces inherent races between re-submission and * completion. Compensate them here. @@ -890,6 +895,7 @@ void _do_timeout(struct client_output *output, struct list_head *anchor, int *ro continue; list_del_init(&mref_a->hash_head); + mref_a->is_hashed = false; list_del_init(&mref_a->io_head); mref_a->has_completed = true; diff --git a/kernel/mars_client.h b/kernel/mars_client.h index 111c2992..df4ae2b9 100644 --- a/kernel/mars_client.h +++ b/kernel/mars_client.h @@ -48,6 +48,7 @@ struct client_mref_aspect { int alloc_len; bool do_dealloc; bool has_completed; + bool is_hashed; }; struct client_brick {