AnDiXL commented on PR #2965:
URL: https://github.com/apache/brpc/pull/2965#issuecomment-3876782146

   > ### What problem does this PR solve?
   > Issue Number:
   > 
   > Problem Summary:
   > 
   > rdma block pool runtime ExtendBlockPool has some error:
   > 
   > 1. a region may has many buckets, extend a region not hold all bucket 
locks, will case race condition, disable runtime extend a region when buckets 
greater than 1.
   > 2. when new region created, link the region to idle_list case link list 
break.
   > 3. add feature, in scenarios where users need to manually specify memory 
regions (e.g., using hugepages or custom memory pools), when 
FLAGS_rdma_memory_pool_user_specified_memory is true, user is  responsibility 
of extending memory blocks , this ensuring flexibility for advanced use cases.
   > 
   > ### What is changed and the side effects?
   > Changed:
   > 
   > Side effects:
   > 
   > * Performance effects:
   > * Breaking backward compatibility:
   > 
   > ### Check List:
   > * Please make sure your changes are compilable.
   > * When providing us with a new feature, it is best to add related tests.
   > * Please follow [Contributor Covenant Code of 
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
   
   “a region may has many buckets, extend a region not hold all bucket locks, 
will case race condition, disable runtime extend a region when buckets greater 
than 1.”
   
   Why not modify it so that a lock is added to the bucket when expanding the 
region? In this way, there would be no need to limit the number of buckets. 
   For example, in the following form:
   `
       for (size_t i = 0; i < g_buckets; ++i) {
           node[i]->start = (void*)(region->start + i * (region_size / 
g_buckets));
           node[i]->len = region_size / g_buckets;
   
           BAIDU_SCOPED_LOCK(*g_info->lock[block_type][i]);
           node[i]->next = g_info->idle_list[block_type][i];
           g_info->idle_list[block_type][i] = node[i];
           g_info->idle_size[block_type][i] += node[i]->len;
       }
   `


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to