USB: P2 crossbeam bounded channels — prevent OOM under USB load
IMPROVEMENT-PLAN.md §10.2 item 4: medium priority fix. Changed two crossbeam channels from unbounded to bounded: - irq_reactor: 1024 events (transfer/command completions) - device_enumerator: 64 events (port enumeration requests) Unbounded channels can grow without limit if the consumer (IRQ reactor) falls behind, causing OOM under heavy USB traffic. Bounded channels provide natural backpressure — the sender (scheme handler) blocks when the channel is full, causing the USB client to back off. Cross-referenced with Linux 7.1 xhci-ring.c producer/consumer pattern where transfer rings are bounded by hardware limits.
This commit is contained in:
@@ -467,9 +467,9 @@ impl<const N: usize> Xhci<N> {
|
||||
let entries_per_page = PAGE_SIZE / mem::size_of::<Trb>();
|
||||
let cmd = Ring::new::<N>(ac64, entries_per_page, true)?;
|
||||
|
||||
let (irq_reactor_sender, irq_reactor_receiver) = crossbeam_channel::unbounded();
|
||||
let (irq_reactor_sender, irq_reactor_receiver) = crossbeam_channel::bounded(1024);
|
||||
|
||||
let (device_enumerator_sender, device_enumerator_receiver) = crossbeam_channel::unbounded();
|
||||
let (device_enumerator_sender, device_enumerator_receiver) = crossbeam_channel::bounded(64);
|
||||
|
||||
let mut xhci = Self {
|
||||
base: address as *const u8,
|
||||
|
||||
Reference in New Issue
Block a user