From 264ba3180b859d85ce6bbfb7bb0e9aa9991bc6ce Mon Sep 17 00:00:00 2001 From: Jingyuan <52315061+MJY-HUST@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:43:42 +0800 Subject: [PATCH] keytablelist bugfix (#2835) --- src/bthread/key.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bthread/key.cpp b/src/bthread/key.cpp index 5720a675b2..1bf5ec899a 100644 --- a/src/bthread/key.cpp +++ b/src/bthread/key.cpp @@ -34,12 +34,12 @@ namespace bthread { -DEFINE_uint32(key_table_list_size, 5000, +DEFINE_uint32(key_table_list_size, 4000, "The maximum length of the KeyTableList. Once this value is " "exceeded, a portion of the KeyTables will be moved to the " "global free_keytables list."); -DEFINE_uint32(borrow_from_globle_size, 100, +DEFINE_uint32(borrow_from_globle_size, 200, "The maximum number of KeyTables retrieved in a single operation " "from the global free_keytables when no KeyTable exists in the " "current thread's keytable_list."); @@ -289,11 +289,12 @@ class BAIDU_CACHELINE_ALIGNMENT KeyTableList { count++; } if (prev != NULL) { - prev->next = NULL; if (*target == NULL) { *target = _head; + prev->next = NULL; } else { - (*target)->next = _head; + prev->next = *target; + *target = _head; } _head = current; _length -= count;