@@ -416,7 +416,16 @@ impl Default for PageInner {
416
416
fn default ( ) -> Self {
417
417
Self {
418
418
usage : PageUsage :: default ( ) ,
419
- blocked_tasks : VecDeque :: with_capacity ( 1024 ) ,
419
+ // Capacity should be configurable to create with large capacity like 1024 inside the
420
+ // (multi-threaded) closures passed to create_task(). In this way, reallocs can be
421
+ // avoided happening in the scheduler thread. Also, this configurability is desired for
422
+ // unified-scheduler-logic's motto: separation of concerns (the pure logic should be
423
+ // sufficiently distanced from any some random knob's constants needed for messy
424
+ // reality for author's personal preference...).
425
+ //
426
+ // Note that large cap should be accompanied with proper scheduler cleaning after use,
427
+ // which should be handled by higher layers (i.e. scheduler pool).
428
+ blocked_tasks : VecDeque :: with_capacity ( 128 ) ,
420
429
}
421
430
}
422
431
}
@@ -726,6 +735,8 @@ impl SchedulingStateMachine {
726
735
pub unsafe fn exclusively_initialize_current_thread_for_scheduling ( ) -> Self {
727
736
Self {
728
737
last_task_index : None ,
738
+ // It's very unlikely this is desired to be configurable, like
739
+ // `PageInner::blocked_tasks`'s cap.
729
740
unblocked_task_queue : VecDeque :: with_capacity ( 1024 ) ,
730
741
active_task_count : ShortCounter :: zero ( ) ,
731
742
handled_task_count : ShortCounter :: zero ( ) ,
0 commit comments