Language Selection

English French German Italian Portuguese Spanish

Linux: Accessing Files With O_DIRECT

Filed under

A thread on the lkml began with a query about using O_DIRECT when opening a file. An early white paper written by Andrea Arcangeli [interview] to describe the O_DIRECT patch before it was merged into the 2.4 kernel explains, "with O_DIRECT the kernel will do DMA directly from/to the physical memory pointed [to] by the userspace buffer passed as [a] parameter to the read/write syscalls. So there will be no CPU and memory bandwidth spent in the copies between userspace memory and kernel cache, and there will be no CPU time spent in kernel in the management of the cache (like cache lookups, per-page locks etc..)." Linux creator Linus Torvalds was quick to reply that despite all the claims there is no good reason for mounting files with O_DIRECT, suggesting that interfaces like madvise() and posix_fadvise() should be used instead, "there really is no valid reason for EVER using O_DIRECT. You need a buffer whatever IO you do, and it might as well be the page cache. There are better ways to control the page cache than play games and think that a page cache isn't necessary."

Linus went on to explain,

Full Story.

More in Tux Machines

Erle-Spider, the Ubuntu Drone with Legs Needs Your Help to Become a Reality - Video

We've talked a lot about the upcoming Ubuntu-powered drone with legs, called Erle-Spider, from the Erle Robotics team, who just demoed the device live earlier today, October 13, on Canonical's UbuntuOnAir YouTube channel (see the video below). Read more

Best Quality and Quantity of Contributions in the New Xen Project 4.6 Release

I’m pleased to announce the release of Xen Project Hypervisor 4.6. This release focused on improving code quality, security hardening, enablement of security appliances, and release cycle predictability — this is the most punctual release we have ever had. We had a significant amount of contributions from cloud providers, software vendors, hardware vendors, academic researchers and individuals to help with this release. We continue to strive to make Xen Project Hypervisor the most secure open source hypervisor to match the security challenges in cloud computing, and for embedded and IoT use-cases. We are also continuing to improve upon the performance and scalability for our users, and aim to continuously bring many new features to our users in a timely manor. Read more

Liquorix Kernel Benchmarked Against Linux 4.2, Linux 4.3 Kernels

Recently there were a number of requests about testing the latest state of Liquorix, the self-prcolaimed "better distro kernel" that is an optimized version of the Linux kernel with extra patches that makes it optimal for desktop, multimedia, and gaming workloads. Here's some fresh Liquorix vs. mainline Linux kernel performance benchmarks. Read more