Copilot commented on code in PR #3782:
URL: https://github.com/apache/brpc/pull/3782#discussion_r4728084712


##########
src/brpc/rdma/rq_connection.cpp:
##########
@@ -1077,7 +1076,7 @@ void RqConnection::Debug(std::ostream& os, 
butil::StringPiece connector) const {
 
 int RqConnection::GlobalInitialize() {
     g_rdma_resource_mutex = new bthread::Mutex;
-    for (int i = 0; !FLAGS_rdma_use_srq && i < FLAGS_rdma_prepared_qp_cnt; 
++i) {
+    for (int i = 0; i < FLAGS_rdma_prepared_qp_cnt; ++i) {
         RdmaResource* res = AllocateQpCq(FLAGS_rdma_prepared_qp_size,
                                          FLAGS_rdma_prepared_qp_size);
         if (!res) {

Review Comment:
   This makes every RDMA process precreate `rdma_prepared_qp_cnt` dedicated 
resources even when SRQ is the intended steady-state path. With the default 
1024 entries, that is 1024 QPs, 2048 event-mode CQs, and 1024 
completion-channel fds before any connection; on an HCA sized for SRQ but not 
for that pool, `GlobalInitialize()` fails and the process exits instead of 
allowing SRQ to operate and only allocating a private QP when fallback is 
actually needed. `RqConnection::Initialize()` already allocates a resource on 
demand when the pool is empty, so please avoid making the SRQ startup path 
depend on this large preallocation (or make the preallocation 
optional/non-fatal).



-- 
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