|
|
Log in / Subscribe / Register

Abililty to turn off pagecache

Abililty to turn off pagecache

Posted Jun 11, 2024 18:05 UTC (Tue) by acarno (subscriber, #123476)
In reply to: Abililty to turn off pagecache by snajpa
Parent article: Dropping the page cache for filesystems

I guess I could envision useful scenarios from a security perspective, but generally this seems like a bad idea. Turning off the page cache entirely for the filesystem would imply all read / write operations have to go directly through disk, which is orders of magnitude slower (generally) than DRAM. A quick bit of searching shows the O_DIRECT flag attempts to minimize the involvement of the page cache (though not completely avoiding it).

Out of curiosity, what use cases would you find this useful for?


to post comments

Abililty to turn off pagecache

Posted Jun 11, 2024 20:06 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link]

A lot of databases or data-intensive applications just need to be able to write the data to disk, and they might not care about reading them at all. Or the other way around, they might read data only once, send it through the network, and then they might never need that particular piece of data again.

Abililty to turn off pagecache

Posted Jun 11, 2024 20:10 UTC (Tue) by pdewacht (subscriber, #47633) [Link]

See last week's article :) https://lwn.net/Articles/976856/

Abililty to turn off pagecache

Posted Jun 11, 2024 21:45 UTC (Tue) by snajpa (guest, #73467) [Link] (1 responses)

Or the filesystem might actually implement its own caching scheme, which might be better for some scenarios than what the kernel provides; if I were implementing a RDMA-based distributed FS, I'd want as much control over the memory I could possibly get. Pagecache is useful, but there is a huge potential for data duplication in memory between pagecache and the implementation's own details - even without RDMA, if the FS implementer has better ideas for cache management for a given use-case, duplication is currently unavoidable.

Abililty to turn off pagecache

Posted Jun 11, 2024 23:20 UTC (Tue) by Paf (subscriber, #91811) [Link]

It’s trivial if you want to write your own - nothing about the kernel and VFS forces you to use the page cache. Just don’t call those hooks.

It’s just an enormous pain to write your own and you’d better hope you’re better and can stay better because you get no benefit from general improvements from the community.

I *work* on an RDMA enabled distributed FS that uses the Linux page cache - Lustre, it’s the most popular one - and we don’t get any duplication from that. Nothing about the page cache gives us any trouble there - they’re just pages. You can do RDMA with them.

You’re also able to be selective about when you use the Linux page cache, as long as you’re willing to handle alignment issues yourself and cover conflicts (generally with flushing like DIO does),


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