Language Selection

English French German Italian Portuguese Spanish

Linux: Accessing Files With O_DIRECT

Filed under
Linux

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

Nouveau In Linux 3.20 Will Have A Lot Of Code Cleaning

While the Nouveau pull request has yet to be issued for the DRM-Next merge window that will ultimately target the Linux 3.20 kernel, a look at the changes so far appear to mostly indicate this open-source NVIDIA driver is just going through a period of code cleaning and reorganization. Read more Also: Linux kernels for a macbook pro retina

Android Leftovers

Debian 8.0 "Jessie" Installer RC1 Released

The first release candidate for the Debian Jessie Installer in leading up to the Debian 8.0 "Jessie" release. While some Debian developers were hoping to release Debian 8.0 before February, it doesn't look like that will pan out given that the first release candidate of the installer surfaced today. Read more Also: Debian 8.0 "Jessie" RC1 Is Here, Test Away

Firefox 35.0.1 Now Out – My God, It's Full of Fixes

Two weeks after the release of Firefox 35, the Mozilla devs have pushed the first update out the door and they have fixed a number of important crashes and various other problems. Read more