Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 5887a91

Browse files
committed
Reduce and comment about Page::blocked_tasks cap.
1 parent 073d0bc commit 5887a91

File tree

1 file changed

+12
-1
lines changed
  • unified-scheduler-logic/src

1 file changed

+12
-1
lines changed

unified-scheduler-logic/src/lib.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,16 @@ impl Default for PageInner {
416416
fn default() -> Self {
417417
Self {
418418
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),
420429
}
421430
}
422431
}
@@ -726,6 +735,8 @@ impl SchedulingStateMachine {
726735
pub unsafe fn exclusively_initialize_current_thread_for_scheduling() -> Self {
727736
Self {
728737
last_task_index: None,
738+
// It's very unlikely this is desired to be configurable, like
739+
// `PageInner::blocked_tasks`'s cap.
729740
unblocked_task_queue: VecDeque::with_capacity(1024),
730741
active_task_count: ShortCounter::zero(),
731742
handled_task_count: ShortCounter::zero(),

0 commit comments

Comments
 (0)