relayfs: An Efficient Unified Approach for Transmitting Data from Kernel to User Space
Linux has several mechanisms for relaying information about the system and applications to the user. Some examples include printk and other syslog events, evlog, ltt, oprofile, etc. Each subsystem has its own method for relaying information from the kernel to user space. Some of these mechanisms have difficulties, e.g. logging of printk messages is unreliable. In addition to selected difficulties, the replication of code and maintenance is undesirable. In this paper we describe a high-speed data relay filesystem that satisfies the buffering requirements of the above subsystems while providing a unified, efficient, and reliable relay mechanism. relayfs allows subsystems to log data efficiently and safely using lockless technology that is designed to scale well on multiprocessor systems. relayfs includes the flexibility to be expanded should other subsystems need additional services, but has a simple design intended to meet the needs of currently available subsystems. In this paper we discuss the architecture, implementation, and usage of relayfs. relayfs uses channels that allow data to be directed to a suitable buffer or buffers for the subsystems that allocated the channel. We describe the kernel API and file naming conventions, address init-time issues, and discuss performance trade-offs available using relayfs. Finally we demonstrate how existing subsystems use relayfs to log their data.