yannan-wyn commented on code in PR #3270:
URL: https://github.com/apache/brpc/pull/3270#discussion_r3371996257


##########
src/bthread/task_control.cpp:
##########
@@ -205,11 +207,28 @@ TaskControl::TaskControl()
     , _status(print_rq_sizes_in_the_tc, this)
     , _nbthreads("bthread_count")
     , _enable_priority_queue(FLAGS_enable_bthread_priority_queue)
-    , _priority_queues(FLAGS_task_group_ntags)
+    , _pq_num_of_each_tag(FLAGS_event_dispatcher_num)
+    , _priority_queues(FLAGS_task_group_ntags * FLAGS_event_dispatcher_num)

Review Comment:
   I think the per-ED WSQ may be better than an atomic slot here.
   
   Currently the per-ED WSQ will meet 1-producer and N consumers (1:N model);
   And WSQ has a cheaper empty steal path. When the queue is empty, 
WSQ::steal() only loads _top and _bottom and returns false:
   
        t = _top.load(acquire);
         b = _bottom.load(acquire);
         if (t >= b) {
             return false;
         }
         
         but atomic slot may
   
   slot.exchange(INVALID_BTHREAD).
   
   An atomic-slot implementation can be more intuitive, but if workers scan 
empty slots, it may cause more cacheline invalidation.
   
   Or maybe I can add comments to show this trade-off?
   @chenBright 



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