|
|
Subscribe / Log in / New account

Two new ways to read a file quickly

Two new ways to read a file quickly

Posted Mar 7, 2020 1:04 UTC (Sat) by quotemstr (subscriber, #45331)
Parent article: Two new ways to read a file quickly

These new system calls are nice, but we can't add a fixed-function system call for every single thing somebody might want to do in the kernel. My ideal is a mechanism to send a little BPF program to the kernel and let it specify a bunch of different things to do there --- for example, open a file, read this byte, mmap this range, whatever, all as a single unit of work, entering the kernel once. You'd register such a program with the kernel from userspace, get a file descriptor back, and invoke your custom program via a single system call.

This way, any userspace program would be able to build its own system call.


to post comments

Two new ways to read a file quickly

Posted Mar 7, 2020 6:54 UTC (Sat) by ncm (guest, #165) [Link] (2 responses)

How is this (or any of the other notions) better than the series of system calls? In each case you have a series of things you want the kernel to do, and more or less elaborate ways to specify them. But actually doing the system calls achieves exactly the desired thing without bloating the kernel any.

Io_uring makes some sense, eliminating a million or a billion system calls in exchange for a little setup. Eliminating two out of three calls just looks foolish. Even if you have to read a thousand files, or a million: one million calls, three million calls, who cares? The time spent is in pottering around in the file system, not transitioning between user and system. An ordinary library function much shorter than 21 lines does it.

The whole discussion makes no sense. It makes me wonder if Linux is shuffling toward irrelevance. It has happened to better kernels.

Two new ways to read a file quickly

Posted Mar 7, 2020 7:12 UTC (Sat) by epa (subscriber, #39769) [Link]

I imagine that on some network file systems having a single system call means a single round trip to the server.

Two new ways to read a file quickly

Posted Mar 7, 2020 7:47 UTC (Sat) by beagnach (guest, #32987) [Link]

> The time spent is in pottering around in the file system, not transitioning between user and system.

I think much of the discussion is based on the assumption that there are situations where this is not true.
So far we've seen a lot generalizations - hopefully some benchmarks will be provided in the near future.

Two new ways to read a file quickly

Posted Mar 9, 2020 9:28 UTC (Mon) by pwfxq (subscriber, #84695) [Link]

I could see small utilities being cross-compiled into BPF and run directly in kernel space, rather than user space. After that, I could see some wag expanding the BPF instruction limit and getting Emacs to run in kernel space.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds