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

Ruby 2.2.0 Released

We are pleased to announce the release of Ruby 2.2.0. Ruby 2.2 includes many new features and improvements for the increasingly diverse and expanding demands for Ruby. Read more

2014 Catalyst Linux Graphics Benchmarks Year-In-Review

With the year quickly coming to an end, it's time to do our year-end driver recap benchmarks from the year for the proprietary AMD and NVIDIA graphics drivers as well as the open-source drivers. To get things started, here's benchmarks done of the official AMD Catalyst Linux releases of 2014 and testing these drivers on three different graphics cards. Read more

From Red Hat's CEO: Reflecting on a 'great year,' looking to '15

It is confirmed: 2014 has been a great year for Red Hat. [On Dec. 18], we announced third quarter results of our fiscal year 2015 and, with that, celebrated our 51st consecutive quarter of revenue growth - more than 12 years of consecutive revenue growth. Thank you to the team of Red Hat customers, partners, open source contributors, and associates around the world, for helping us propel Red Hat to new heights. While 2014 has been a fantastic year for Red Hat, it has also been a banner year for open source. Read more Also: Red Hat Tech Exchange highlights: Architect, Implement, Enable

Open Source's 2014: MS 'cancer' embrace, NASDAQ listings, and a quiet dog

Ho hum. Another year, another slew of open source announcements that prove the once-maligned development methodology is now so mainstream as to be tedious. Running most of the world’s most powerful supercomputers? Been there, done that. Giving retailers the ability to deliver highly customized paper coupons to consumers based on warehouse inventory nearby? So 2013! And yet in 2014 we had a few events in open source that managed to surprise us, and suggest an even brighter future. Read more