3 ms·
What's the point of putting /tmp in RAM when a competent disk-backed filesystem will do that with the most heavily used files anyway?
by rwmj 2y ago
What's the point of putting /tmp in RAM when a competent disk-backed filesystem will do that with the most heavily used files anyway?
- kasabali 2y agoChange for the changes sake, of course.
- pjerem 2y agoYou gain writing cycles that are not going to wear out your SSD for files that are going to be erased anyway.
- silisili 2y agoIt's A) much faster, B) causes less wear, and C) automagically cleans itself, so to speak.
- pantalaimon 2y agoWhat about tmpdir as proposed by bcachefs? [0] That keeps the file in the page cache until it’s evicted, but instead of being written to swap it’s written to the fs. With the swap partition usually being quite small and the fs today being all the storage there is on a personal machine. [0] https://bcachefs.org/Roadmap/#tmpdir_support https://bcachefs.org/Roadmap/#tmpdir_support
- arp242 2y agoWell, as I read that page it doesn't actually exist (yet), so that rather makes it a hypothetical at this point. Might be interesting in the future, but not today.
- MrDrMcCoy 2y agoIt's a neat idea, but I doubt it'll take off. Swap with zswap as a backing for tmpfs should be plenty for the time being.
- walrus01 2y agoLess write wear on SSDs, which are by far the standard now for OS/boot disk compared to 10 or 15 years ago.
- viraptor 2y agoYou're still going to often wait for the file to be written to the disk since many apps care about running sync() in the right places. With tmpfs you don't have to wait.
- rwmj 2y agoThis is a fair point, but also an indication (again) that the sync primitives in posix are poorly designed. It should be possible to indicate that a file is a temporary and/or can be recreated from scratch. (O_TMPFILE isn't that)
- viraptor 2y agoSync is not only about persistence, but also actual synchronisation. If you're writing to two files and want to ensure ordering, you have to (f)sync - doesn't matter disk or ram.
- rwmj 2y agoI'm pretty sure that's not the case unless you're synchronizing across kernels (eg. NFS close-to-open sync). Although it's true that sync primitives for network filesystems are also a mess.
- viraptor 2y agoBlock devices and their drivers are free to reorder writes in absence of explicit synchronisation. The filesystem level is supposed to take care of keeping things from breaking. I would suspect that tmpfs itself prevents any reordering... but I wouldn't bet on it. Non-memory devices will happily reorder.
- rwmj 2y agoSure, but this is only important if you're working across kernels (or need correct persistence across a crash+reboot, which is "across kernels in time"). Within a single kernel instance, two processes do not need to think about such synchronisation, or else just about all software written would be broken.