[MINOR] KmsgWriter opens /dev/kmsg on every write #31

Open
opened 2026-05-11 10:52:02 +00:00 by thabeta · 1 comment
Owner

Problem

KmsgWriter::write in my_init_pid1 opens /dev/kmsg for every single log write. This is slow and could fail under resource pressure during early boot when FDs are scarce.

Impact

Performance degradation during boot. Potential log loss if /dev/kmsg open fails during resource exhaustion.

Files

  • crates/my_init_pid1/src/main.rs -- KmsgWriter struct

Suggested Fix

Open /dev/kmsg once during init and reuse the file descriptor. Store it as a static or in the writer struct.

## Problem `KmsgWriter::write` in `my_init_pid1` opens `/dev/kmsg` for every single log write. This is slow and could fail under resource pressure during early boot when FDs are scarce. ## Impact Performance degradation during boot. Potential log loss if `/dev/kmsg` open fails during resource exhaustion. ## Files - `crates/my_init_pid1/src/main.rs` -- `KmsgWriter` struct ## Suggested Fix Open `/dev/kmsg` once during init and reuse the file descriptor. Store it as a static or in the writer struct.
Member

Classification: valid-bug — KmsgWriter opens /dev/kmsg on every write instead of caching the FD, causing performance degradation during early boot.

Per issue description referencing crates/my_init_pid1/src/main.rs: open /dev/kmsg per write is slow and could fail under FD scarcity.

> Classification: valid-bug — KmsgWriter opens /dev/kmsg on every write instead of caching the FD, causing performance degradation during early boot. Per issue description referencing crates/my_init_pid1/src/main.rs: open /dev/kmsg per write is slow and could fail under FD scarcity.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
geomind_code/my_init#31
No description provided.